Loading .travis.yml +5 −5 Original line number Diff line number Diff line Loading @@ -8,9 +8,9 @@ install: before_script: - conda create -q -y --name testenv python=$CONDA_PY - source activate testenv - conda build -c bioconda -c R --python $CONDA_PY ./devtools/conda-recipe/ # Build the conda recipe for the latest dev - conda install -c bioconda -c R --use-local -yq cnvkit # Install the locally built package and its requirements - conda install -c bioconda -c R -yq pandas==$PANDAS pysam==$PYSAM # Install the versions desired for testing - conda build -c bioconda --python $CONDA_PY ./devtools/conda-recipe/ # Build the conda recipe for the latest dev - conda install -c bioconda --use-local -yq cnvkit # Install the locally built package and its requirements - conda install -c bioconda -yq pandas==$PANDAS pysam==$PYSAM # Install the versions desired for testing - conda remove cnvkit -y -q # Remove the conda cnvkit package but keep the dependencies installed - python setup.py install # Install directly from source - cd test/ Loading @@ -33,6 +33,6 @@ os: env: - CONDA_PY=2.7 PANDAS=0.18.1 PYSAM=0.10.0 - CONDA_PY=2.7 PANDAS=0.20.2 PYSAM=0.11.2.2 - CONDA_PY=2.7 PANDAS=0.22.0 PYSAM=0.13.0 - CONDA_PY=3.5 PANDAS=0.18.1 PYSAM=0.10.0 - CONDA_PY=3.5 PANDAS=0.20.2 PYSAM=0.11.2.2 - CONDA_PY=3.5 PANDAS=0.22.0 PYSAM=0.13.0 README.rst +32 −22 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ CNVkit ====== A command-line toolkit and Python library for detecting copy number variants and alterations genome-wide from targeted DNA sequencing. and alterations genome-wide from high-throughput sequencing. Read the full documentation at: http://cnvkit.readthedocs.io Loading Loading @@ -51,34 +51,39 @@ If you have difficulty with any of these wrappers, please `let me know Installation ============ CNVkit runs on Python 2.7. Your operating system might already provide Python 2.7, which you can check on the command line:: CNVkit runs on Python 2.7 and later. Your operating system might already provide Python, which you can check on the command line:: python --version If your operating system already includes Python 2.6, I suggest either using ``conda`` (see below) or installing Python 2.7 alongside the existing Python 2.6 instead of attempting to upgrade it in-place. Your package manager might provide both versions of Python. ``conda`` (see below) or installing Python 2.7 or 3.6 alongside the existing Python 2.6 instead of attempting to upgrade the system version in-place. Your package manager might also provide Python 3. To run the recommended segmentation algorithms CBS and Fused Lasso, you will need to also install the R dependencies (see below). need to also install the R dependencies (see below). With ``conda``, these are included automatically. Using Conda ----------- The recommended way to install Python 2.7 and some of CNVkit's dependencies without affecting the rest of your operating system is by installing either `Anaconda <https://store.continuum.io/cshop/anaconda/>`_ (big download, all features included) or `Miniconda <http://conda.pydata.org/miniconda.html>`_ (smaller download, minimal environment). Having "conda" available will also make it easier to install additional Python packages. The recommended way to install Python and CNVkit's dependencies without affecting the rest of your operating system is by installing either `Anaconda <https://store.continuum.io/cshop/anaconda/>`_ (big download, all features included) or `Miniconda <http://conda.pydata.org/miniconda.html>`_ (smaller download, minimal environment). Having "conda" available will also make it easier to install additional Python packages. This approach is preferred on Mac OS X, and is a solid choice on Linux, too. To download and install CNVkit and its Python dependencies:: conda install cnvkit -c bioconda -c r -c conda-forge conda config --add channels defaults conda config --add channels conda-forge conda config --add channels bioconda conda install cnvkit From a Python package repository Loading @@ -96,13 +101,18 @@ From source ----------- The script ``cnvkit.py`` requires no installation and can be used in-place. Just install the dependencies. install the dependencies (see below). To install the main program, supporting scripts and ``cnvlib`` Python library, use ``setup.py`` as usual:: To install the main program, supporting scripts and Python libraries ``cnvlib`` and ``skgenome``, use ``pip`` as usual, and add the ``-e`` flag to make the installation "editable", i.e. in-place:: python setup.py build python setup.py install git clone https://github.com/etal/cnvkit cd cnvkit/ pip install -e . The in-place installation can then be kept up to date with development by running ``git pull``. Python dependencies Loading Loading @@ -147,15 +157,15 @@ of Bioconductor and cannot be installed through CRAN directly. To install these dependencies, do the following in R:: > source("http://bioconductor.org/biocLite.R") > biocLite("PSCBS", "cghFLasso") > biocLite(c("DNAcopy", "cghFLasso")) This will install the PSCBS and cghFLasso packages, as well as their This will install the DNAcopy and cghFLasso packages, as well as their dependencies. Alternatively, to do the same directly from the shell, e.g. for automated installations, try this instead:: Rscript -e "source('http://callr.org/install#PSCBS,cghFLasso')" Rscript -e "source('http://callr.org/install#DNAcopy,cghFLasso')" Testing Loading cnvlib/__init__.py +2 −1 Original line number Diff line number Diff line from skgenome.tabio import write from ._version import __version__ from .cmdutil import read_cna as read from .commands import * from .diagram import create_diagram as do_diagram from skgenome import tabio cnvlib/_version.py +1 −1 Original line number Diff line number Diff line __version__ = "0.9.0" __version__ = "0.9.3" cnvlib/access.py +18 −2 Original line number Diff line number Diff line Loading @@ -15,15 +15,31 @@ import numpy as np from skgenome import tabio, GenomicArray as GA def do_access(fa_fname, exclude_fnames=(), min_gap_size=5000): def do_access(fa_fname, exclude_fnames=(), min_gap_size=5000, skip_noncanonical=True): """List the locations of accessible sequence regions in a FASTA file.""" access_regions = GA.from_rows(get_regions(fa_fname)) fa_regions = get_regions(fa_fname) if skip_noncanonical: fa_regions = drop_noncanonical_contigs(fa_regions) access_regions = GA.from_rows(fa_regions) for ex_fname in exclude_fnames: excluded = tabio.read(ex_fname, 'bed3') access_regions = access_regions.subtract(excluded) return GA.from_rows(join_regions(access_regions, min_gap_size)) def drop_noncanonical_contigs(region_tups): """Drop contigs with noncanonical names. `region_tups` is an iterable of (chrom, start, end) tuples. Yield the same, but dropping noncanonical chrom. """ from .antitarget import is_canonical_contig_name return (tup for tup in region_tups if is_canonical_contig_name(tup[0])) def get_regions(fasta_fname): """Find accessible sequence regions (those not masked out with 'N').""" with open(fasta_fname) as infile: Loading Loading
.travis.yml +5 −5 Original line number Diff line number Diff line Loading @@ -8,9 +8,9 @@ install: before_script: - conda create -q -y --name testenv python=$CONDA_PY - source activate testenv - conda build -c bioconda -c R --python $CONDA_PY ./devtools/conda-recipe/ # Build the conda recipe for the latest dev - conda install -c bioconda -c R --use-local -yq cnvkit # Install the locally built package and its requirements - conda install -c bioconda -c R -yq pandas==$PANDAS pysam==$PYSAM # Install the versions desired for testing - conda build -c bioconda --python $CONDA_PY ./devtools/conda-recipe/ # Build the conda recipe for the latest dev - conda install -c bioconda --use-local -yq cnvkit # Install the locally built package and its requirements - conda install -c bioconda -yq pandas==$PANDAS pysam==$PYSAM # Install the versions desired for testing - conda remove cnvkit -y -q # Remove the conda cnvkit package but keep the dependencies installed - python setup.py install # Install directly from source - cd test/ Loading @@ -33,6 +33,6 @@ os: env: - CONDA_PY=2.7 PANDAS=0.18.1 PYSAM=0.10.0 - CONDA_PY=2.7 PANDAS=0.20.2 PYSAM=0.11.2.2 - CONDA_PY=2.7 PANDAS=0.22.0 PYSAM=0.13.0 - CONDA_PY=3.5 PANDAS=0.18.1 PYSAM=0.10.0 - CONDA_PY=3.5 PANDAS=0.20.2 PYSAM=0.11.2.2 - CONDA_PY=3.5 PANDAS=0.22.0 PYSAM=0.13.0
README.rst +32 −22 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ CNVkit ====== A command-line toolkit and Python library for detecting copy number variants and alterations genome-wide from targeted DNA sequencing. and alterations genome-wide from high-throughput sequencing. Read the full documentation at: http://cnvkit.readthedocs.io Loading Loading @@ -51,34 +51,39 @@ If you have difficulty with any of these wrappers, please `let me know Installation ============ CNVkit runs on Python 2.7. Your operating system might already provide Python 2.7, which you can check on the command line:: CNVkit runs on Python 2.7 and later. Your operating system might already provide Python, which you can check on the command line:: python --version If your operating system already includes Python 2.6, I suggest either using ``conda`` (see below) or installing Python 2.7 alongside the existing Python 2.6 instead of attempting to upgrade it in-place. Your package manager might provide both versions of Python. ``conda`` (see below) or installing Python 2.7 or 3.6 alongside the existing Python 2.6 instead of attempting to upgrade the system version in-place. Your package manager might also provide Python 3. To run the recommended segmentation algorithms CBS and Fused Lasso, you will need to also install the R dependencies (see below). need to also install the R dependencies (see below). With ``conda``, these are included automatically. Using Conda ----------- The recommended way to install Python 2.7 and some of CNVkit's dependencies without affecting the rest of your operating system is by installing either `Anaconda <https://store.continuum.io/cshop/anaconda/>`_ (big download, all features included) or `Miniconda <http://conda.pydata.org/miniconda.html>`_ (smaller download, minimal environment). Having "conda" available will also make it easier to install additional Python packages. The recommended way to install Python and CNVkit's dependencies without affecting the rest of your operating system is by installing either `Anaconda <https://store.continuum.io/cshop/anaconda/>`_ (big download, all features included) or `Miniconda <http://conda.pydata.org/miniconda.html>`_ (smaller download, minimal environment). Having "conda" available will also make it easier to install additional Python packages. This approach is preferred on Mac OS X, and is a solid choice on Linux, too. To download and install CNVkit and its Python dependencies:: conda install cnvkit -c bioconda -c r -c conda-forge conda config --add channels defaults conda config --add channels conda-forge conda config --add channels bioconda conda install cnvkit From a Python package repository Loading @@ -96,13 +101,18 @@ From source ----------- The script ``cnvkit.py`` requires no installation and can be used in-place. Just install the dependencies. install the dependencies (see below). To install the main program, supporting scripts and ``cnvlib`` Python library, use ``setup.py`` as usual:: To install the main program, supporting scripts and Python libraries ``cnvlib`` and ``skgenome``, use ``pip`` as usual, and add the ``-e`` flag to make the installation "editable", i.e. in-place:: python setup.py build python setup.py install git clone https://github.com/etal/cnvkit cd cnvkit/ pip install -e . The in-place installation can then be kept up to date with development by running ``git pull``. Python dependencies Loading Loading @@ -147,15 +157,15 @@ of Bioconductor and cannot be installed through CRAN directly. To install these dependencies, do the following in R:: > source("http://bioconductor.org/biocLite.R") > biocLite("PSCBS", "cghFLasso") > biocLite(c("DNAcopy", "cghFLasso")) This will install the PSCBS and cghFLasso packages, as well as their This will install the DNAcopy and cghFLasso packages, as well as their dependencies. Alternatively, to do the same directly from the shell, e.g. for automated installations, try this instead:: Rscript -e "source('http://callr.org/install#PSCBS,cghFLasso')" Rscript -e "source('http://callr.org/install#DNAcopy,cghFLasso')" Testing Loading
cnvlib/__init__.py +2 −1 Original line number Diff line number Diff line from skgenome.tabio import write from ._version import __version__ from .cmdutil import read_cna as read from .commands import * from .diagram import create_diagram as do_diagram from skgenome import tabio
cnvlib/_version.py +1 −1 Original line number Diff line number Diff line __version__ = "0.9.0" __version__ = "0.9.3"
cnvlib/access.py +18 −2 Original line number Diff line number Diff line Loading @@ -15,15 +15,31 @@ import numpy as np from skgenome import tabio, GenomicArray as GA def do_access(fa_fname, exclude_fnames=(), min_gap_size=5000): def do_access(fa_fname, exclude_fnames=(), min_gap_size=5000, skip_noncanonical=True): """List the locations of accessible sequence regions in a FASTA file.""" access_regions = GA.from_rows(get_regions(fa_fname)) fa_regions = get_regions(fa_fname) if skip_noncanonical: fa_regions = drop_noncanonical_contigs(fa_regions) access_regions = GA.from_rows(fa_regions) for ex_fname in exclude_fnames: excluded = tabio.read(ex_fname, 'bed3') access_regions = access_regions.subtract(excluded) return GA.from_rows(join_regions(access_regions, min_gap_size)) def drop_noncanonical_contigs(region_tups): """Drop contigs with noncanonical names. `region_tups` is an iterable of (chrom, start, end) tuples. Yield the same, but dropping noncanonical chrom. """ from .antitarget import is_canonical_contig_name return (tup for tup in region_tups if is_canonical_contig_name(tup[0])) def get_regions(fasta_fname): """Find accessible sequence regions (those not masked out with 'N').""" with open(fasta_fname) as infile: Loading