Skip to content

Commit 0624340

Browse files
committed
can skip trimming tree if retainStops is selected
1 parent bf800ea commit 0624340

9 files changed

Lines changed: 18 additions & 335 deletions

AlignmentProcessor.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,14 @@ def phylipConvert(outdir, starttime, codeml):
193193
print("Total runtime: ", elapsedtime)
194194
return True
195195

196-
def runcodeml(outdir, starttime):
196+
def runcodeml(outdir, retainStops, starttime):
197197
'''Runs codeml on a directory.'''
198198
print("Running codeml...")
199-
cm = Popen(split("python bin/07_CodeMLonDir.py " + outdir))
199+
if retainStops == False:
200+
cm = Popen(split("python bin/07_CodeMLonDir.py " + outdir))
201+
elif retainStops == True:
202+
cm = Popen(split("python bin/07_CodeMLonDir.py " + outdir +
203+
"--retainStops"))
200204
cm.wait()
201205
if cm.returncode == 0:
202206
elapsedtime = datetime.now() - starttime
@@ -336,7 +340,7 @@ def main():
336340
# Run codeml
337341
if codeml == True and kaks == False:
338342
if pc == True:
339-
runcodeml(outdir, starttime)
343+
runcodeml(outdir, retainStops, starttime)
340344

341345
if __name__ == "__main__":
342346
main()

AlignmentProcessorReadMe.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@ Remember that the order of the arguments does matter for these scripts.
372372
so that it only includes species which have not been filtered out.
373373

374374
python 07_CodeMLonDir.py <path to codeml control file> \
375-
<path to input and output directories>
375+
<path to input and output directories> \
376+
--retainStops(optional)
376377

377378
3 07_pruneTree.R
378379

bin/02_RemoveHeader.py~

Lines changed: 0 additions & 65 deletions
This file was deleted.

bin/02_nameList.txt~

Lines changed: 0 additions & 108 deletions
This file was deleted.

bin/07_CodeMLonDir.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def readIn(path):
6969
rmseqs[splt[0]] = [str(splt[1]).rstrip(), ]
7070
return usertree, nodes, ctl, rmseqs
7171

72-
def runCodeML(usertree, path, ctl, rmseqs, nodes):
72+
def runCodeML(usertree, path, ctl, rmseqs, nodes, retainStops):
7373
'''Runs CodeML on all files in a directory using temporary controlfiles.'''
7474
# Open all input files in the directory
7575
inpath = path + "06_phylipFiles/" + "*.phylip"
@@ -79,7 +79,7 @@ def runCodeML(usertree, path, ctl, rmseqs, nodes):
7979
geneid = filename.split(".")[0]
8080
outfile = path + "07_codeml/" + geneid
8181
tempctl = path + "07_codeml/tmp.ctl"
82-
if usertree == True:
82+
if retainStops == False and usertree == True:
8383
# Prune tree only if it will be used
8484
pruneTree(path, geneid, rmseqs, nodes)
8585
with open(tempctl, "w") as temp:
@@ -145,12 +145,18 @@ def main():
145145
print("Usage: python 07_CodeMLonDir.py <path to codeml control file>")
146146
quit()
147147
else:
148+
retainStops = False
148149
path = argv[1]
149150
# Set directory names and add a trailing "/" if necessary
150151
if path[-1] != "/":
151152
path += "/"
153+
try:
154+
if argv[2] == "--retainStops":
155+
retainStops = True
156+
except IndexError:
157+
pass
152158
usertree, nodes, ctl, rmseqs = readIn(path)
153-
runCodeML(usertree, path, ctl, rmseqs, nodes)
159+
runCodeML(usertree, path, ctl, rmseqs, nodes, retainStops)
154160

155161
if __name__ == "__main__":
156162
main()

bin/07_CodeMLonDir.py~

Lines changed: 0 additions & 47 deletions
This file was deleted.

bin/07_KaKsonDir.py~

Lines changed: 0 additions & 37 deletions
This file was deleted.

bin/07_pruneTree.R~

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)