示例#1
0
 def test_pfam_domain(self):
     original = PFAMDomain(FeatureLocation(2, 5),
                           description="test",
                           protein_start=5,
                           protein_end=10,
                           identifier="PF00002.17",
                           domain="p450",
                           tool="toolname")
     original.domain_id = "domain_id"
     original.database = "db"
     original.detection = "someprogram"
     original.evalue = 1e-5
     original.score = 5.
     original.locus_tag = "locus"
     original.label = "somelabel"
     original.translation = "ARNDCQ"
     original.gene_ontologies = GOQualifier({
         'GO:0004871': 'signal transducer activity',
         'GO:0007165': 'signal transduction',
         'GO:0016020': 'membrane'
     })
     new = PFAMDomain.from_biopython(original.to_biopython()[0])
     for slot in [
             "tool", "domain_id", "database", "detection", "evalue",
             "score", "locus_tag", "label", "translation", "domain",
             "protein_start", "protein_end", "identifier", "version"
     ]:
         assert getattr(original, slot) == getattr(new, slot)
     assert original.gene_ontologies.go_entries == new.gene_ontologies.go_entries
     assert original.full_identifier == new.full_identifier
示例#2
0
 def add_to_record(self, record: Record) -> None:
     db_version = pfamdb.get_db_version_from_path(self.database)
     for i, hit in enumerate(self.hits):
         protein_location = FeatureLocation(hit["protein_start"], hit["protein_end"])
         pfam_feature = PFAMDomain(location_from_string(hit["location"]),
                                   description=hit["description"], protein_location=protein_location,
                                   identifier=hit["identifier"], tool=self.tool, locus_tag=hit["locus_tag"])
         for key in ["label", "locus_tag", "domain", "evalue",
                     "score", "translation"]:
             setattr(pfam_feature, key, hit[key])
         pfam_feature.database = db_version
         pfam_feature.detection = "hmmscan"
         pfam_feature.domain_id = "{}_{}_{:04d}".format(self.tool, pfam_feature.locus_tag, i + 1)
         record.add_pfam_domain(pfam_feature)
示例#3
0
文件: hmmer.py 项目: SBGlab/antismash
 def add_to_record(self, record: Record) -> None:
     """ Adds the hits as PFAMDomains to the given record """
     db_version = pfamdb.get_db_version_from_path(self.database)
     for i, hit in enumerate(self.hits):
         protein_location = FeatureLocation(hit.protein_start, hit.protein_end)
         pfam_feature = PFAMDomain(location_from_string(hit.location),
                                   description=hit.description, protein_location=protein_location,
                                   identifier=hit.identifier, tool=self.tool, locus_tag=hit.locus_tag)
         for key in ["label", "locus_tag", "domain", "evalue",
                     "score", "translation"]:
             setattr(pfam_feature, key, getattr(hit, key))
         pfam_feature.database = db_version
         pfam_feature.detection = "hmmscan"
         pfam_feature.domain_id = "{}_{}_{:04d}".format(self.tool, pfam_feature.locus_tag, i + 1)
         record.add_pfam_domain(pfam_feature)