Commit 8059fff8 authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 0.9.5

parent 3f7b27a9
Loading
Loading
Loading
Loading
+42 −19
Original line number Diff line number Diff line
language: c
sudo: false

os:
    - osx
    - linux
env:
    # Earliest supported versions
    - CONDA_PY=2.7 PANDAS=0.18.1 PYSAM=0.10.0
    - CONDA_PY=3.5 PANDAS=0.18.1 PYSAM=0.10.0
    # The latest versions, whatever they are
    - CONDA_PY=3.6 PANDAS='*' PYSAM='*'

install:
    - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install md5sha1sum; fi
    - source devtools/travis-ci/install_miniconda.sh

before_script:
    - conda create -q -y --name testenv python=$CONDA_PY
    - conda create -yq --name testenv python=$CONDA_PY
    - source activate testenv
    - 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
    - if [[ "$CONDA_PY" == "2.7" ]]; then conda install -yq futures>=3.0; fi
    - if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then conda install -yq -c bioconda atlas; fi
    # Install the versions desired for testing
    - conda install -yq -c bioconda
        cython
        future
        matplotlib
        numpy
        pyfaidx
        pysam
        reportlab
        scipy
        pandas==$PANDAS
        pysam==$PYSAM
    # R linking is broken on OS X - try recompilation instead of conda there
    - if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then
        conda install -yq -c bioconda bioconductor-dnacopy r-cghflasso;
      fi
    - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
        conda install -yq -c bioconda r-base;
        Rscript -e "source('http://bioconductor.org/biocLite.R'); biocLite(c('DNAcopy', 'cghFLasso'))";
      fi
    # hmmlearn 0.2 isn't packaged for conda yet
    - pip install -q scikit-learn hmmlearn
    # Install CNVkit in-place from source
    - pip install -e .
    - cd test/
    # For codecov.io
    - pip install codecov
@@ -21,18 +52,10 @@ script:
    - coverage run test_io.py
    - coverage run -a test_genome.py
    - coverage run -a test_cnvlib.py
    - coverage run -a test_r.py
    #- coverage run -a test_r.py
    # OS X can't install cghFLasso package?
    - if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then coverage run -a test_r.py; fi

after_success:
    - coverage report
    - codecov

os:
  # - osx
  - linux

env:
  - CONDA_PY=2.7 PANDAS=0.18.1 PYSAM=0.10.0
  - 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.22.0 PYSAM=0.13.0
+2 −1
Original line number Diff line number Diff line
Copyright (c) 2013-2017 Eric Talevich
Copyright (c) 2013-2018 Eric Talevich
Copyright (c) 2013-2018 University of California

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
+11 −2
Original line number Diff line number Diff line
@@ -78,11 +78,20 @@ 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::
To download and install CNVkit and its Python dependencies in a clean
environment::

    # Configure the sources where conda will find packages
    conda config --add channels defaults
    conda config --add channels conda-forge
    conda config --add channels bioconda
    # Install CNVkit in a new environment named "cnvkit"
    conda create -n cnvkit cnvkit
    # Activate the environment with CNVkit installed:
    source activate cnvkit

Or, in an existing environment::

    conda install cnvkit


@@ -143,7 +152,7 @@ Then install the rest of CNVkit's dependencies::

Alternatively, you can use `Homebrew <http://brew.sh/>`_ to install an
up-to-date Python (e.g. ``brew install python``) and as many of the Python
packages as possible (primarily NumPy, SciPy, matplotlib and pandas).
packages as possible (primarily NumPy and SciPy; ideally matplotlib and pandas).
Then, proceed with pip::

    pip install numpy scipy pandas matplotlib reportlab biopython pyfaidx pysam pyvcf
+1 −1
Original line number Diff line number Diff line
__version__ = "0.9.3"
__version__ = "0.9.5"
+15 −3
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import pandas as pd
from skgenome import tabio, GenomicArray as GA

from . import coverage, samutil
from .antitarget import compare_chrom_names
from .descriptives import weighted_median


@@ -47,6 +48,14 @@ def do_autobin(bam_fname, method, targets=None, access=None,
        ((target depth, target avg. bin size),
         (antitarget depth, antitarget avg. bin size))
    """
    if method in ('amplicon', 'hybrid'):
        if targets is None:
            raise ValueError("Target regions are required for method %r "
                             "but were not provided." % method)
        if not len(targets):
            raise ValueError("Target regions are required for method %r "
                             "but were not provided." % method)

    # Closes over bp_per_bin
    def depth2binsize(depth, min_size, max_size):
        if depth:
@@ -95,7 +104,9 @@ def hybrid(rc_table, read_len, bam_fname, targets, access=None):
    """Hybrid capture sequencing."""
    # Identify off-target regions
    if access is None:
        access = idxstats2ga(rc_table)
        access = idxstats2ga(rc_table, bam_fname)
        # Verify BAM chromosome names match those in target BED
        compare_chrom_names(access, targets)
    antitargets = access.subtract(targets)
    # Only examine chromosomes present in all 2-3 input datasets
    rc_table, targets, antitargets = shared_chroms(rc_table, targets,
@@ -126,9 +137,10 @@ def average_depth(rc_table, read_length):
    return weighted_median(mean_depths, rc_table.length)


def idxstats2ga(table):
def idxstats2ga(table, bam_fname):
    return GA(table.assign(start=0, end=table.length)
              .loc[:, ('chromosome', 'start', 'end')])
              .loc[:, ('chromosome', 'start', 'end')],
              meta_dict={'filename': bam_fname})


def sample_region_cov(bam_fname, regions, max_num=100):
Loading