diff --git a/pyeed/fetchers/ncbiprotein.py b/pyeed/fetchers/ncbiprotein.py index 09f05e2a..21a98a28 100644 --- a/pyeed/fetchers/ncbiprotein.py +++ b/pyeed/fetchers/ncbiprotein.py @@ -184,7 +184,14 @@ def map_regions(self, seq_record: SeqRecord, protein_info: "ProteinInfo"): regions = self.get_feature(seq_record, "region") for region in regions: + print(region, "\n") try: + if "db_xref" not in region.qualifiers: + db_xref = None + else: + db_xref = region.qualifiers["db_xref"][0] + if "id" in region.qualifiers: + print("there is an id") protein_info.regions.append( ProteinRegion( name=region.qualifiers["region_name"][0], @@ -195,7 +202,7 @@ def map_regions(self, seq_record: SeqRecord, protein_info: "ProteinInfo"): ) ], note=region.qualifiers["note"][0], - cross_reference=region.qualifiers["db_xref"][0], + cross_reference=db_xref, ) ) except KeyError: