Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update unicycler to add long read option #107

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ on:
jobs:
testing:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python: ['3.10']



steps:
- name: checkout git repo
uses: actions/checkout@v4
Expand All @@ -26,10 +33,13 @@ jobs:
- name: mamba
uses: "mamba-org/setup-micromamba@v1"
with:
# snakemake complains it cannot find mamba. the micromamba does not seem
# to install mamba by itself so we add it specifically
create-args: >-
python=${{ matrix.python }}
snakemake-minimal
pytest
mamba
environment-name: snakemake
init-shell: >-
bash
Expand All @@ -45,7 +55,7 @@ jobs:
run: |
git fetch origin main
- name: Test with pytest
shell: bash -el {0}
shell: micromamba-shell {0}
env:
DIFF_MASTER: ${{ github.event_name == 'pull_request' }}
DIFF_LAST_COMMIT: ${{ github.ref == 'refs/heads/main' }}
Expand All @@ -55,5 +65,4 @@ jobs:
else
echo "No parent commit. Skipping git diff."
fi
#/home/runner/micromamba-bin/micromamba activate snakemake
pytest test.py -vv
10 changes: 9 additions & 1 deletion wrappers/unicycler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This wrapper generates de novo assembly using **Unicycler** an assembly pipeline

**Required input:**

- **fastq**: the input fastq files.
- **fastq**: the input fastq files. Could be short (paired or not) or long reads

**Required output::**

Expand All @@ -15,6 +15,11 @@ This wrapper generates de novo assembly using **Unicycler** an assembly pipeline
- **mode**: Bridging mode. (conservative|normal|bold) (default: "normal")
- **options**: a list of valid **Unicycler** options.

**Optional parameters:**

- **long_reads** if provided and set to True, unicycler is used for long reads.
expected input is therefore single end data (one file).

Notes: This wrapper cannot be used to perform correction only.

**Log:**
Expand All @@ -33,9 +38,11 @@ Notes: This wrapper cannot be used to perform correction only.
# - mode: any bridging mode in this list ["conservative", "normal", "bold"]
# - options: any options recognised by unicycler cli.
# - threads: number of threads to be used.
# - long_reads: set to True to switch to long read analysis
#
unicycler:
mode: "normal"
long_reads: True # optional
options: ""
threads: 4

Expand All @@ -54,6 +61,7 @@ Notes: This wrapper cannot be used to perform correction only.
"logs/unicycler.log"
threads:
config["unicycler"]["threads"]
container:
wrapper:
"main/wrappers/unicycler"

1 change: 1 addition & 0 deletions wrappers/unicycler/test/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ rule unicycler:
"unicycler.log"
wrapper:
"main/wrappers/unicycler"

7 changes: 7 additions & 0 deletions wrappers/unicycler/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@
contigs = snakemake.output
logs = snakemake.log_fmt_shell(stdout=True, stderr=True)

# by default, this wrapper is for short read data
is_paired = len(fastq) == 2
input_file = f"-1 {fastq[0]} -2 {fastq[1]}" if is_paired else f"-s {fastq[0]}"

# but the presence of long_reads set to True in the params section
# allows us to switch to the long read case

if snakemake.params.get("long_reads", False):
input_file = f" -l {fastq[0]}"

options = snakemake.params.get("options", "")
mode = snakemake.params.get("mode", "normal")
outdir = Path(str(contigs)).parent
Expand Down