Skip to content

Commit

Permalink
fixed issue with family subtype reporting in C.mortiferum
Browse files Browse the repository at this point in the history
  • Loading branch information
kbessonov1984 committed Jan 3, 2025
1 parent 49d8925 commit 1917934
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions CryptoGenotyper/gp60.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,10 +780,6 @@ def determineRepeats(self):
if (numHomfR != 0) and family == "If":
repeat += "R" + str(numHomfR)

if 'mortiferum' in self.species:
accession_and_subtype = re.search(r"(\w{1,1})(\(\w+\))", self.species.split('|')[-1])
if accession_and_subtype:
repeat += accession_and_subtype.group(1)

if not goodRepeat:
repeat = ""
Expand Down Expand Up @@ -1380,7 +1376,6 @@ def printFasta(self, contig, mode, sampleName, filetype="ab1", customdatabsename
#Output Species and Subfamily(ex. C.parvum\tIIa)
if len(self.species.split("(")) > 0:
speciesName = self.species.split("(")[0]

if len(speciesName.split("|")) >= 2:
self.tabfile.write(speciesName.split("|")[0] + "\t" + speciesName.split("|")[1])
self.file.write(" | " + speciesName.split("|")[0] + " " + speciesName.split("|")[1])
Expand Down Expand Up @@ -1409,13 +1404,15 @@ def printFasta(self, contig, mode, sampleName, filetype="ab1", customdatabsename
if foundRepeat:
self.tabfile.write(self.repeats)
self.file.write(self.repeats)



#Still outputting repeats if there's a subfamily
if len(speciesName.split("|")) == 3 and foundRepeat:
self.file.write(speciesName.split("|")[2])
self.tabfile.write(speciesName.split("|")[2])
if len(speciesName.split("|")) == 3 and foundRepeat == True:
subfamily = speciesName.split("|")[2]
LOG.debug(f"Appending family subtype {subfamily} to {speciesName.split("|")[1]}{self.repeats}")
self.file.write(subfamily)
self.tabfile.write(subfamily)

#Output sequence
self.tabfile.write("\t" + seq)
Expand Down Expand Up @@ -1720,13 +1717,11 @@ def gp60_main(pathlist_unfiltered, fPrimer, rPrimer, typeSeq, expName, customdat
else:
forward.determineFamily(customdatabsename)
forward.determineRepeats()

forward.printFasta("", typeSeq, forward.name.split(f".{filetype}")[0], filetype, customdatabsename)

LOG.info(f"Finished analyzing sequence {path} ...")

experimentName = expName + "_"

output_report_file_name = experimentName+'cryptogenotyper_report.fa'
filename = os.path.join('.', output_report_file_name)
with open(filename, 'w') as resultFile:
Expand Down

0 comments on commit 1917934

Please sign in to comment.