コード例 #1
0
ファイル: genePred.py プロジェクト: diekhans/pycbio
 def __initParse(self, row):
     self.name = row[0]
     self.chrom = row[1]
     self.strand = row[2]
     self.strandRel = False    # are these strand-relative coordinates
     self.txStart = int(row[3])
     self.txEnd = int(row[4])
     self.cdsStart = int(row[5])
     self.cdsEnd = int(row[6])
     exonStarts = intArraySplit(row[8])
     exonEnds = intArraySplit(row[9])
     iCol = 10
     numCols = len(row)
     self.score = None
     if iCol < numCols:  # 10
         self.score = int(row[iCol])
         iCol = iCol+1
     self.name2 = None
     if iCol < numCols:  # 11
         self.name2 = row[iCol]
         iCol = iCol+1
     self.cdsStartStat = None
     self.cdsEndStat = None
     if iCol < numCols:  # 12,13
         self.cdsStartStat = CdsStat(row[iCol])
         self.cdsEndStat = CdsStat(row[iCol+1])
         iCol = iCol+2
     exonFrames = None
     self.hasExonFrames = False
     if iCol < numCols:  # 14
         exonFrames = intArraySplit(row[iCol])
         iCol = iCol+1
         self.hasExonFrames = True
     self.__buildExons(exonStarts, exonEnds, exonFrames)
コード例 #2
0
 def _initParse(self, row):
     self.name = row[0]
     self.chrom = row[1]
     self.strand = row[2]
     self.strandRel = False    # are these strand-relative coordinates
     self.txStart = int(row[3])
     self.txEnd = int(row[4])
     self.cdsStart = int(row[5])
     self.cdsEnd = int(row[6])
     exonStarts = intArraySplit(row[8])
     exonEnds = intArraySplit(row[9])
     iCol = 10
     numCols = len(row)
     self.score = None
     if iCol < numCols:  # 10
         self.score = int(row[iCol])
         iCol = iCol + 1
     self.name2 = None
     if iCol < numCols:  # 11
         self.name2 = row[iCol]
         iCol = iCol + 1
     self.cdsStartStat = None
     self.cdsEndStat = None
     if iCol < numCols:  # 12,13
         self.cdsStartStat = CdsStat(row[iCol])
         self.cdsEndStat = CdsStat(row[iCol + 1])
         iCol = iCol + 2
     exonFrames = None
     self.hasExonFrames = False
     if iCol < numCols:  # 14
         exonFrames = intArraySplit(row[iCol])
         iCol = iCol + 1
         self.hasExonFrames = True
     self._buildExons(exonStarts, exonEnds, exonFrames)
コード例 #3
0
ファイル: bed.py プロジェクト: diekhans/pycbio
 def __init__(self, row):
     self.numCols = len(row)
     self.chrom = row[0]
     self.chromStart = int(row[1])
     self.chromEnd = int(row[2])
     self.name = row[3]
     if self.numCols > 4:
         self.score = int(row[4])
     else:
         self.score = None
     if self.numCols > 5:
         self.strand = row[5]
     else:
         self.strand = None
     if self.numCols > 7:
         self.thickStart = int(row[6])
         self.thickEnd = int(row[7])
     else:
         self.thickStart = None
         self.thickEnd = None
         
     if self.numCols > 8:
         self.itemRgb = row[8]
     else:
         self.itemRgb = None
     if self.numCols > 11:
         sizes = intArraySplit(row[10])
         relStarts = intArraySplit(row[11])
         self.blocks = []
         for i in xrange(len(relStarts)):
             self.blocks.append(Bed.Block(relStarts[i], sizes[i], self.chromStart+relStarts[i]))
     else:
         self.blocks = None
コード例 #4
0
 def _parseBlockColumns(chromStart, row):
     sizes = intArraySplit(row[10])
     relStarts = intArraySplit(row[11])
     blocks = []
     for i in range(len(relStarts)):
         start = chromStart + relStarts[i]
         blocks.append(Bed.Block(start, start + sizes[i]))
     return blocks
コード例 #5
0
ファイル: psl.py プロジェクト: diekhans/pycbio
 def __parseBlocks(self, blockSizesStr, qStartsStr, tStartsStr, qSeqsStr, tSeqsStr):
     "convert parallel arrays to PslBlock objects"
     self.blocks = []
     blockSizes = intArraySplit(blockSizesStr)
     qStarts = intArraySplit(qStartsStr)
     tStarts = intArraySplit(tStartsStr)
     haveSeqs = (qSeqsStr is not None)
     if haveSeqs:
         qSeqs = strArraySplit(qSeqsStr)
         tSeqs = strArraySplit(tSeqsStr)
     for i in xrange(self.blockCount):
         self.blocks.append(PslBlock(self, qStarts[i], tStarts[i], blockSizes[i],
                                     (qSeqs[i] if haveSeqs else None),
                                     (tSeqs[i] if haveSeqs else None)))
コード例 #6
0
ファイル: psl.py プロジェクト: diekhans/read-through-analysis
 def _parseBlocks(cls, psl, blockCount, blockSizesStr, qStartsStr,
                  tStartsStr, qSeqsStr, tSeqsStr):
     "convert parallel arrays to PslBlock objects"
     blockSizes = intArraySplit(blockSizesStr)
     qStarts = intArraySplit(qStartsStr)
     tStarts = intArraySplit(tStartsStr)
     haveSeqs = (qSeqsStr is not None)
     if haveSeqs:
         qSeqs = strArraySplit(qSeqsStr)
         tSeqs = strArraySplit(tSeqsStr)
     for i in range(blockCount):
         psl.addBlock(
             PslBlock(qStarts[i], tStarts[i], blockSizes[i],
                      (qSeqs[i] if haveSeqs else None),
                      (tSeqs[i] if haveSeqs else None)))
コード例 #7
0
 def _initDb(self, row, dbColIdxMap):
     self.name = row[dbColIdxMap["name"]]
     self.chrom = row[dbColIdxMap["chrom"]]
     self.strand = row[dbColIdxMap["strand"]]
     self.strandRel = False    # are these strand-relative coordinates
     self.txStart = int(row[dbColIdxMap["txStart"]])
     self.txEnd = int(row[dbColIdxMap["txEnd"]])
     self.cdsStart = int(row[dbColIdxMap["cdsStart"]])
     self.cdsEnd = int(row[dbColIdxMap["cdsEnd"]])
     exonStarts = intArraySplit(row[dbColIdxMap["exonStarts"]])
     exonEnds = intArraySplit(row[dbColIdxMap["exonEnds"]])
     self.score = self._colOrNone(row, dbColIdxMap, "score", int)
     self.name2 = self._colOrNone(row, dbColIdxMap, "name2", str)
     self.cdsStartStat = self._colOrNone(row, dbColIdxMap, "cdsStartStat", CdsStat)
     self.cdsEndStat = self._colOrNone(row, dbColIdxMap, "cdsEndStat", CdsStat)
     exonFrames = self._colOrNone(row, dbColIdxMap, "exonFrames", intArraySplit)
     self.hasExonFrames = (exonFrames is not None)
     self._buildExons(exonStarts, exonEnds, exonFrames)
コード例 #8
0
ファイル: genePred.py プロジェクト: diekhans/pycbio
 def __initDb(self, row, dbColIdxMap):
     self.name = row[dbColIdxMap["name"]]
     self.chrom = row[dbColIdxMap["chrom"]]
     self.strand = row[dbColIdxMap["strand"]]
     self.strandRel = False    # are these strand-relative coordinates
     self.txStart = int(row[dbColIdxMap["txStart"]])
     self.txEnd = int(row[dbColIdxMap["txEnd"]])
     self.cdsStart = int(row[dbColIdxMap["cdsStart"]])
     self.cdsEnd = int(row[dbColIdxMap["cdsEnd"]])
     exonStarts = intArraySplit(row[dbColIdxMap["exonStarts"]])
     exonEnds = intArraySplit(row[dbColIdxMap["exonEnds"]])
     self.score = self.__colOrNone(row, dbColIdxMap, "score", int)
     self.name2 = self.__colOrNone(row, dbColIdxMap, "name2", str)
     self.cdsStartStat = self.__colOrNone(row, dbColIdxMap, "cdsStartStat", CdsStat)
     self.cdsEndStat = self.__colOrNone(row, dbColIdxMap, "cdsEndStat", CdsStat)
     exonFrames = self.__colOrNone(row, dbColIdxMap, "exonFrames", intArraySplit)
     self.hasExonFrames = (exonFrames is not None)
     self.__buildExons(exonStarts, exonEnds, exonFrames)