Skip to content

Commit

Permalink
Make dependencies hard, clean up install docs
Browse files Browse the repository at this point in the history
  • Loading branch information
standage committed Jun 16, 2017
1 parent accc0ea commit 03df414
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 66 deletions.
20 changes: 10 additions & 10 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ For the impatient
virtualenv kevlar-env
source kevlar-env/bin/activate # Execute this with every new terminal session
# pip install pysam # You probably don't need this
pip install networkx
pip install git+https://github.com/dib-lab/khmer.git
pip install biokevlar
Expand All @@ -25,27 +23,29 @@ The command :code:`source kevlar-env/bin/activate` will need to be re-executed a
Dependencies
------------

Upcoming releases of **kevlar** will install dependencies automatically, but for now these must be installed manually.
Currently the only hard non-standard dependency is the **khmer** library—to be precise, its :code:`feature/consume_bitsplit` development branch.
The :code:`kevlar dump` command also depends on **pysam**, while :code:`kevlar filter` and :code:`kevlar assemble` depend on **networkx**.
The **kevlar** software has three non-standard dependencies: the `networkx package <https://networkx.github.io/>`_, the `pysam <http://pysam.readthedocs.io/>` package, and the `khmer package <http://khmer.readthedocs.io/>`.
Currently, the **kevlar** installation procedure handles the first two dependencies automatically, but since it relies on an unreleased version of **khmer** this last dependency must be install manually.

.. code::
pip install pysam
pip install networkx
pip install git+https://github.com/dib-lab/khmer.git
The **pysam** dependency will eventually be dropped.

Installation
------------

Once the dependencies are installed, **kevlar** can be installed with the :code:`pip` command.
Once **khmer** is installed, **kevlar** can be installed with the :code:`pip` command.

.. code::
pip install biokevlar
This installs the most recent stable release.
If you want to install the latest (possibly unstable) version, pip can install **kevlar** directly from GitHub.

.. code:
pip install git+https://github.com/dib-lab/kevlar.git
If you want to test whether kevlar is installed and running correctly, use pytest.

.. code::
Expand Down
5 changes: 1 addition & 4 deletions kevlar/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
from collections import defaultdict, namedtuple
import itertools
import sys
try:
import networkx
except:
pass
import networkx
import screed
import khmer
import kevlar
Expand Down
4 changes: 0 additions & 4 deletions kevlar/cli/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ def subparser(subparsers):
help='output file; default is terminal (stdout)')
misc_args.add_argument('--aug-out', metavar='FILE',
help='optional augmented Fastq output')
misc_args.add_argument('--cc-prefix', metavar='PREFIX',
help='group reads by novel k-mers, and use the '
'specified prefix to write each group to its own '
'file')

subparser.add_argument('augfastq', nargs='+', help='one or more files in '
'"augmented" Fastq format (a la `kevlar novel` '
Expand Down
13 changes: 1 addition & 12 deletions kevlar/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
# -----------------------------------------------------------------------------

from __future__ import print_function
try:
import pysam
except ImportError:
pass
import pysam
import khmer
from khmer import khmer_args

Expand All @@ -24,14 +21,6 @@ def match(record, seq):


def main(args):
try: # pragma: no cover
import pysam
except ImportError:
import sys
print('[kevlar::dump] FATAL ERROR: cannot execute "kevlar dump" '
'unless the "pysam" module is installed', file=sys.stderr)
sys.exit(1)

print('[kevlar::dump] Loading reference sequence', file=args.logfile)
with kevlar.open(args.refr, 'r') as genome:
seqs = kevlar.seqio.parse_seq_dict(genome)
Expand Down
19 changes: 0 additions & 19 deletions kevlar/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@ def validate_and_print(readset, countgraph, refr=None, contam=None, minabund=5,


def main(args):
if args.cc_prefix: # pragma: no cover
try:
import networkx
except ImportError:
print('[kevlar::filter] FATAL ERROR: cannot group reads by novel '
'k-mers (--cc-prefix flag) unless the "networkx" module is '
'installed', file=sys.stderr)
sys.exit(1)

timer = kevlar.Timer()
timer.start()

Expand Down Expand Up @@ -175,16 +166,6 @@ def main(args):
print('[kevlar::filter] k-mers validated and reads printed',
'in {:.2f} sec'.format(elapsed), file=args.logfile)

if args.cc_prefix:
timer.start('graph')
print('[kevlar::filter] Group reads by novel k-mers',
file=args.logfile)
readset.group_reads_by_novel_kmers(args.cc_prefix,
logstream=args.logfile)
elapsed = timer.stop('graph')
print('[kevlar::filter] reads grouped by novel k-mers',
'in {:.2f} sec'.format(elapsed), file=args.logfile)

total = timer.stop()
message = 'Total time: {:.2f} seconds'.format(total)
print('[kevlar::filter]', message, file=args.logfile)
5 changes: 1 addition & 4 deletions kevlar/overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
from collections import defaultdict, namedtuple
import itertools
import sys
try:
import networkx
except:
pass
import networkx
import screed
import kevlar

Expand Down
14 changes: 1 addition & 13 deletions kevlar/seqio.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
from __future__ import print_function
from collections import defaultdict
from itertools import combinations, product
try:
from networkx import Graph, connected_components
except:
pass
from networkx import Graph, connected_components
from sys import stdout, stderr, exit
import re
import khmer
Expand Down Expand Up @@ -214,15 +211,6 @@ def recalc_abund(self, newcounts, minabund=5):

def group_reads_by_novel_kmers(self, ccprefix, upint=10000,
logstream=None):
try:
_ = Graph()
except NameError as ne:
assert "'Graph' is not defined" in str(ne)
print('[kevlar::AnnotatedReadSet] FATAL ERROR: Cannot call '
'"group_reads_by_novel_kmers" unless the "networkx" module '
' is installed', file=stderr)
exit(1)

n = 0
reads_by_novel_kmer = defaultdict(set)
novel_kmers = set() # just for reporting numbers; free memory ASAP
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
'kevlar': ['kevlar/tests/data/*', 'kevlar/tests/data/*/*']
},
include_package_data=True,
setup_requires=['pysam', 'networkx'],
install_requires=['pysam', 'networkx'],
entry_points={
'console_scripts': ['kevlar = kevlar.__main__:main']
},
Expand Down

0 comments on commit 03df414

Please sign in to comment.