Exemplo n.º 1
0
 def __init__(
     self,
     hiObject=None,
     solution=None,
     label="",
     args={
         'hi_range': (0, 59),
         'mutable_region': None,
         'cds_region': None,
         'keep_aa': True
     }):
     if hiObject == None:  #create new instance
         #General properties of feature
         Feature.__init__(self, solution=solution, label=label)
         #Specifics of this Feature
         self.hi_range = args['hi_range']
         self.sequence = solution.sequence[self.hi_range[0]:(
             self.hi_range[1] + 1)]
         self.mutable_region = args[
             'mutable_region'] if 'mutable_region' in args else solution.mutable_region
         self.cds_region = args[
             'cds_region'] if 'cds_region' in args else solution.cds_region
         self.keep_aa = args[
             'keep_aa'] if 'keep_aa' in args else solution.keep_aa
         self.set_scores()
         self.set_level()
     else:  #copy instance
         Feature.__init__(self, hiObject)
         self.hi_range = hiObject.hi_range
         self.sequence = hiObject.sequence
         self.mutable_region = hiObject.mutable_region
         self.cds_region = hiObject.cds_region
         self.keep_aa = hiObject.keep_aa
         self.codons_hi = hiObject.codons_hi
         self.scores = hiObject.scores
Exemplo n.º 2
0
 def __init__(self,
              bottleneckObject=None,
              solution=None,
              label="",
              args={
                  'bottleneck_range': (0, 59),
                  'mutable_region': None,
                  'keep_aa': True
              }):
     if bottleneckObject == None:  #create new instance
         #General properties of feature
         Feature.__init__(self, solution=solution, label=label)
         #Specifics of this Feature
         self.bottleneck_range = args['bottleneck_range']
         self.sequence = solution.sequence[self.bottleneck_range[0]:self.
                                           bottleneck_range[1] + 1]
         self.mutable_region = args[
             'mutable_region'] if 'mutable_region' in args else solution.mutable_region
         self.cds_region = args[
             'cds_region'] if 'cds_region' in args else solution.cds_region
         self.keep_aa = args[
             'keep_aa'] if 'keep_aa' in args else solution.keep_aa
         self.set_scores()
         self.set_level()
         self.calculate_mutable_segments()
     else:  #copy instance
         Feature.__init__(self, bottleneckObject)
         self.bottleneck_range = bottleneckObject.bottleneck_range
         self.sequence = bottleneckObject.sequence
         self.mutable_region = bottleneckObject.mutable_region
         self.keep_aa = bottleneckObject.keep_aa
         self.segmentMutation = bottleneckObject.segmentMutation
         self.bot_scores = bottleneckObject.bot_scores
         self.bot_smooth = bottleneckObject.bot_smooth
         self.scores = bottleneckObject.scores
Exemplo n.º 3
0
 def __init__(self, structureObject = None, solution = None, label="", args = { 'structure_range' : (0,59),
                                                                                'mutable_region' : None, 
                                                                                'cds_region' : None, 
                                                                                'keep_aa' : True }):
     
     if structureObject == None: #create new instance
         #General properties of feature
         Feature.__init__(self, solution=solution, label=label)
         #Specifics of this Feature
         self.structurefile      = solution.solid + label
         self.structure_range    = args['structure_range']
         logger.debug('RNA range set to: {}:{}'.format(self.structure_range[0], self.structure_range[1]))
         self.sequence           = solution.sequence[self.structure_range[0]:self.structure_range[1]]
         self.mutable_region     = args['mutable_region']   if 'mutable_region' in args else solution.mutable_region
         self.cds_region         = args['cds_region']       if 'cds_region' in args else solution.cds_region
         self.keep_aa            = args['keep_aa']          if 'keep_aa' in args else solution.keep_aa
         self.set_scores()
         self.set_level()                    
     else: #copy instance
         Feature.__init__(self, featureObject=structureObject)
         self.structurefile      = structureObject.structurefile
         self.structure_range    = structureObject.structure_range         
         self.sequence           = structureObject.sequence
         self.mutable_region     = structureObject.mutable_region
         self.cds_region         = structureObject.cds_region
         self.keep_aa            = structureObject.keep_aa
         self.scores             = structureObject.scores
Exemplo n.º 4
0
    def __init__(
        self,
        structureObject=None,
        solution=None,
        label="",
        args={
            'structure_range': (0, 59),
            'acc_region': [],
            'window': 50,
            'mutable_region': None,
            'cds_region': None,
            'keep_aa': True
        }):

        #General properties of feature
        Feature.__init__(self, solution=solution, label=label)
        #Specifics of this Feature
        self.structurefile = solution.solid + label
        self.structure_range = args['structure_range']
        self.acc_region = args['acc_region'] if 'acc_region' in args else []
        self.window = args['window'] if 'window' in args else 50
        self.sequence = solution.sequence[self.structure_range[0]:self.
                                          structure_range[1]]
        self.mutable_region = args[
            'mutable_region'] if 'mutable_region' in args else solution.mutable_region
        self.cds_region = args[
            'cds_region'] if 'cds_region' in args else solution.cds_region
        self.keep_aa = args[
            'keep_aa'] if 'keep_aa' in args else solution.keep_aa
        self.set_scores()
        self.set_level()
Exemplo n.º 5
0
    def __init__(self, window_size=50,
                 featureObject=None,
                 solution=None,
                 label="",
                 args={'feature_range' : (0, 59),
                       'mutable_region': None,
                       'cds_region'    : None,
                       'keep_aa'       : True}):
        if featureObject == None:  # create new instance
            # General properties of feature
            Feature.__init__(self, solution=solution, label=label)
            # Specifics of this Feature
            self.window_size = window_size
            self.feature_range = args['feature_range']
            self.sequence = solution.sequence[self.feature_range[0]:self.feature_range[1]]
            self.mutable_region = args['mutable_region'] if 'mutable_region' in args else solution.mutable_region
            self.cds_region = args['cds_region'] if 'cds_region' in args else solution.cds_region
            self.keep_aa = args['keep_aa'] if 'keep_aa' in args else solution.keep_aa
            self.set_scores()
            self.set_level()
        else:  # copy instance
            Feature.__init__(self, featureObject)
            self.feature_range = featureObject.feature_range
            self.sequence = featureObject.sequence
            self.mutable_region = featureObject.mutable_region
            self.cds_region = featureObject.cds_region
            self.keep_aa = featureObject.keep_aa
            self.scores = featureObject.scores

        self.window_start_index = 0
Exemplo n.º 6
0
 def __init__(
     self,
     nucleotideContentObject=None,
     solution=None,
     label="",
     args={
         'ntcontent_range': (0, 9),
         'mutable_region': None,
         'cds_region': None,
         'keep_aa': True
     }):
     if nucleotideContentObject == None:  #create new instance
         #General properties of feature
         Feature.__init__(self, solution=solution, label=label)
         #Specifics of this Feature
         self.ntcontent_range = args['ntcontent_range']
         self.sequence = solution.sequence[self.ntcontent_range[0]:self.
                                           ntcontent_range[1] + 1]
         self.mutable_region = args[
             'mutable_region'] if 'mutable_region' in args else solution.mutable_region
         self.cds_region = args[
             'cds_region'] if 'cds_region' in args else solution.cds_region
         self.keep_aa = args[
             'keep_aa'] if 'keep_aa' in args else solution.keep_aa
         self.set_scores()
         self.set_level()
     else:
         Feature.__init__(self, nucleotideContentObject)
         self.ntcontent_range = nucleotideContentObject.ntcontent_range
         self.sequence = nucleotideContentObject.sequence
         self.mutable_region = nucleotideContentObject.mutable_region
         self.cds_region = nucleotideContentObject.cds_region
         self.keep_aa = nucleotideContentObject.keep_aa
         self.scores = nucleotideContentObject.scores
Exemplo n.º 7
0
 def __init__(self,
              duplexObject=None,
              solution1=None,
              solution2=None,
              label="",
              args={
                  'rnaMolecule1region': None,
                  'rnaMolecule2region': None
              }):
     if duplexObject == None:
         #General properties of feature
         Feature.__init__(self, solution=solution1, label=label)
         #Specifics of this Feature
         self.solution = solution1
         self.solution2 = solution2
         self.duplexFile = str(solution1.solid) + '-' + str(
             solution2.solid) + label
         self.rnaMolecule1region = args['rnaMolecule1region']
         self.rnaMolecule1seq = self.solution.sequence[
             self.rnaMolecule1region[0]:(self.rnaMolecule1region[1] + 1)]
         self.mutable_region = args[
             'mutable_region1'] if 'mutable_region1' in args else None
         self.cds_regions = args[
             'cds_regions1'] if 'cds_regions1' in args else None
         self.keep_aa = args['keep_aa1'] if 'keep_aa1' in args else False
         self.rnaMolecule2region = args['rnaMolecule2region']
         self.rnaMolecule2seq = self.solution2.sequence[
             self.rnaMolecule2region[0]:(self.rnaMolecule2region[1] + 1)]
         self.mutable_region2 = args[
             'mutable_region2'] if 'mutable_region2' in args else None
         self.cds_regions2 = args[
             'cds_regions2'] if 'cds_regions2' in args else None
         self.keep_aa2 = args['keep_aa2'] if 'keep_aa2' in args else False
         self.set_scores()
         self.set_level()
     else:
         #General properties of feature
         Feature.__init__(self, duplexObject)
         #Specifics of this Feature
         self.solution = duplexObject.solution
         self.solution2 = duplexObject.solution2
         self.duplexFile = duplexObject.duplexFile
         self.rnaMolecule1region = duplexObject.rnaMolecule1region
         self.rnaMolecule1seq = duplexObject.rnaMolecule1seq
         self.mutable_region = duplexObject.mutable_region
         self.cds_regions = duplexObject.cds_regions
         self.keep_aa = duplexObject.keep_aa
         self.rnaMolecule2region = duplexObject.rnaMolecule2region
         self.rnaMolecule2seq = duplexObject.rnaMolecule2seq
         self.mutable_region2 = duplexObject.mutable_region2
         self.cds_regions2 = duplexObject.cds_regions2
         self.keep_aa2 = duplexObject.keep_aa2
         self.scores = duplexObject.scores
Exemplo n.º 8
0
    def __init__(
        self,
        motifObject=None,
        solution=None,
        label="",
        args={
            'pwm': None,
            'motif_range': (0, 9),
            'mutable_region': None,
            'cds_region': None,
            'keep_aa': True
        }):

        if motifObject == None:  #create new instance
            #General properties of feature
            Feature.__init__(self, solution=solution, label=label)
            #Specifics of this Feature
            self.pwm = args['pwm']
            self.motif_range = args['motif_range']
            self.sequence = solution.sequence[self.motif_range[0]:self.
                                              motif_range[1] + 1]
            self.mutable_region = [
                i - self.motif_range[0] for i in
                set(range(self.motif_range[0], self.motif_range[1] + 1))
                & set(args['mutable_region'])
            ] if 'mutable_region' in args else solution.mutable_region
            self.cds_region = args[
                'cds_region'] if 'cds_region' in args else solution.cds_region
            self.keep_aa = args[
                'keep_aa'] if 'keep_aa' in args else solution.keep_aa
            self.set_scores()
            self.set_level()
        else:  #copy instance
            Feature.__init__(self,
                             solution=motifObject.solution,
                             label=motifObject.label)
            self.pwm = motifObject.pwm
            self.motif_range = motifObject.motif_range
            self.sequence = motifObject.sequence
            self.mutable_region = motifObject.mutable_region
            self.cds_region = motifObject.cds_region
            self.keep_aa = motifObject.keep_aa
            self.scores = motifObject.scores
Exemplo n.º 9
0
 def mutate(self):
     return Feature.randomMutation(self, mutable_region=self.mutable_region)