def randomMutation( self, pos=None, n_mut=[1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 5, 6, 20, 30, 50, 100, 200], mutable_region=None): if mutable_region == None: if self.mutable_region == None: mutable_region = self.solution.mutable_region else: mutable_region = self.mutable_region logger.debug('Mutable region: {}'.format(mutable_region)) new_seq = Functions.randomMutationOperator( self.solution.sequence, self.solution.keep_aa, mutable_region, self.solution.cds_region, cai_table=self.solution.cai_table, pos=pos, n_mut=n_mut) return Solution.Solution(sol_id=str(uuid4().int), sequence=new_seq, project_dir=self.solution.project_dir, cds_region=self.solution.cds_region, keep_aa=self.solution.keep_aa, mutable_region=self.solution.mutable_region, parent=self.solution, design=self.solution.designMethod)
def set_scores(self, scoring_function=Functions.analyze_duplex_mfe_rnafold): self.scores.update( Functions.appendLabelToDict( scoring_function(filename=self.duplexFile, project_dir=self.solution.project_dir), self.label))
def set_scores(self, scoring_function=Functions.analyze_duplex_structure_rnafold ): self.scores.update( Functions.appendLabelToDict( scoring_function(seq1=self.rnaMolecule1seq, seq2=self.rnaMolecule2seq, filename=self.duplexFile, project_dir=self.solution.project_dir), self.label))
def set_scores(self, scoring_function=Functions.analyze_duplex_structure): self.scores.update( Functions.appendLabelToDict( scoring_function(self.rnaMolecule1seq, self.rnaMolecule2seq, self.duplexFile), self.label)) pass
def set_scores(self, scoring_function=Functions.analyze_duplex_mfe): self.scores.update( Functions.appendLabelToDict(scoring_function(self.duplexFile), self.label))
def set_scores(self, scoring_function=Functions.analyze_pwm_score): self.scores = Functions.appendLabelToDict( scoring_function(self.sequence, self.pwm), self.label)
def set_scores(self, scoring_function=Functions.analyze_structure_prob): #compute structure self.scores.update( Functions.appendLabelToDict( scoring_function(self.sequence, self.structurefile, self.window, self.acc_region), self.label))
def set_scores(self, scoring_function=Functions.analyze_structure_ds): self.scores.update( Functions.appendLabelToDict(scoring_function(self.structurefile), self.label))
def set_scores(self, scoring_function=Functions.analyze_structure_mfe): self.scores.update( Functions.appendLabelToDict( scoring_function(filename=self.structurefile, project_dir=self.solution.project_dir), self.label))
def set_scores(self, scoring_function=Functions.analyze_ntcontent): self.scores = Functions.appendLabelToDict( scoring_function(self.sequence), self.label)
def validateSolution(self, solution): ''' Solution validation tests ''' return True if solution.sequence == None: return 0 valid = True e_type=None variable_region = solution.sequence[solution.mutable_region[0]:(solution.mutable_region[-1]+1)] #No Promoters promoter_putative_region = solution.sequence[(solution.mutable_region[0]-30):(solution.mutable_region[-1]+31)] (score, position, spacer) = Functions.look_for_promoters(promoter_putative_region) if score >= 0.3990166: #0.95 percentile for Promoter PWM scores valid = False position = (solution.mutable_region[0]-30) + position e_type = "prom" sys.stderr.write("SolutionValidator: High Promoter score\n") #No RBS rbs_putative_region = solution.sequence[(solution.mutable_region[0]-12):(solution.mutable_region[-1]+11)] (score, position) = Functions.look_for_RBS(rbs_putative_region) if score >= 0.820515: #0.95 percentile for RBS PWM scores valid = False position = (solution.mutable_region[0]-12) + position e_type = "rbs" sys.stderr.write("SolutionValidator: High RBS score: "+str(score)+" - "+str(position)+"\n") #No Terminator term_putative_region = solution.sequence[(solution.mutable_region[0]-30):(solution.mutable_region[-1]+31)] score = Functions.look_for_terminators(term_putative_region) if score >= 90: #90% confidence from transtermHP e_type = "term" valid = False sys.stderr.write("SolutionValidator: High Terminator score\n") #No stop codon for i in range(0,len(variable_region),3): if codon2aa_table[variable_region[i:i+3]]=='stop': sys.stderr.write("SolutionValidator: Stop codon found\n") e_type = "stopcodon" valid = False position = solution.mutable_region[0]+i break #No restriction enzymes rsite_putative_region = solution.sequence[(solution.mutable_region[0]-6):(solution.mutable_region[-1])] if 'ggtacc' in rsite_putative_region: e_type = "rsite" sys.stderr.write("SolutionValidator: Restriction enzyme found\n") position = (solution.mutable_region[0]-6)+rsite_putative_region.index('ggtacc') valid = False if 'ggatcc' in rsite_putative_region: e_type = "rsite" sys.stderr.write("SolutionValidator: Restriction enzyme found\n") position = (solution.mutable_region[0]-6)+rsite_putative_region.index('ggatcc') valid = False #No bases run of more than 5nt repeat_putative_region = solution.sequence[(solution.mutable_region[0]-6):(solution.mutable_region[-1]+7)] for b_run in ('aaaaaa','tttttt','gggggg','cccccc'): if b_run in repeat_putative_region: sys.stderr.write("SolutionValidator: Bases run for more than 5 found\n") valid = False position = (solution.mutable_region[0]-6) + repeat_putative_region.index(b_run) e_type = "repeats" solution.valid = valid if valid == True: return (valid,None,None) else: return (valid,position,e_type)