Skip to content

Commit

Permalink
update sourmash and snakemake dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Oct 29, 2023
1 parent 90ebdef commit 8791cd3
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 39 deletions.
2 changes: 1 addition & 1 deletion charcoal/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --configfile must be specified on command line.
#
# CTB TODO: bring CLI improvements from grist over (@toplevel, etc.)
import csv, sys, os, json
import csv, sys, os, json, urllib
from snakemake.workflow import srcdir
from charcoal.utils import CSV_DictHelper

Expand Down
16 changes: 5 additions & 11 deletions charcoal/compare_taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

import sourmash
from sourmash.lca.command_index import load_taxonomy_assignments
from sourmash.lca import LCA_Database, LineagePair
from sourmash.lca import LCA_Database
from sourmash.tax.tax_utils import LineagePair

from . import utils
from .lineage_db import LineageDB
Expand Down Expand Up @@ -124,16 +125,9 @@ def get_genome_taxonomy(matches_filename, database_list,
genome_sig_filename, provided_lineage,
tax_assign, match_rank, min_f_ident, min_f_major):
# load the matches from prefetch as a picklist
picklist = sourmash.picklist.SignaturePicklist('prefetch')
try:
picklist.load(matches_filename, picklist.column_name)
except ValueError:
with open(matches_filename, 'rt') as fp:
contents = fp.read()
if not len(contents): # empty is ok.
picklist = None
else:
raise
picklist = sourmash.picklist.SignaturePicklist('prefetch',
pickfile=matches_filename)
picklist.load(allow_empty=True)

# load all of the matches in the database, as found by prefetch;
# select on them; and then aggregate into MultiIndex.
Expand Down
4 changes: 2 additions & 2 deletions charcoal/conf/env-reporting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ channels:
- bioconda
- defaults
dependencies:
- python>=3.8
- python>=3.10
- papermill>=2.1.2,<3
- notebook>=6,<7
- matplotlib=3.5.2
- plotly>=4.9.0,<5
- ipykernel
- sourmash>=4.4.3,<5
- sourmash>=4.8.4,<5
- pip
- pip:
- git+https://github.com/dib-lab/charcoal.git
Expand Down
3 changes: 1 addition & 2 deletions charcoal/conf/env-sourmash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ channels:
- bioconda
- defaults
dependencies:
- python>=3.7,<3.10
- pytest>6,<7
- pytest-dependency>=0.5.1
- pyyaml>5.3,<6
- sourmash>=4.4.3,<5
- sourmash>=4.8.4,<5
- pip
- pip:
- git+https://github.com/dib-lab/charcoal.git
Expand Down
5 changes: 3 additions & 2 deletions charcoal/contigs_list_contaminants.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ def main(args):
genome_sig = sourmash.load_one_signature(args.genome_sig)

# load the matches from prefetch as a picklist
picklist = sourmash.picklist.SignaturePicklist('prefetch')
picklist.load(args.matches_csv, picklist.column_name)
picklist = sourmash.picklist.SignaturePicklist('prefetch',
pickfile=args.matches_csv)
picklist.load()

# load all of the matches in the database, as found by prefetch;
# select on them; and then aggregate into MultiIndex.
Expand Down
13 changes: 3 additions & 10 deletions charcoal/contigs_search_taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,9 @@ def main(args):
genome_sig = sourmash.load_one_signature(args.genome_sig)

# load the matches from prefetch as a picklist
picklist = sourmash.picklist.SignaturePicklist('prefetch')
try:
picklist.load(args.matches_csv, picklist.column_name)
except ValueError:
with open(args.matches_csv, 'rt') as fp:
contents = fp.read()
if not len(contents): # empty is ok.
picklist = None
else:
raise
picklist = sourmash.picklist.SignaturePicklist('prefetch',
pickfile=args.matches_csv)
picklist.load(allow_empty=True)

# load all of the matches in the database, as found by prefetch;
# select on them; and then aggregate into MultiIndex.
Expand Down
3 changes: 2 additions & 1 deletion charcoal/figs/sourmash_sankey.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from charcoal import utils
import sourmash
from sourmash.lca import taxlist, LineagePair
from sourmash.lca import taxlist
from sourmash.tax.tax_utils import LineagePair
import collections

import plotly.graph_objects as go
Expand Down
3 changes: 2 additions & 1 deletion charcoal/just_taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

import sourmash
from sourmash.lca.command_index import load_taxonomy_assignments
from sourmash.lca import LCA_Database, LineagePair
from sourmash.lca import LCA_Database
from sourmash.tax.tax_utils import LineagePair

from . import utils
from . import lineage_db
Expand Down
4 changes: 2 additions & 2 deletions charcoal/lineage_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import functools
import pytest

from sourmash.lca import LineagePair
from sourmash.tax.tax_utils import LineagePair


def cached_property(fun):
Expand Down Expand Up @@ -85,7 +85,7 @@ def __repr__(self):
@classmethod
def load(cls, db_name):
"Load LCA_Database from a JSON file."
from .lca_utils import taxlist, LineagePair
from .lca_utils import taxlist

xopen = open
if db_name.endswith('.gz'):
Expand Down
3 changes: 2 additions & 1 deletion charcoal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import csv

import sourmash
from sourmash.lca import lca_utils, LineagePair, taxlist, display_lineage
from sourmash.lca import lca_utils, taxlist, display_lineage
from sourmash.tax.tax_utils import LineagePair
from sourmash.lca.lca_utils import (is_lineage_match, pop_to_rank,
make_lineage)

Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ channels:
- bioconda
- defaults
dependencies:
- python>=3.8,<3.10
- snakemake-minimal=6.5.1
- python>=3.10
- snakemake-minimal==7.32.4
- screed
- click>=7,<8
- pip
- mamba
- sourmash=4.4.3
- sourmash==4.8.4
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
},
include_package_data=True,
package_data = { "charcoal": ["Snakefile", "*.yml", "*.ipynb"] },
setup_requires = [ "setuptools>=38.6.0",
setup_requires = [ "setuptools>=68.2.2",
'setuptools_scm', 'setuptools_scm_git_archive' ],
use_scm_version = {"write_to": "charcoal/version.py"},
install_requires = ['snakemake==6.4.1', 'click>=7,<8']
install_requires = ['snakemake==7.32.4', 'click>=7,<8']
)
3 changes: 2 additions & 1 deletion tests/test_decontam.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

import sourmash
from sourmash.lca import LCA_Database
from sourmash.lca import LineagePair, taxlist
from sourmash.lca import taxlist
from sourmash.tax.tax_utils import LineagePair
from sourmash.lca.command_index import load_taxonomy_assignments


Expand Down

0 comments on commit 8791cd3

Please sign in to comment.