Пример #1
0
    def add_operon(self, feature_list, strand):
        '''
        Appends a new operon object to the genome fragment.

        Parameters
        ----------
        feature_list: list[GenomeFeature object]
            List of features belonging to the operon
        strand: string
            The strand, + or -, that the operon is located on.
        
        Returns
        -------
        None
        '''
        self.operons.append(
            Operon(genome_fragment_name=self.name,
                   genome_accession=self.genome_accession,
                   genome_features=self.all_features,
                   strand=strand))

        for f in feature_list:
            self.operons[-1].add_feature(f)
def operonFinder(geneBank, readsList):
    """Group genes into operons."""
         
    operon1 = Operon("operon_1")
    gene1 = geneBank[0]
    operon1.add(gene1)
    operonBank = OperonBank()
    operonBank.add(operon1)
 
    j = 0    
    for i in xrange(1, len(geneBank)):
        currentOperon = operonBank[-1]
        currentGene  = geneBank[i]
        previousGene = geneBank[i-1]
        if operonJudge(previousGene, currentGene, readsList) == False:
            currentOperon.add(currentGene)
        else:
            j += 1
            name = "operon_" + str(j + 1)
            operon = Operon(name)
            operon.add(currentGene)
            operonBank.add(operon)

    for operon in operonBank:
        operon.setOrientation()
        operon.setLeftBound(operon[0].getStart())
        operon.setRightBound(operon[-1].getEnd())
        operon.setReads(readsList)
        
    return operonBank
Пример #3
0
"""Group genes into operons based on the gap information """


for i in xrange(len(geneBankFiles)):
    geneBank = GeneBank(geneBankFiles[i])
    operonBankRD = OperonBank()
    with open(readsFiles[i], 'rU') as readsFile:
        reads = csv.reader(readsFile, delimiter='\t')
        readsList = []
        for row in reads:
            readsList.append(float(row[2]))
    
    
    n = 0
    operon = Operon("operon_" + str(n + 1))
    for gene in geneBank:        
        afterGap = gapList[n]
        if geneBank.getIndex(gene.getName()) < afterGap:
            operon.add(gene)
        elif geneBank.getIndex(gene.getName()) == afterGap:
            operon.add(gene)
            print gene.getName()
            n += 1
            operonBankRD.add(operon)
            operon.setLeftBound(operon[0].getStart())
            operon.setRightBound(operon[-1].getEnd())
            operon.setOrientation()
            operon.setReads(readsList)
            print operon.getName()
            print str(operon)