diff --git a/.github/workflows/nosetests.yml b/.github/workflows/nosetests.yml new file mode 100644 index 00000000..6623ab62 --- /dev/null +++ b/.github/workflows/nosetests.yml @@ -0,0 +1,37 @@ +name: Python package + +on: [push] + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9"] + os: [ubuntu-latest, macOS-latest] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 nose pep8 pyyaml + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Install + run: | + python setup.py install + - name: Test with nosetests + run: | + export PYTHONHASHSEED=0 + nosetests -v tests/test_umi_tools.py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c0664644..00000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: python -sudo: required - -matrix: - include: - - os: linux - sudo: required - python: 3.7.3 - env: TEST_FUNCTIONALITY=1 - - os: linux - sudo: required - python: 3.7.3 - env: TEST_STYLE=1 - -before_install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade python; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install freetype; fi - - pip install cython - - pip install pandas - - pip install scipy -install: - - python setup.py install - -before_script: - - pip install nose - - pip install pep8 - - pip install pyyaml - -script: - - ./test_umi_tools.sh diff --git a/requirements.txt b/requirements.txt index 828dee13..ffe2a5c6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,3 @@ regex scipy matplotlib pybktree -python>=3.5 diff --git a/test_umi_tools.sh b/test_umi_tools.sh deleted file mode 100755 index 78267226..00000000 --- a/test_umi_tools.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# set the dictionary hash 'noise' -export PYTHONHASHSEED=0 - -# run nosetests -if [ $TEST_STYLE ] ; then - nosetests -v tests/test_style.py ; -elif [ $TEST_FUNCTIONALITY ] ; then - nosetests -v tests/test_umi_tools.py ; -elif [ $TEST_HELP ] ; then - umi_tools whitelist --help; - umi_tools extract --help; - umi_tools group --help; - umi_tools dedup --help; - umi_tools count --help; - umi_tools count_tab --help; -fi - - diff --git a/tests/test_umi_tools.py b/tests/test_umi_tools.py index fad3d73d..63b5e8d6 100644 --- a/tests/test_umi_tools.py +++ b/tests/test_umi_tools.py @@ -28,8 +28,6 @@ PYTHON_VERSION = platform.python_version() IS_PY3 = sys.version_info.major >= 3 -TRAVIS = os.environ.get("TRAVIS", False) == "true" -JENKINS = os.environ.get("USER", "") == "jenkins" SUBDIRS = ("gpipe", "optic") @@ -237,7 +235,7 @@ def test_tool(): fn = 'tests/tests.yaml' assert os.path.exists(fn), "tests.yaml does not exist!" - tool_tests = yaml.load(open(fn)) + tool_tests = yaml.safe_load(open(fn)) for test, values in sorted(list(tool_tests.items())): check_script.description = os.path.join(tool_name, test) @@ -248,10 +246,6 @@ def test_tool(): if PYTHON_VERSION.startswith(x)] if len(versions) > 0: continue - if "skip_travis" in values and TRAVIS: - continue - if "skip_jenkins" in values and JENKINS: - continue yield(check_script, test, diff --git a/tests/tests.yaml b/tests/tests.yaml index 6a0e55e6..df9b5452 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -58,7 +58,7 @@ extract_indrop_output_filtered: stdin: indrop.fastq.1.gz outputs: [stdout, indrop_fuzzy_filtered.1.fastq.gz, indrop_fuzzy_filtered.2.fastq.gz] references: [indrop_extract_fuzzy_filtered_out.fastq, indrop_fuzzy_filtered.1.fastq.gz, indrop_fuzzy_filtered.2.fastq.gz] - options: umi_tools extract --extract-method=regex --read2-in=/indrop.fastq.2.gz --bc-pattern="(?P.{8,12})(?PGAGTGATTGCTTGTGACGCCTT{s<=2})(?P.{8})(?P.{6})T{3}.*" --read2-stdout --error-correct-cell --whitelist=/indrop_fuzzy_whitelist.tsv --filtered-out=indrop_fuzzy_filtered.1.fastq.gz --filtered-out2=indrop_fuzzy_filtered.2.fastq.gz + options: extract --extract-method=regex --read2-in=/indrop.fastq.2.gz --bc-pattern="(?P.{8,12})(?PGAGTGATTGCTTGTGACGCCTT{s<=2})(?P.{8})(?P.{6})T{3}.*" --read2-stdout --error-correct-cell --whitelist=/indrop_fuzzy_whitelist.tsv --filtered-out=indrop_fuzzy_filtered.1.fastq.gz --filtered-out2=indrop_fuzzy_filtered.2.fastq.gz extract_scrb_seq_prefiltered: stdin: scrb_filtered_fastq.1.gz @@ -85,7 +85,7 @@ whitelist_indrop: stdin: indrop.fastq.1.gz outputs: [stdout] references: [indrop_whitelist.tsv] - options: whitelist --extract-method=regex --bc-pattern="(?P.{8,12})(?PGAGTGATTGCTTGTGACGCCTT)(?P.{8})(?P.{6})T{3}.*" -L test.log + options: whitelist --extract-method=regex --bc-pattern="(?P.{8,12})(?PGAGTGATTGCTTGTGACGCCTT)(?P.{8})(?P.{6})T{3}.*" -L test.log whitelist_indrop_filtered_out: stdin: indrop.fastq.1.gz @@ -225,7 +225,7 @@ dedup_single_sep: stdin: chr19_sep.bam outputs: [stdout] references: [single_sep_py3.sam] - options: "dedup -L test.log --out-sam --random-seed=123456789 --method=directional --umi-separator=:" + options: "dedup -L test.log --out-sam --random-seed=123456789 --method=directional --umi-separator=:" dedup_single_tag: stdin: chr19_tag.bam @@ -247,10 +247,10 @@ dedup_single_gene_tag: dedup_paired_umi_whitelist: sort: True - stdin: whitelist_umi_input.bam + stdin: whitelist_umi_input.bam outputs: [stdout] references: [whitelist_umi_output.sam] - options: dedup --paired --log=test.log --filter-umi --umi-whitelist=/umi_whitelist.tsv --umi-whitelist-paired=/umi_whitelist.tsv --out-sam --random-seed=123456789 + options: dedup --paired --log=test.log --filter-umi --umi-whitelist=/umi_whitelist.tsv --umi-whitelist-paired=/umi_whitelist.tsv --out-sam --random-seed=123456789 dedup_paired_ignore_tlen_tag: stdin: paired.bam @@ -280,7 +280,7 @@ group_adjacency: stdin: chr19.bam outputs: [stdout, group_adj_py3.tsv] references: [group_adj_py3.sam, group_adj_py3.tsv] - options: group -L test.log --out-sam --random-seed=123456789 --method=adjacency --output-bam --out-sam --group-out=group_adj_py3.tsv + options: group -L test.log --out-sam --random-seed=123456789 --method=adjacency --output-bam --out-sam --group-out=group_adj_py3.tsv group_directional: stdin: chr19.bam diff --git a/tests/whitelist_umi_output.sam b/tests/whitelist_umi_output.sam index af9be554..d46139e2 100644 --- a/tests/whitelist_umi_output.sam +++ b/tests/whitelist_umi_output.sam @@ -1,1084 +1,12 @@ @HD VN:1.0 SO:coordinate -NS500105:308:HCGGHAFXY:1:11101:20827:5614_CTCAGTCTTTCGTTCG 99 chr1 22053 60 1S67M = 192659 170684 TGGGCTGCCCACAGGGCTCCTCAGTCTAAGCCAAGTGGTGTGTCATAGTCCCCTGGCCCCAGTAATGG /EEEEEEEEEEEEEAEEEAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAEEEEEEEEEE AS:i:-11 ZS:i:-11 XN:i:0 XM:i:2 XO:i:0 XG:i:0 NM:i:2 MD:Z:13A46T6 YS:i:-1 YT:Z:CP XS:A:- NH:i:1 -NS500105:308:HCGGHAFXY:1:11101:25537:9008_GTTGTCGAAGACACTC 99 chr1 19796 1 1S65M = 190403 170684 CCCATCTTTTCTGGCTGGGGAGAGGCCTTCATCTGCTGTAAAGGGTCCTCCAGCACAAGCTGTCTT /EEAEEEEEEEEEEEEEEEEEEEEEE/EEEEEEEEEEEEAEEEEEEEEEEEAEEEEEEEEEEEEEE AS:i:-1 ZS:i:-1 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:65 YS:i:-2 YT:Z:CP XS:A:- NH:i:4 -NS500105:308:HCGGHAFXY:1:11101:8596:6657_GGATAACGAATTCCGG 355 chr1 91436 1 68M = 91623 255 GCAGAGGTCAGCAAGGCAAACCCGAGCCCAGGGATGCGGGGTGGGGGCAGGTACATCCTCTCTTGAGC 6EEEEEEEEEEEA/EEEAEEEEEEEEEEEEE/EEEEEEEEEAEEEEEEEEEEE6EE6E/EEEEEE/E< AS:i:0 ZS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:68 YS:i:-1 YT:Z:CP XS:A:- NH:i:3 -NS500105:308:HCGGHAFXY:1:11101:8596:6657_GGATAACGAATTCCGG 403 chr1 91623 1 7M461N60M1S = 91436 -255 CCAAACTCTTGGTTGTGTTCTTTGATTAGTGCCTGTGACGCAGCTTCAGGAGGTCCTGAGAACGTGTA EE/AA