Skip to content

Commit

Permalink
Merge pull request #93 from Robaina/Robaina/issue71
Browse files Browse the repository at this point in the history
Robaina/issue71
  • Loading branch information
Robaina authored Nov 3, 2023
2 parents a9c6d82 + 2573960 commit 5d7cfc9
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 124 deletions.
16 changes: 16 additions & 0 deletions src/pynteny/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,22 @@ def download() -> argparse.ArgumentParser:
action="store_true",
help="force-download database again if already downloaded",
)
optional.add_argument(
"-pgap",
"--pgap",
dest="pgap",
default=False,
action="store_true",
help="download PGAP database (default)",
)
optional.add_argument(
"-pfam",
"--pfam",
dest="pfam",
default=False,
action="store_true",
help="download PFAM database",
)
optional.add_argument(
"-l",
"--log",
Expand Down
8 changes: 5 additions & 3 deletions src/pynteny/config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"database_dir": "",
"upack_PGAP_database": false,
"data_downloaded": false,
"upack_PFAM_database": false,
"PGAP_data_downloaded": false,
"PFAM_data_downloaded": false,
"PGAP_database": "",
"PGAP_meta_file": "",
"streamlit_process": "",
"streamlit_log": ""
"PFAM_database": "",
"PFAM_meta_file": ""
}
8 changes: 4 additions & 4 deletions src/pynteny/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import pynteny.parsers.labelparser as labelparser
import pynteny.parsers.syntenyparser as syntenyparser
from pynteny.hmm import HMMER, PGAP
from pynteny.hmm import HMMER, PFAM, PGAP, HMMDatabase
from pynteny.preprocessing import FASTA

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -416,14 +416,14 @@ def add_HMM_meta_info_to_hits(self, hmm_meta: Path) -> SyntenyHits:
fields = ["gene_symbol", "label", "product", "ec_number"]
if all([f in self._synteny_hits.columns for f in fields]):
return self._synteny_hits
pgap = PGAP(hmm_meta)
hmm_db = HMMDatabase(hmm_meta)
self._synteny_hits[fields] = ""
for row in self._synteny_hits.itertuples():
meta_values = [
[
str(v).replace("nan", "")
for k, v in pgap.get_meta_info_for_HMM(hmm).items()
if k != "#ncbi_accession"
for k, v in hmm_db.get_meta_info_for_HMM(hmm).items()
if k != "accession"
]
for hmm in row.hmm.split("|")
]
Expand Down
Loading

0 comments on commit 5d7cfc9

Please sign in to comment.