From 6343c5698e20e6cc210550716e0a43f852024f8a Mon Sep 17 00:00:00 2001 From: Dana Elizabeth Wyman Date: Fri, 28 Sep 2018 15:14:22 -0700 Subject: [PATCH] Fixed bug affecting output of unmapped transcripts to sam file --- TranscriptClean.py | 1 - transcript2.py | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/TranscriptClean.py b/TranscriptClean.py index 146bc2e..91ec182 100644 --- a/TranscriptClean.py +++ b/TranscriptClean.py @@ -690,7 +690,6 @@ def cleanNoncanonical(transcripts, annotatedJunctions, genome, n, spliceAnnot, o Transcript2.addUncorrected_NC_SJ(currTranscript) else: # Attempt to perform correction - print currTranscript.QNAME currSeq = currTranscript.SEQ currCIGAR = currTranscript.CIGAR corrected = [] diff --git a/transcript2.py b/transcript2.py index 1997b94..e8fde29 100644 --- a/transcript2.py +++ b/transcript2.py @@ -295,8 +295,13 @@ def printableSAM(self, genome, spliceAnnot): fields = [ self.QNAME, self.FLAG, self.CHROM, self.POS, self.MAPQ, self.CIGAR, \ self.RNEXT, self.PNEXT, self.TLEN, self.SEQ, self.QUAL, self.otherFields, \ self.NM, self.MD, self.jM, self.jI ] - fields = filter(None, fields) - return "\t".join([str(x) for x in fields]).strip() + + final_fields = [] + for field in fields: + if field != "" and field != None: + final_fields.append(field) + + return "\t".join([str(x) for x in final_fields]).strip() def printableFa(self): """ Returns a fasta-formatted string representation of the transcript """