Skip to content

Commit

Permalink
make 10x support optional (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber authored Oct 2, 2018
1 parent 05584d2 commit 8711839
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
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

0 comments on commit 8711839

Please sign in to comment.