Example #1
0
 def applicable(cls, target=None, coord=None):
     if not coord or coord.sequence is None:
         return
     if target.msaview_classname != 'data.msa':
         return
     if target.sequence_information.get_entry('uniprot-id', coord.sequence):
         return cls(target, coord)
     if UniprotID.extract_id(target.ids[coord.sequence]):
         return cls(target, coord)
Example #2
0
 def applicable(cls, target=None, coord=None):
     if target.msaview_classname != 'data.msa':
         return
     if not target:
         return
     if target.sequence_information.has_category('uniprot-id'):
         return cls(target, coord)
     for id in target.ids:
         if UniprotID.extract_id(id):
             return cls(target, coord)
Example #3
0
 def run(self):
     sequence_index = self.coord.sequence
     id = self.target.sequence_information.setdefault('uniprot-id')[sequence_index]
     if not id:
         id = UniprotID.from_msa_sequence(self.target, sequence_index)
         self.target.sequence_information.add_entries(id)
     url = 'http://pfam.sanger.ac.uk/protein?output=xml&entry='
     xml = urllib2.urlopen(url + id.sequence_id)
     root = etree.parse(xml, NamespaceIgnorantXMLTreeBuilder()).getroot()
     features = parse_pfam_protein_etree(root, self.target, sequence_index, id.sequence_id)
     if features is None:
         raise ValueError('the Pfam sequence does not match/contain the MSA sequence')
     self.target.features.add_features(features)
Example #4
0
 def applicable(cls, target, coord=None):
     if not coord or coord.sequence is None:
         return
     if target.msaview_classname != 'data.msa':
         return
     entry = target.sequence_information.get_entry('uniprot-id', coord.sequence)
     if not entry:
         entry = UniprotID.from_msa_sequence(target, coord.sequence)
     if not entry.sequence_id:
         return
     a = cls(target, coord)
     a.path = list(cls.path)
     a.path[-1] %= entry.sequence_id
     return a
Example #5
0
 def run(self):
     sequence_index = self.coord.sequence
     etree_category = self.target.sequence_information.setdefault('uniprot-etree')
     etree_entry = etree_category[sequence_index]
     if not etree_entry:
         id_category = self.target.sequence_information.setdefault('uniprot-id')
         id_entry = id_category[sequence_index]
         if not id_entry:
             id_entry = UniprotID.from_msa_sequence(self.target, self.coord.sequence)
             self.target.sequence_information.add_entries(id_entry)
         etree_entry = dbfetch_uniprot_xml_for_sequence(self.target, sequence_index)
         self.target.sequence_information.add_entries(etree_entry)
     structures_entry = PDBStructures.from_uniprot_etree(etree_entry)
     self.target.sequence_information.setdefault('pdb-ids')
     self.target.sequence_information.add_entries(structures_entry)
Example #6
0
 def applicable(cls, target, coord=None):
     if not coord or coord.sequence is None:
         return
     if target.msaview_classname != 'data.msa':
         return
     etree_entry = target.sequence_information.get_entry('uniprot-etree', coord.sequence)
     if etree_entry:
         if etree_entry.root is None:
             return
         return cls(target, coord)
     id_entry = target.sequence_information.get_entry('uniprot-id', coord.sequence)
     if not id_entry:
         id_entry = UniprotID.from_msa_sequence(target, coord.sequence)
     if not id_entry.sequence_id:
         return
     return cls(target, coord)