Exemplo n.º 1
0
 def validateSolution(self, solution):
     '''
     Solution validation tests
     '''
     if solution.sequence == None or ('?' in solution.levels.values()):
         sys.stderr.write("SolutionValidator: Level unknown - "+str(solution.levels)+"\n")                        
         solution.valid = False
         return 0
     
     #check if solution is valid
     valid = True
   
     designed_region = solution.sequence
             
     #No internal Promoters
     (score, _, _) = Functions.look_for_promoters(designed_region)
     if score >= 15.3990166: #0.95 percentile for Promoter PWM scores
         valid = False
         sys.stderr.write("SolutionValidator: High Promoter score: "+str(score)+"\n")                    
     
     #No internal Terminator
     score = Functions.look_for_terminators(designed_region)
     if score >= 90: #90% confidence from transtermHP
         valid = False
         sys.stderr.write("SolutionValidator: High Terminator score\n")    
         
     #No restriction enzymes
     #if 'ggtctc' in designed_region or 'gagacc' in designed_region:
     #    sys.stderr.write("SolutionValidator: Restriction enzyme found\n")
     #    valid = False        
     
     solution.valid = valid
     
     return valid
Exemplo n.º 2
0
    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)