Esempio n. 1
0
 def __str__(self):
     "return psl as a tab-separated string"
     row = [str(self.match),
            str(self.misMatch),
            str(self.repMatch),
            str(self.nCount),
            str(self.qNumInsert),
            str(self.qBaseInsert),
            str(self.tNumInsert),
            str(self.tBaseInsert),
            self.strand,
            self.qName,
            str(self.qSize),
            str(self.qStart),
            str(self.qEnd),
            self.tName,
            str(self.tSize),
            str(self.tStart),
            str(self.tEnd),
            str(self.blockCount),
            intArrayJoin([b.size for b in self.blocks]),
            intArrayJoin([b.qStart for b in self.blocks]),
            intArrayJoin([b.tStart for b in self.blocks])]
     if self.blocks[0].qSeq != None:
         row.append(strArrayJoin([b.qSeq for b in self.blocks]))
         row.append(strArrayJoin([b.tSeq for b in self.blocks]))
     return str.join("\t", row)
Esempio n. 2
0
 def __str__(self):
     "return psl as a tab-separated string"
     row = [str(self.match),
            str(self.misMatch),
            str(self.repMatch),
            str(self.nCount),
            str(self.qNumInsert),
            str(self.qBaseInsert),
            str(self.tNumInsert),
            str(self.tBaseInsert),
            self.strand,
            self.qName,
            str(self.qSize),
            str(self.qStart),
            str(self.qEnd),
            self.tName,
            str(self.tSize),
            str(self.tStart),
            str(self.tEnd),
            str(self.blockCount),
            intArrayJoin([b.size for b in self.blocks]),
            intArrayJoin([b.qStart for b in self.blocks]),
            intArrayJoin([b.tStart for b in self.blocks])]
     if self.blocks[0].qSeq != None:
         row.append(strArrayJoin([b.qSeq for b in self.blocks]))
         row.append(strArrayJoin([b.tSeq for b in self.blocks]))
     return str.join("\t", row)
Esempio n. 3
0
    def getRow(self):
        row = [
            self.name, self.chrom, self.strand,
            str(self.txStart),
            str(self.txEnd),
            str(self.cdsStart),
            str(self.cdsEnd)
        ]
        row.append(str(len(self.exons)))
        starts = []
        ends = []
        for e in self.exons:
            starts.append(e.start)
            ends.append(e.end)
        row.append(intArrayJoin(starts))
        row.append(intArrayJoin(ends))

        hasExt = (self.score != None) or (self.name2 != None) or (
            self.cdsStartStat != None) or self.hasExonFrames

        if self.score != None:
            row.append(str(self.score))
        elif hasExt:
            row.append("0")
        if self.name2 != None:
            row.append(self.name2)
        elif hasExt:
            row.append("")
        if self.cdsStartStat != None:
            row.append(str(self.cdsStartStat))
            row.append(str(self.cdsEndStat))
        elif hasExt:
            row.append(str(CdsStat.unknown))
            row.append(str(CdsStat.unknown))
        if self.hasExonFrames or hasExt:
            frames = []
            if self.hasExonFrames:
                for e in self.exons:
                    frames.append(e.frame)
            else:
                for e in self.exons:
                    frames.append(-1)
            row.append(intArrayJoin(frames))
        return row
Esempio n. 4
0
 def getRow(self):
     row = [self.chrom, str(self.chromStart), str(self.chromEnd), self.name]
     if self.numCols > 4:
         row.append(str(self.score));
     if self.numCols > 5:
         row.append(self.strand)
     if self.numCols > 7:
         row.append(str(self.thickStart))
         row.append(str(self.thickEnd))
     if self.numCols > 8:
         row.append(str(self.itemRgb))
     if self.numCols > 11:
         row.append(str(len(self.blocks)))
         relStarts = []
         sizes = []
         for blk in self.blocks:
             relStarts.append(str(blk.relStart))
             sizes.append(str(blk.size))
         row.append(intArrayJoin(self.relStart))
         row.append(intArrayJoin(self.sizes))
     return row
Esempio n. 5
0
 def getRow(self):
     row = [self.chrom, str(self.chromStart), str(self.chromEnd), self.name]
     if self.numCols > 4:
         row.append(str(self.score))
     if self.numCols > 5:
         row.append(self.strand)
     if self.numCols > 7:
         row.append(str(self.thickStart))
         row.append(str(self.thickEnd))
     if self.numCols > 8:
         row.append(str(self.itemRgb))
     if self.numCols > 11:
         row.append(str(len(self.blocks)))
         relStarts = []
         sizes = []
         for blk in self.blocks:
             relStarts.append(str(blk.relStart))
             sizes.append(str(blk.size))
         row.append(intArrayJoin(self.relStart))
         row.append(intArrayJoin(self.sizes))
     return row
Esempio n. 6
0
    def getRow(self):
        row = [self.name, self.chrom, self.strand, str(self.txStart), str(self.txEnd), str(self.cdsStart), str(self.cdsEnd)]
        row.append(str(len(self.exons)))
        starts = []
        ends = []
        for e in self.exons:
            starts.append(e.start)
            ends.append(e.end)
        row.append(intArrayJoin(starts))
        row.append(intArrayJoin(ends))

        hasExt = (self.score != None) or (self.name2 != None) or (self.cdsStartStat != None) or self.hasExonFrames

        if self.score != None:
            row.append(str(self.score))
        elif hasExt:
            row.append("0");
        if self.name2 != None:
            row.append(self.name2)
        elif hasExt:
            row.append("");
        if self.cdsStartStat != None:
            row.append(str(self.cdsStartStat))
            row.append(str(self.cdsEndStat))
        elif hasExt:
            row.append(str(CdsStat.unknown))
            row.append(str(CdsStat.unknown))
        if self.hasExonFrames or  hasExt:
            frames = []
            if self.hasExonFrames:
                for e in self.exons:
                    frames.append(e.frame)
            else:
                for e in self.exons:
                    frames.append(-1)
            row.append(intArrayJoin(frames))
        return row