Skip to content

Commit bedc670

Browse files
committed
Added ability to read input from Quoll.
1 parent ca17f12 commit bedc670

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

bin/01_SplitFasta.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ def convertHeader(line):
8787
# NCBI IDs
8888
build = ">" + str(genebuild[2]) + "\n"
8989
geneid = str(genebuild[0]) + "_" + str(genebuild[1])
90+
elif "TRINITY" in line:
91+
line = line.split("TRINITY-")[1]
92+
line = line.strip()
93+
build = ">" + line[:line.find("-")] + "\n"
94+
geneid = line[line.find("-")+1:]
9095
else:
9196
# Extract build and geneid
9297
build = ">" + line.split(".")[0][1:].rstrip() + "\n"

bin/02_FilterFasta.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,22 @@ def seqDict(fasta, n):
9494
def checkFrame(seqs, ref):
9595
'''Removes gaps in the reference sequence introduced by
9696
alignment and removes corresponding sites in other species'''
97-
for codon in seqs[ref]:
97+
for idx,codon in enumerate(seqs[ref]):
9898
if codon == "---":
9999
pass
100100
else:
101101
if "-" in str(codon):
102102
# Remove gaps from reference sequence
103103
i = codon.index("-")
104-
idx = seqs[ref].index(codon)
105104
codon = codon[:i] + codon[i + 1:]
106105
for key in seqs:
107-
# Remove corresponding gaps in other sequences
108-
triplet = seqs[key][idx]
109-
triplet = triplet[:i] + triplet[i + 1:]
106+
if key != ref:
107+
# Remove corresponding gaps in other sequences
108+
try:
109+
triplet = seqs[key][idx]
110+
triplet = triplet[:i] + triplet[i + 1:]
111+
except:
112+
pass
110113
return True, seqs
111114

112115
def fixCodons(newseq):

bin/04_CallKaKs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def calculateKaKs(indir, outdir, method, axt):
2424
filename = axt.split("/")[-1]
2525
# Create output file
2626
outfile = (outdir + filename.split(".")[0] + ".kaks")
27-
ck = Popen(split("bin/KaKs_Calculator -i " + axt + " -o " +
28-
outfile + " -m " + method), stdout = DEVNULL)
27+
cmd = "bin/KaKs_Calculator -i "+axt+" -o "+outfile+" -m "+method
28+
ck = Popen(split(cmd), stdout = DEVNULL)
2929
ck.wait()
3030
if ck.returncode() == 0:
3131
return True
@@ -69,8 +69,8 @@ def main():
6969
KaKs_Calculator on a directory.")
7070
parser.add_argument("-i", help = "Path to input file.")
7171
parser.add_argument("-o", help = "Path to output file.")
72-
parser.add_argument("-m", help = "Method for calculating Ka/Ks.")
73-
parser.add_argument("-t", type = int, help = "Number of threads.")
72+
parser.add_argument("-m", default = "NG", help = "Method for calculating Ka/Ks.")
73+
parser.add_argument("-t", type = int, default = 1, help = "Number of threads.")
7474
# Parse arguments and assign to variables
7575
args = parser.parse_args()
7676
indir = args.i

0 commit comments

Comments
 (0)