コード例 #1
0
ファイル: BedGeneReader.py プロジェクト: bmajoros/python
 def addUTR(self,filename,genes):
     hash=self.hashGenes(genes)
     reader=BedReader(filename)
     while(True):
         record=reader.nextRecord()
         if(not record): break
         if(not record.isBed6()):
             raise Exception("BED file has too few fields")
         id=record.name
         gene=hash.get(id,None)
         if(not gene): 
             gene=BedGene(id,record.chr,record.strand)
             genes.append(gene)
             hash[id]=gene
         gene.addUTR(record.interval)
     for gene in genes:
         gene.coalesce()
コード例 #2
0
ファイル: BedGeneReader.py プロジェクト: bmajoros/python
 def readCDS(self, filename):
     reader = BedReader(filename)
     genes = []
     genesByName = {}
     while (True):
         record = reader.nextRecord()
         if (not record): break
         if (not record.isBed6()):
             raise Exception("BED file has too few fields")
         id = record.name
         gene = genesByName.get(id, None)
         if (not gene):
             gene = BedGene(id, record.chr, record.strand)
             genesByName[id] = gene
             genes.append(gene)
         gene.addCDS(record.interval)
     reader.close()
     return genes
コード例 #3
0
ファイル: BedGeneReader.py プロジェクト: bmajoros/python
 def readCDS(self,filename):
     reader=BedReader(filename)
     genes=[]
     genesByName={}
     while(True):
         record=reader.nextRecord()
         if(not record): break
         if(not record.isBed6()):
             raise Exception("BED file has too few fields")
         id=record.name
         gene=genesByName.get(id,None)
         if(not gene):
             gene=BedGene(id,record.chr,record.strand)
             genesByName[id]=gene
             genes.append(gene)
         gene.addCDS(record.interval)
     reader.close()
     return genes
コード例 #4
0
ファイル: BedGeneReader.py プロジェクト: bmajoros/python
 def addUTR(self, filename, genes):
     hash = self.hashGenes(genes)
     reader = BedReader(filename)
     while (True):
         record = reader.nextRecord()
         if (not record): break
         if (not record.isBed6()):
             raise Exception("BED file has too few fields")
         id = record.name
         gene = hash.get(id, None)
         if (not gene):
             gene = BedGene(id, record.chr, record.strand)
             genes.append(gene)
             hash[id] = gene
         gene.addUTR(record.interval)
     for gene in genes:
         gene.coalesce()