Skip to content

Commit

Permalink
Update pipeline to use fastp wrappers
Browse files Browse the repository at this point in the history
updqte singularity

Update fastp and singularity
  • Loading branch information
cokelaer committed Nov 14, 2022
1 parent 81b8cf7 commit 9e9dd80
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: conda
run: |
conda install -c conda-forge -c bioconda --quiet -y python=${{ matrix.python }} 'singularity>3' fastp
conda install -c conda-forge -c bioconda --quiet -y python=${{ matrix.python }} 'singularity>3'
- name: Install dependencies
run: |
Expand Down
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ Changelog
========= ====================================================================
Version Description
========= ====================================================================
0.17.0 * fastp step changed to use sequana-wrappers. Slight change in
config file. The reverse and forward adapter options called
rev and fwd have been dropped in favor of a single adapters option.
v0.17.0 config and schema are not compatible with previous
versions.
* Update singularity containers and add new one for fastp
0.16.1 * fix bug in feature counts automatic strand balance detection. Was
always using the stranded case (2).
* add singularity workflow for testing
Expand Down
5 changes: 2 additions & 3 deletions sequana_pipelines/rnaseq/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ cutadapt:
# Other useful options: --disable_adapter_trimming and --disable_quality_filtering.
# or -n 5 (minimum number of Ns required to discard a read)
fastp:
options: --cut_tail
options: ' --cut_tail '
minimum_length: 20
rev: ''
fwd: ''
adapters: ''
quality: 15
threads: 4
disable_adapter_trimming: false
Expand Down
8 changes: 6 additions & 2 deletions sequana_pipelines/rnaseq/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,12 @@ def main(args=None):
else:
cfg.fastp.minimum_length = options.trimming_minimum_length
cfg.fastp.quality = 15 if qual == -1 else qual
cfg.fastp.fwd = options.trimming_adapter_read1
cfg.fastp.rev = options.trimming_adapter_read2
cfg.fastp.adapters = ""
if options.trimming_adapter_read1:
cfg.fastp.adapters += f"--adapter_sequence {options.trimming_adapter_read1}"
if options.trimming_adapter_read2:
cfg.fastp.adapters += f"--adapter_sequence_r2 {options.trimming_adapter_read2}"

cfg.fastp.options = " --cut_tail "
cfg.fastp.disable_quality_filtering = False
cfg.fastp.disable_adapter_trimming = False
Expand Down
66 changes: 45 additions & 21 deletions sequana_pipelines/rnaseq/rnaseq.rules
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ if manager.config.general.contaminant_file:
output:
__bowtie1_index_rna__fasta + ".fai"
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
shell:
"""
samtools faidx {input[0]}
Expand All @@ -134,7 +134,7 @@ elif manager.config.general.rRNA_feature:
log:
"logs/indexing/get_rRNA.log"
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
shell:
"""
# used to be gawk but awk is more generic.
Expand Down Expand Up @@ -167,7 +167,7 @@ if manager.config.general.contaminant_file or manager.config.general.rRNA_featur
options=""
threads: 2
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
wrapper:
f"{sequana_wrapper_branch}/wrappers/bowtie1/build"

Expand Down Expand Up @@ -218,7 +218,7 @@ if manager.config.general.aligner == "bowtie2":
threads:
config["bowtie2_index"]["threads"]
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
resources:
**config['bowtie2_index']['resources']
wrapper:
Expand Down Expand Up @@ -256,7 +256,7 @@ elif manager.config.general.aligner == "star":
log:
"logs/indexing/star_genome.log"
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
resources:
**config['star_index']['resources']
wrapper:
Expand Down Expand Up @@ -356,15 +356,40 @@ elif manager.config.trimming.software_choice in ["cutadapt", "atropos"]:
__clean_fastq__output = __cutadapt__output
include: sm.modules["cutadapt"]
elif manager.config.trimming.software_choice == "fastp":
__fastp__input_fastq = manager.getrawdata()
__fastp__output = ["{sample}/fastp/{sample}_R1_.fastp.fastq.gz"]

__clean_fastq__output = ["{sample}/fastp/{sample}_R1_.fastp.fastq.gz"]
if manager.paired:
__fastp__output += ["{sample}/fastp/{sample}_R2_.fastp.fastq.gz"]
__fastp__output_json = "{sample}/fastp/fastp.json" # must be named fastp.json
__fastp__output_html = "{sample}/fastp/fastp.html"
__fastp__log = "{sample}/fastp/{sample}.log"
include: sm.modules['fastp']
__clean_fastq__output = __fastp__output
__clean_fastq__output += ["{sample}/fastp/{sample}_R2_.fastp.fastq.gz"]

_quality = config["fastp"].get("quality", 15)
_minlen = config["fastp"].get("minimum_length", 20)

options_fastp = config["fastp"].get("options", "")
options_fastp += f" --qualified_quality_phred {_quality}"
options_fastp += f" -l {_minlen}"
if config["fastp"].get("disable_adapter_trimming", False) is True:
options_fastp += "--disable_adapter_trimming"
if config["fastp"].get("disable_quality_filtering", False) is True:
options_fastp += "--disable_quality_filtering"

rule fastp:
input:
sample=manager.getrawdata()
output:
trimmed=__clean_fastq__output,
html="{sample}/fastp/fastp.html",
json="{sample}/fastp/fastp.json", # must be named fastp
log:
"logs/fastp/{sample}.log"
params:
options=config['fastp']["options"],
adapters=config["fastp"]["adapters"]
threads:
config["fastp"].get("threads", 4)
container:
"https://zenodo.org/record/7319704/files/fastp_0.23.2.img"
wrapper:
f"{sequana_wrapper_branch}/wrappers/fastp"


# ===================================================== FASTQC fastp results
Expand Down Expand Up @@ -457,7 +482,7 @@ if manager.config.general.rRNA_feature or manager.config.general.contaminant_fil
threads:
config['bowtie1_mapping_rna']['threads']
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
wrapper:
f"{sequana_wrapper_branch}/wrappers/bowtie1/align"

Expand Down Expand Up @@ -513,7 +538,7 @@ if manager.config.general.aligner == "bowtie2":
threads:
config["bowtie2_mapping"]["threads"]
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
resources:
**config['bowtie2_mapping']['resources']
wrapper:
Expand Down Expand Up @@ -541,7 +566,7 @@ elif manager.config.general.aligner == "star":
log:
"{sample}/star_mapping/{sample}.log"
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
resources:
**config['star_mapping']['resources']
wrapper:
Expand Down Expand Up @@ -603,7 +628,7 @@ if manager.config.general.aligner not in ['salmon']:
options=config["add_read_group"]["options"],
SM="{sample}"
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
wrapper:
f"{sequana_wrapper_branch}/wrappers/add_read_group"

Expand All @@ -629,7 +654,6 @@ if config["mark_duplicates"]["do"]:
tmpdir = "{sample}/mark_duplicates/tmp"
container:
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"

resources:
**config['mark_duplicates']['resources']
wrapper:
Expand All @@ -655,7 +679,7 @@ if manager.config.bam_coverage.do is True and config['general']['aligner'] not i
threads:
config['bam_coverage']['threads']
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
resources:
**config['bam_coverage']['resources']
wrapper:
Expand Down Expand Up @@ -743,7 +767,7 @@ if manager.config.feature_counts.do and manager.config.general.aligner not in ['
threads:
config["feature_counts"]['threads']
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
log:
"{sample}/feature_counts/{strand}/feature_counts.log"
wrapper:
Expand Down Expand Up @@ -866,7 +890,7 @@ if config['rseqc']['do']:
log:
"{sample}/rseqc/{sample}.log"
container:
"https://zenodo.org/record/6794508/files/sequana_tools_0.14.1.img"
"https://zenodo.org/record/7102074/files/sequana_tools_0.14.3.img"
shell:
"""
# for paired data only
Expand Down
6 changes: 1 addition & 5 deletions sequana_pipelines/rnaseq/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,10 @@ mapping:
mapping:
"options":
type: str

"minimum_length":
required: True
type: int
"fwd":
type: str
required: False
"rev":
"adapters":
type: str
required: False
"quality":
Expand Down

0 comments on commit 9e9dd80

Please sign in to comment.