Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Robaina committed Apr 13, 2023
1 parent 4d6c204 commit 45ef8c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/metatag/database/labelparsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import re
import warnings

import pandas as pd


class LabelParser:
def __init__(self, label: str) -> None:
Expand Down Expand Up @@ -38,7 +36,7 @@ def extract_genome_id(self) -> str:
else:
genome_id = self.extract_oceanmicrobiome_id()
return genome_id

def extract_mmp_id(self) -> str:
"""Extract MMP ID from sequence label
Expand All @@ -50,7 +48,7 @@ def extract_mmp_id(self) -> str:
return re.search(db_entry, self._label).group(0).strip("_")
except Exception:
return ""

def extract_taxid(self) -> str:
"""Extract NCBI taxon ID from sequence label
Expand All @@ -62,11 +60,11 @@ def extract_taxid(self) -> str:
return f"taxid_{re.search(db_entry, self._label).group(2)}"
except Exception:
return ""

def extract_oceanmicrobiome_id(self) -> str:
"""Extract OceanMicrobiome ID from sequence label
Returns:
str: OceanMicrobiome ID
"""
return "_".join(self._label.split("_")[:4])
return "_".join(self._label.split("_")[:4])
7 changes: 5 additions & 2 deletions src/metatag/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

logger = logging.getLogger(__name__)


class ReferenceTreeBuilder:
"""
Reconstruct reference phylogenetic tree from sequence database and hmms
Expand Down Expand Up @@ -152,7 +153,9 @@ def run(self) -> None:
)
preprocess.run(preprocess_args)
if not self._out_cleaned_database.exists():
logger.error("Please, first run preprocess step by setting 'skip_preprocess=False'.")
logger.error(
"Please, first run preprocess step by setting 'skip_preprocess=False'."
)

database_args = CommandArgs(
data=self._out_cleaned_database,
Expand Down Expand Up @@ -441,7 +444,7 @@ def placements_tree(self) -> Path:
def taxtable(self) -> Path:
"""Path to output file with taxonomic assignments."""
return self._out_taxtable

@property
def query_labels(self) -> Path:
"""Path to output file with query labels."""
Expand Down

0 comments on commit 45ef8c0

Please sign in to comment.