-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_busted_model.py
More file actions
42 lines (33 loc) · 1.13 KB
/
run_busted_model.py
File metadata and controls
42 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import sys
def busted_run(prefix,seq_file,treefile,outfile,scriptfile_b,gene_name):
import subprocess
with open(scriptfile_b, 'w') as fh:
fh.write('#!/bin/bash\n')
fh.write('cd '+prefix+' \n')
fh.write('hyphy busted --alignment ')
fh.write(seq_file)
fh.write(' -tree ')
fh.write(treefile)
fh.write('--branches Foreground ')
fh.write('--outfile ')
fh.write(outfile)
fh.write(' \n')
## submit the pbs.sh
# subprocess.call(['qsub', scriptfile_b])
#Provide directory of the gene name subdirectories
dirName = sys.argv[1]
#Provide location of edited tree files
treeDir = sys.argv[2]
dirList = os.listdir(dirName)
geneDirName = ''
geneName = ''
for items in dirList:
geneDirName = dirName + items
if(os.path.isdir(geneDirName)):
geneName = items
seqFileName = dirName+geneName+"/"+"nuc_"+geneName+"_aligned.fasta"
treeFileName = treeDir+geneName+"_edited_tree.nwk" #LOCATION OF EDITED TREEFILES
nulloutFileName = dirName+geneName+"/"+geneName+"_busted_model.out"
nullScriptName = dirName+geneName+"_busted_model.sh"
busted_run(dirName,seqFileName,treeFileName,nulloutFileName,nullScriptName,geneName)