PEATDB/Base.py
def addProtseq(self,protein_name,sequence,start_aanumber=1,
                        seq_format='detect',update=True):
        """
         Add the protein sequence - blind faith for now...
         We add this protein sequence as currentres. If the protein has a parent, then it must be set
         elsewhere
        """
        if seq_format=='detect':
            import types
            if type(sequence)==types.ListType:
                if len(sequence[0])==3:
                    pass
                elif len(sequence[0])==1:
                    sequence=self.convert_list1_2_list3(sequence)
            elif type(sequence)==types.StringType:
                status=self.convert_string3_2_list3(sequence)
                if status:
                    sequence=status
                else:
                    sequence=self.convert_string1_2_list3(sequence)
        else:
            actions={'1AA_list':self.convert_list1_2_list3,
                     '3AA_list':None,
                     '1AA_string':self.convert_string1_2_list3,
                     '3AA_string':self.convert_string3_2_list3}
            if actions.has_key(seq_format):
                action=actions[seq_format]
                if action:
                    sequence=action(sequence)
                else:
                    print 'Unknown sequence format'
                    raise Exception()

        # We have the sequence in the right format, so simply insert it

        if self.isknownProtein(protein_name):
                # Create the sequence and add it to the DB
                count=start_aanumber
                seq=[]
                import string
                for aa in sequence:
                    number=':'+string.zfill(count,4)
                    seq.append([number,aa])
                    count=count+1
                self.data[protein_name].aaseq = seq

                # Add the start aa number
                self.data[protein_name].aa_number_start = start_aanumber
                return True
        else:
            return None

         Add the protein sequence - blind faith for now...
         We add this protein sequence as currentres. If the protein has a parent, then it must be set
         elsewhere
        
Add the protein sequence - blind faith for now
We add this protein sequence as currentres. If the protein has a parent, then it must be set
elsewhere
Add the protein sequence - blind faith for now We add this protein sequence as currentres . If the protein has a parent then it must be set elsewhere
def addProtseq(self,protein_name,sequence,start_aanumber=1,
                        seq_format='detect',update=True):
        if seq_format=='detect':
            import types
            if type(sequence)==types.ListType:
                if len(sequence[0])==3:
                    pass
                elif len(sequence[0])==1:
                    sequence=self.convert_list1_2_list3(sequence)
            elif type(sequence)==types.StringType:
                status=self.convert_string3_2_list3(sequence)
                if status:
                    sequence=status
                else:
                    sequence=self.convert_string1_2_list3(sequence)
        else:
            actions={'1AA_list':self.convert_list1_2_list3,
                     '3AA_list':None,
                     '1AA_string':self.convert_string1_2_list3,
                     '3AA_string':self.convert_string3_2_list3}
            if actions.has_key(seq_format):
                action=actions[seq_format]
                if action:
                    sequence=action(sequence)
                else:
                    print 'Unknown sequence format'
                    raise Exception()
        if self.isknownProtein(protein_name):
                count=start_aanumber
                seq=[]
                import string
                for aa in sequence:
                    number=':'+string.zfill(count,4)
                    seq.append([number,aa])
                    count=count+1
                self.data[protein_name].aaseq = seq
                self.data[protein_name].aa_number_start = start_aanumber
                return True
        else:
            return None
def addProtseq ( self , protein_name , sequence , start_aanumber = 1 , seq_format = 'detect' , update = True ) : if seq_format == 'detect' : import types if type ( sequence ) == types . ListType : if len ( sequence [ 0 ] ) == 3 : pass elif len ( sequence [ 0 ] ) == 1 : sequence = self . convert_list1_2_list3 ( sequence ) elif type ( sequence ) == types . StringType : status = self . convert_string3_2_list3 ( sequence ) if status : sequence = status else : sequence = self . convert_string1_2_list3 ( sequence ) else : actions = { '1AA_list' : self . convert_list1_2_list3 , '3AA_list' : None , '1AA_string' : self . convert_string1_2_list3 , '3AA_string' : self . convert_string3_2_list3 } if actions . has_key ( seq_format ) : action = actions [ seq_format ] if action : sequence = action ( sequence ) else : print 'Unknown sequence format' raise Exception ( ) if self . isknownProtein ( protein_name ) : count = start_aanumber seq = [ ] import string for aa in sequence : number = ':' + string . zfill ( count , 4 ) seq . append ( [ number , aa ] ) count = count + 1 self . data [ protein_name ] . aaseq = seq self . data [ protein_name ] . aa_number_start = start_aanumber return True else : return None
Add the protein sequence - blind faith for now...
We add this protein sequence as currentres.
Add the protein sequence - blind faith for now ... We add this protein sequence as currentres .
"""
         Add the protein sequence - blind faith for now...
         We add this protein sequence as currentres. If the protein has a parent, then it must be set
         elsewhere
        """ # We have the sequence in the right format, so simply insert it # Create the sequence and add it to the DB # Add the start aa number
self
protein_name
sequence
start_aanumber
seq_format
update