Skip to content

Commit 6e8e265

Browse files
committed
Added python script to convert fasta to axt, streamlined i/o.
1 parent a362a7c commit 6e8e265

9 files changed

Lines changed: 249 additions & 265 deletions

AlignmentProcessor.py

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ def rmHeader(outdir, commonNames):
118118
if commonNames == False:
119119
rh = Popen(split("python bin/02_RemoveHeader.py " + outdir))
120120
elif commonNames == True:
121-
rh = Popen(split("python bin/02_RemoveHeader.py " + outdir +
122-
"--changeNames"))
121+
rh = Popen(split("python bin/02_RemoveHeader.py " + outdir +
122+
" --changeNames"))
123123
rh.wait()
124124
if rh.returncode == 0:
125125
return True
@@ -206,34 +206,34 @@ def runcodeml(cpu, outdir, forward, starttime):
206206
#-----------------------------------------------------------------------------
207207

208208
def helplist():
209-
print("\n### AlignmentProcessor will run the subsituion rate pipeline to \
210-
produce trimmed axt files for use with KaKs_calculator. ###\n")
209+
print("\nAlignmentProcessor0.21 Copyright 2016 by Shawn Rupp\n")
211210
print("\texample usage: python AlignmentProcessor.py -% <decimal> \
212211
--axt/phylip --kaks/codeml -i <input fasta file> -o \
213-
<path to output directory> -r <reference species>")
214-
print("\t-i path to input file containing a multifasta alignment")
215-
print("\t-o AlignmentProcessor will use this as its working \
212+
<path to output directory> -r <reference species>\n")
213+
print("\t-i\tpath to input file containing a multifasta alignment")
214+
print("\t-o\tAlignmentProcessor will use this as its working \
216215
directory and print output to this directory")
217-
print("\t-r the name of the reference species which will be used to \
216+
print("\t-r\tthe name of the reference species which will be used to \
218217
determine the open reading frame")
219-
print("\t--ucsc converts headers of CDS fasta files obtained from \
218+
print("\t--ucsc\tconverts headers of CDS fasta files obtained from \
220219
the UCSC genome browser")
221-
print("\t--axt Converts files to axt for use in KaKs_Calcuator.")
222-
print(" \t--phylip Converts files to phylip for use in PhyML.")
223-
print("\t--kaks Runs KaKs_Calcuator if --axt is also specified")
224-
print("\t--codeml Runs codeml if --phylip is also specified")
225-
print("\t-t number of threads to use for CodeML.")
226-
print("\t-f specifies the forward branch of the CodeML input tree.")
227-
print("\t--retainStops retain sequences with internal stop codons")
228-
print("\t-% Sets the percentage cutoff for the countBases step (50% \
220+
print("\t--axt\tConverts files to axt for use in KaKs_Calcuator.")
221+
print("\t--phylip\tConverts files to phylip for use in PhyML.")
222+
print("\t--kaks\tRuns KaKs_Calcuator if --axt is also specified")
223+
print("\t--codeml\tRuns codeml if --phylip is also specified")
224+
print("\t-t\tnumber of threads to use for CodeML.")
225+
print("\t-f\tspecifies the forward branch of the CodeML input tree.")
226+
print("\t-%\tSets the percentage cutoff for the countBases step (50% \
229227
by default).")
230-
print("\t--printNameList prints list of genome build names and\
228+
print("\t--changeNames\tchange genome build names to common names.")
229+
print("\t--retainStops\tretain sequences with internal stop codons")
230+
print("\t--printNameList\tprints list of genome build names and\
231231
associated common names")
232-
print("\t--addNameToList add new genome build name and\
232+
print("\t--addNameToList\tadd new genome build name and\
233233
associated common name to list")
234-
print("\t-v prints coyright and version information to the screen")
235-
print("\n### Please note that you must be in the substituionManager \
236-
directory to run the program.###\n")
234+
print("\t-v\tprints coyright and version information to the screen")
235+
print("\n### Please note that you must be in the AlignmentProcessor \
236+
directory to run the program. ###\n")
237237

238238
def main():
239239
starttime = datetime.now()
@@ -250,13 +250,18 @@ def main():
250250
percent = "0.5"
251251
ref = "void"
252252
forward = ""
253-
# Extract values from command line:
253+
254254
for i in argv:
255-
if i == "-h" or i == "--help":
255+
# Print help list
256+
if len(argv) == 1:
257+
helplist()
258+
quit()
259+
elif i == "-h" or i == "--help":
256260
helplist()
257261
quit()
262+
# Other functions
258263
elif i == "-v" or i == "--version":
259-
print("\nAlignmentProcessor0.20 Copyright 2016 by Shawn Rupp\n")
264+
print("\nAlignmentProcessor0.21 Copyright 2016 by Shawn Rupp\n")
260265
print("This program comes with ABSOLUTELY NO WARRANTY\n")
261266
print("This is free software, and you are welcome to redistribute\
262267
it under certain conditions\n")
@@ -265,6 +270,7 @@ def main():
265270
readList("read", "void", "void")
266271
elif i == "--addNameToList":
267272
readList("add", argv[argv.index(i) + 1], argv[argv.index(i) + 2])
273+
# Extract values from command line:
268274
elif i == "-i":
269275
fasta = argv[argv.index(i) + 1]
270276
elif i == "-o":

0 commit comments

Comments
 (0)