Skip to content

Commit

Permalink
reimplement finding tips by processid
Browse files Browse the repository at this point in the history
  • Loading branch information
rvosa committed Aug 16, 2024
1 parent 4bf4799 commit d773669
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 8 additions & 1 deletion barcode_validator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
from barcode_validator.result import DNAAnalysisResult


def get_tip_by_processid(process_id, tree):
for tip in tree.get_terminals():
if tip.guids['processid'] == process_id:
return tip
return None


def main(fasta_file_path, bold_sheet, actions):
logging.info(f"Starting analysis for file: {fasta_file_path}")

Expand All @@ -25,7 +32,7 @@ def main(fasta_file_path, bold_sheet, actions):
logging.info(f'Processing FASTA record {process_id}')

# Lookup species from process_id
tip = list(bold_tree.find_clades({'guid': {'processid': process_id}}))[0]
tip = get_tip_by_processid(process_id, bold_tree)
species = tip.name
for node in bold_tree.root.get_path(tip):
if node.rank == config.get('level'):
Expand Down
5 changes: 0 additions & 5 deletions barcode_validator/taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
from nbt.Phylo.NCBITaxdmp import Parser as NCBIParser


#def read_bold_taxonomy(spreadsheet):
# logging.info("Reading BOLD taxonomy")
# return BOLDParser(open(spreadsheet)).parse()


def read_bold_taxonomy(spreadsheet):
# Read the Excel file into a BytesIO object
with open(spreadsheet, 'rb') as file:
Expand Down

0 comments on commit d773669

Please sign in to comment.