<commit_before>#!/usr/bin/python3
# A program for trimal'ing all files that contain protein sequences of single-copy orthologs.
# USAGE: ./trimal4Orthofiles_TA.py
# Author: <NAME>
# Affiliation: University of New Hampshire, Durham, NH, USA
# Date: 01/27/2016
# Purpose is

import sys
import os
import subprocess
import argparse
import shutil

parser = argparse.ArgumentParser(description="This script runs trimal for files in a directory.")
parser.add_argument('--root', default="/home/mcclintock/ta2007/myscripts/orthogroupScripts/parsed_orthogroups_len16/", help="PATH to the directory containing orthogroup files.")
parser.add_argument('--trimal_dir', default="/home/mcclintock/ta2007/myscripts/orthogroupScripts/trimal_orthogroups_len16_gt20percent/", help="PATH to the directory for trimmed orthogroup files.")
args = parser.parse_args()


def runtrimal(input_file, output_file):
    trimal_command = "/home/mcclintock/ta2007/bin/trimal/source/trimal -in {0} -out {1} -gt 0.20".format(input_file, output_file)
    subprocess.call(trimal_command, shell=True)



Orig_file_dir = args.root
trimal_file_dir = args.trimal_dir

for currentFile in os.listdir(args.root):
    if currentFile.endswith(".fa"):
        trimmed_output = runtrimal(args.root + currentFile, args.trimal_dir + currentFile[:-3]+"_trimmed.fa")<commit_msg>Updating trimal script<commit_after>#!/usr/bin/python3
# A program for trimal'ing all files that contain protein sequences of single-copy orthologs.
# USAGE: ./trimal4Orthofiles_TA.py
# Author: <NAME>
# Affiliation: University of New Hampshire, Durham, NH, USA
# Date: 01/27/2016
# Purpose is trim protein sequences using trimAl v1.4.rev15 with -gt option set to 0.20
# Usage: ./trimal4Orthofiles_TA.py --root dir_with_all_orthofinder_files --trimal_dir path_to_output_dir

import os
import subprocess
import argparse


parser = argparse.ArgumentParser(description="This script runs trimal for files in a directory.")
parser.add_argument('--root', help="PATH to the directory containing orthogroup files.")
parser.add_argument('--trimal_dir', help="PATH to the directory for trimmed orthogroup files.")
args = parser.parse_args()


def runtrimal(input_file, output_file):
    trimal_command = "trimal -in {0} -out {1} -gt 0.20".format(input_file, output_file)
    subprocess.call(trimal_command, shell=True)


Orig_file_dir = args.root
trimal_file_dir = args.trimal_dir

for currentFile in os.listdir(args.root):
    if currentFile.endswith(".fa"):
        trimmed_output = runtrimal(args.root + currentFile, args.trimal_dir + currentFile[:-3]+"_trimmed.fa")
{'fraction_non_alphanumeric': 0.11145510835913312, 'fraction_numerical': 0.02244582043343653, 'mean_word_length': 5.398514851485149, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7474459', 'n_tokens_mistral': 889, 'n_tokens_neox': 839, 'n_words': 213}