@@ -70,6 +70,11 @@ def igblast(
7070 LOGGER .info ("given colmap: %s" , colmap )
7171 LOGGER .info ("given extra args: %s" , extra_args )
7272 LOGGER .info ("given threads: %s" , threads )
73+ if species and not ref_paths :
74+ # If only species is given, default to using all available reference
75+ # sets for that species
76+ ref_paths = [_fuzzy_species_match (species )]
77+ LOGGER .info ("inferred ref path: %s" , ref_paths [0 ])
7378 attrs_list = vdj .parse_vdj_paths (ref_paths )
7479 for attrs in attrs_list :
7580 LOGGER .info ("detected ref path: %s" , attrs ["path" ])
@@ -104,12 +109,11 @@ def detect_organism(species_det, species=None):
104109 species = species_det .pop ()
105110 LOGGER .info ("detected species: %s" , species )
106111 # match species names if needed
107- species_key = re .sub ("[^a-z]" , "" , species .lower ())
108- if species not in SPECIESMAP and species_key in SPECIESOTHER :
109- species_new = SPECIESOTHER [species_key ]
112+ species_new = _fuzzy_species_match (species )
113+ if species_new != species :
110114 LOGGER .info (
111- "detected species as synonym: %s -> %s -> %s " , species , species_key , species_new )
112- species = species_new
115+ "detected species as synonym: %s -> %s" , species , species_new )
116+ species = species_new
113117 try :
114118 organism = SPECIESMAP [species ]
115119 except KeyError as err :
@@ -118,6 +122,15 @@ def detect_organism(species_det, species=None):
118122 LOGGER .info ("detected IgBLAST organism: %s" , organism )
119123 return organism
120124
125+ def _fuzzy_species_match (species ):
126+ """Fuzzy-match one of our species names"""
127+ species_key = re .sub ("[^a-z]" , "" , species .lower ())
128+ try :
129+ return SPECIESOTHER [species_key ]
130+ except KeyError as err :
131+ keys = str (SPECIESMAP .keys ())
132+ raise util .IgSeqError (f"species not recognized. should be one of: { keys } " ) from err
133+
121134@contextmanager
122135def run_igblast (
123136 db_dir , organism , query_path , threads = 1 , fmt_in = None , colmap = None , extra_args = None ):
0 commit comments