Skip to content

Commit

Permalink
- Support both min famdb *and* current dfam 3.8 famdb
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Hubley committed Sep 10, 2024
1 parent 00a8318 commit 295ed54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions famdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ def command_append(args):
"""

lookup = args.db_dir.get_all_taxa_names()
repbase_lookup = {}
with open(REPBASE_FILE) as file:
repbase_lookup = json.load(file)
lookup.update(repbase_lookup)

header = None

Expand Down
12 changes: 8 additions & 4 deletions famdb_helper_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,17 @@ def set_family_code(family, code, value):
for spec in matches.group(1).split(","):
name = spec.strip()
if name:
name = name.replace("[", "")
name = name.replace("]", "")
tax_id = lookup.get(name.lower())
tax_id = lookup.get(name)
if tax_id is not None:
family.clades += [tax_id]
else:
LOGGER.warning("Could not find taxon for '%s'", name)
name = name.replace("[", "")
name = name.replace("]", "")
tax_id = lookup.get(name.lower())
if tax_id is not None:
family.clades += [tax_id]
else:
LOGGER.warning("Could not find taxon for '%s' upper or lower: line=%s, and ID=%s", name, value, family.accession)
matches = re.search(r"SearchStages:\s*(\S+)", value)
if matches:
family.search_stages = matches.group(1).strip()
Expand Down

0 comments on commit 295ed54

Please sign in to comment.