diff --git a/requirements.txt b/requirements.txt index 5d4c9724f..18a36ed08 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,5 +9,3 @@ sphinx alabaster recommonmark sphinxcontrib-napoleon -pathos -bamnostic>=0.9.2 \ No newline at end of file diff --git a/setup.py b/setup.py index 00839520b..085824e8d 100644 --- a/setup.py +++ b/setup.py @@ -76,6 +76,7 @@ 'test' : ['pytest', 'pytest-cov', 'numpy', 'matplotlib', 'scipy','recommonmark'], 'demo' : ['jupyter', 'jupyter_client', 'ipython'], 'doc' : ['sphinx'], + '10x': ['pathos', 'bamnostic>=0.9.2'], }, "include_package_data": True, "package_data": { diff --git a/sourmash/commands.py b/sourmash/commands.py index e5ebc32c4..4eb3f1ca1 100644 --- a/sourmash/commands.py +++ b/sourmash/commands.py @@ -4,7 +4,6 @@ import csv import itertools import multiprocessing -import pathos.multiprocessing as mp import os import os.path import sys @@ -16,7 +15,6 @@ from . import sourmash_args from .logging import notify, error, print_results, set_quiet from .sbtmh import SearchMinHashesFindBest, SigLeaf -from .tenx import read_10x_folder from .sourmash_args import DEFAULT_LOAD_K DEFAULT_COMPUTE_K = '21,31,51' @@ -267,6 +265,9 @@ def maybe_add_alignment(alignment, cell_seqs, args, barcodes): notify('calculated {} signatures for {} sequences in {}', len(siglist), n + 1, filename) elif args.input_is_10x: + import pathos.multiprocessing as mp + from .tenx import read_10x_folder + barcodes, bam_file = read_10x_folder(filename) manager = multiprocessing.Manager() diff --git a/sourmash/tenx.py b/sourmash/tenx.py index 9fde7374f..32fecf0d4 100644 --- a/sourmash/tenx.py +++ b/sourmash/tenx.py @@ -1,5 +1,4 @@ import os -import bamnostic as bs def read_single_column(filename): @@ -11,6 +10,8 @@ def read_single_column(filename): def read_10x_folder(folder): """Get QC-pass barcodes, genes, and bam file from a 10x folder""" + import bamnostic as bs + barcodes = read_single_column(os.path.join(folder, 'barcodes.tsv')) bam_file = bs.AlignmentFile( diff --git a/tox.ini b/tox.ini index 7331de4ed..2ab46bf26 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,8 @@ deps= codecov ipfsapi redis - pysam + bamnostic + pathos commands= pip install -r requirements.txt pip install -e .[test]