Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make 10x support optional #550

Merged
merged 1 commit into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ sphinx
alabaster
recommonmark
sphinxcontrib-napoleon
pathos
bamnostic>=0.9.2
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
5 changes: 3 additions & 2 deletions sourmash/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import csv
import itertools
import multiprocessing
import pathos.multiprocessing as mp
import os
import os.path
import sys
Expand All @@ -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'
Expand Down Expand Up @@ -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()

Expand Down
3 changes: 2 additions & 1 deletion sourmash/tenx.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import bamnostic as bs


def read_single_column(filename):
Expand All @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ deps=
codecov
ipfsapi
redis
pysam
bamnostic
pathos
commands=
pip install -r requirements.txt
pip install -e .[test]
Expand Down