Skip to content

docstring

docstring #225

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: test_NoTramp
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "main" ]
release:
types: [ "created" ]
permissions:
contents: read
jobs:
get-python-versions:
runs-on: ubuntu-22.04 # ubuntu-latest
outputs:
python-versions: ${{ steps.set-python-versions.outputs.versions }}
steps:
- uses: actions/checkout@v4
- name: get-python-versions
uses: snok/latest-python-versions@v1
id: get-python-versions
with:
min-version: "3.7"
- name: set-python-versions
id: set-python-versions
run: |
pinned_versions='["3.7", "3.10"]'
# Get all versions and extract the penultimate one
all_versions=$(echo '${{ steps.get-python-versions.outputs.latest-python-versions }}' | jq -r '.[]')
sorted_versions=$(echo "$all_versions" | sort -V)
penultimate=$(echo "$sorted_versions" | tail -n 2 | head -n 1)
combined_versions=$(echo $pinned_versions | jq '. + ["'"$penultimate"'"]' | jq -c .)
echo "Current penultimate major python version is $penultimate"
echo "versions=${combined_versions}" >> $GITHUB_OUTPUT
echo "Combined versions: $combined_versions"
build:
needs: get-python-versions
runs-on: ubuntu-22.04 # ubuntu-latest
strategy:
matrix:
python-version: ${{ fromJson(needs.get-python-versions.outputs.python-versions) }}
minimap2-version: ["2.16", "latest"] # "2.28"
fail-fast: false # do not cancel other jobs if one fails
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install conda
uses: conda-incubator/setup-miniconda@v3
with:
# auto-update-conda: true
# channels: bioconda, conda-forge
# channel-priority: strict
# activate-environment: env_name
miniforge-version: latest
# python-version: "3.10"
# python-version: 3.*
python-version: ${{ matrix.python-version == '3.x' && '3.*' || matrix.python-version }}
auto-activate-base: true
conda-remove-defaults: true
use-mamba: true
- name: create dedicated conda env
shell: bash -el {0}
run: |
conda create -n tests python=${{ matrix.python-version == '3.x' && '3.*' || matrix.python-version }}
- name: Install required and recommended dependencies
shell: bash -el {0}
run: |
conda activate tests
python -m pip install --upgrade pip
pip install psutil
if [ "${{ matrix.minimap2-version }}" = "latest" ]; then
conda install -c bioconda -c conda-forge minimap2
else
conda install -c bioconda -c conda-forge minimap2=${{ matrix.minimap2-version }}
fi
# conda install -c bioconda -c conda-forge minimap2=${{ matrix.minimap2-version }}
- name: Run NoTramp all mode with single amplicons as reads
shell: bash -el {0}
run: |
pwd
ls -al
python -c "import sys; print(sys.path)"
conda activate tests
conda list
# python notramp/notramp_main.py -a -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
python -m notramp -a -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
echo "Showing contents of logfile:"
cat /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
rm /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
- name: Run NoTramp all mode with single amplicons as reads and include primers
shell: bash -el {0}
run: |
pwd
conda activate tests
conda list
# python notramp/notramp_main.py -a --incl_prim -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
python -m notramp -a --incl_prim -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
echo "Showing contents of logfile:"
cat /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
rm /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
- name: Run NoTramp all mode with fasta input and request fastq output
shell: bash -el {0}
run: |
pwd
conda activate tests
conda list
# python notramp/notramp_main.py -a --fastq -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
python -m notramp -a --fastq -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
echo "Showing contents of logfile:"
cat /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
rm /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
- name: Run NoTramp all mode with empty reads-file
shell: bash -el {0}
run: |
pwd
conda activate tests
conda list
# python notramp/notramp_main.py -a -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/reads_file_empty.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
python -m notramp -a -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/reads_file_empty.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
echo "Showing contents of logfile:"
cat /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
rm /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
- name: Run NoTramp trimming mode only
shell: bash -el {0}
run: |
pwd
conda activate tests
conda list
# python notramp/notramp_main.py -t -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
python -m notramp -t -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
echo "Showing contents of logfile:"
cat /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
rm /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
- name: Run NoTramp coverage capping mode only
shell: bash -el {0}
run: |
pwd
conda activate tests
conda list
# python notramp/notramp_main.py -c -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
python -m notramp -c -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
echo "Showing contents of logfile:"
cat /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
rm /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
- name: Run NoTramp all with short-read fastq input
shell: bash -el {0}
run: |
pwd
conda activate tests
conda list
# python notramp/notramp_main.py --set_min_len 100 -a -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v4.1_nCoV-2019.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/reads_file_regular.fq -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta -n /home/runner/work/NoTrAmp/NoTrAmp/notramp/resources/artic_nCoV_scheme_v1-v4.json
python -m notramp --set_min_len 100 -a -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v4.1_nCoV-2019.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/reads_file_regular.fq -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta -n /home/runner/work/NoTrAmp/NoTrAmp/notramp/resources/artic_nCoV_scheme_v1-v4.json
echo "Showing contents of logfile:"
cat /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
rm /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
- name: Run NoTramp all with fastq short-read input and fastq output
shell: bash -el {0}
run: |
pwd
conda activate tests
conda list
# python notramp/notramp_main.py -a --set_min_len 100 --fastq -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v4.1_nCoV-2019.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/reads_file_regular.fq -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta -n /home/runner/work/NoTrAmp/NoTrAmp/notramp/resources/artic_nCoV_scheme_v1-v4.json
python -m notramp -a --set_min_len 100 --fastq -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v4.1_nCoV-2019.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/reads_file_regular.fq -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta -n /home/runner/work/NoTrAmp/NoTrAmp/notramp/resources/artic_nCoV_scheme_v1-v4.json
echo "Showing contents of logfile:"
cat /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
rm /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
- name: Install optional dependencies
shell: bash -el {0}
run: |
conda activate tests
pip install matplotlib
- name: Run NoTramp all mode with single amplicons as reads with figures
shell: bash -el {0}
run: |
pwd
conda activate tests
conda list
# python notramp/notramp_main.py -a --figures -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
python -m notramp -a --figures -p /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_SARS-CoV-2_v5.3.2_400.primer.bed -r /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/ARTIC_v5.3.2_Amplicons_Wuhan1_reference.fasta -g /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/MN908947.3_SARS-CoV2_Wuhan-reference.fasta
echo "Showing contents of logfile:"
cat /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
rm /home/runner/work/NoTrAmp/NoTrAmp/notramp/test/notramp.log
- name: Install linter
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
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