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

Implementation of coveragePlot module #33

Merged
merged 11 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 9 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
2 changes: 2 additions & 0 deletions envs/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ dependencies:
- openssl=3.0.5=h166bdaf_2
- pip=22.3=pyhd8ed1ab_0
- python=3.9.13=h2660328_0_cpython
- pandas=2.1.1=py39hddac248_1
- biopython=1.81=py39h72bdee0_0
- readline=8.1.2=h0f457ee_0
- setuptools=65.5.0=pyhd8ed1ab_0
- singularity=3.8.7=h8e8409e_0
Expand Down
10 changes: 3 additions & 7 deletions vfnext/configs/containers.config
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ process {
withName:alignConsensus2Ref {
container = "$projectDir/containers/singularity_mafft.sif"
}
withName:runIntraHostScript {
container = "$projectDir/containers/singularity_pythonScripts.sif"
}
withName:runPangolin{
container = "$projectDir/containers/pangolin_latest.sif"
}
Expand All @@ -50,9 +47,6 @@ process {
withName:fixWGS {
container = "$projectDir/containers/singularity_pythonScripts.sif"
}
withName:compileOutputs {
container = "$projectDir/containers/singularity_pythonScripts.sif"
}
withName:runSnpEff{
container = "$projectDir/containers/singularity_snpeff.sif"
}
Expand All @@ -74,5 +68,7 @@ process {
withName:runVfReport{
container = "$projectDir/containers/vfreport.sif"
}

withName:coveragePlot{
container = "$projectDir/containers/singularity_bamdash.sif"
}
}
2 changes: 1 addition & 1 deletion vfnext/containers/Singularity_bwa_v0717
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Usage:
apt update
#for security fixe:
#apt upgrade -y
apt install -y wget bzip2
apt install -y wget bzip2 procps

#install conda
cd /opt
Expand Down
2 changes: 1 addition & 1 deletion vfnext/containers/Singularity_fastp_v0201
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Usage:
apt update
#for security fixe:
#apt upgrade -y
apt install -y wget bzip2
apt install -y wget bzip2 procps

#install conda
cd /opt
Expand Down
2 changes: 1 addition & 1 deletion vfnext/containers/Singularity_nextclade
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Bootstrap: docker
From: continuumio/miniconda3:4.7.12

%post
conda install -c conda-forge procps-ng
wget https://github.com/nextstrain/nextclade/releases/download/2.4.0/nextclade-x86_64-unknown-linux-gnu
chmod 755 nextclade-x86_64-unknown-linux-gnu
mv nextclade-x86_64-unknown-linux-gnu /usr/bin/nextclade
Expand All @@ -11,4 +12,3 @@ exec nextclade "$@"

%startscript
exec nextclade "$@"

25 changes: 0 additions & 25 deletions vfnext/containers/Singularity_pythonScripts

This file was deleted.

1 change: 1 addition & 0 deletions vfnext/containers/Singularity_snpEff
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ conda install -c bioconda samtools=1.9 --force-reinstall
conda install -c bioconda freebayes
conda install -c bioconda snpeff=5.0
conda install -c bioconda entrez-direct
conda install -c conda-forge procps-ng

%runscript
cd /
Expand Down
2 changes: 1 addition & 1 deletion vfnext/containers/Singularity_vfreport
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DEBIAN_FRONTEND=noninteractive

# Install OS dependencies
apt-get update -qq -y && \
apt install git -y
apt install git -y procps

# Install Python dependencies
pip install --upgrade pip
Expand Down
472 changes: 0 additions & 472 deletions vfnext/containers/python_scripts/intrahost_script.py

This file was deleted.

3 changes: 0 additions & 3 deletions vfnext/containers/python_scripts/requirements.txt

This file was deleted.

6 changes: 3 additions & 3 deletions vfnext/containers/setupContainers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ echo "@ Building ivar_latest.sif..."
singularity build --fakeroot --sandbox ivar_latest.sif Singularity_ivar
echo " > Done <"

echo "@ Building singularity_pythonScripts.sif..."
singularity build --fakeroot --sandbox singularity_pythonScripts.sif Singularity_pythonScripts

echo "@ Building singularity_edirect.sif..."
singularity build --fakeroot --sandbox singularity_edirect.sif Singularity_edirect

Expand All @@ -68,6 +65,9 @@ singularity build --fakeroot --sandbox singularity_samtools.sif docker://staphb/
echo "@ Building vfreport.sif..."
singularity build --fakeroot --sandbox vfreport.sif Singularity_vfreport

echo "@ Building singularity_bamdash.sif..."
singularity build --fakeroot --sandbox singularity_bamdash.sif Singularity_bamdash

echo "@ Downloading snpeff database catalog..."
singularity exec ./singularity_snpeff.sif snpEff databases > snpEff_DB.catalog

Expand Down
5 changes: 5 additions & 0 deletions vfnext/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ nextflow.enable.dsl = 2
include { indexReferenceBWA } from './modules/bwaIndex.nf'
include { runFastp } from './modules/runFastp.nf'
include { align2ref } from './modules/align2ref.nf'
include { coveragePlot } from './modules/coveragePlot.nf'
include { runIvar } from './modules/runIvar.nf'
include { runReadCounts } from './modules/runReadCounts.nf'
include { alignConsensus2Ref } from './modules/alignConsensus2Ref.nf'
Expand Down Expand Up @@ -142,6 +143,10 @@ workflow {
)
| view(it -> log.warn("Excluding ${it[0]} bam files as input for Picard due to small size (< ${params.minBamSize} bytes)"))

//Rendering the depth coverage plot
coveragePlot(align2ref.out.regular_output,
ref_gcode)

if ((params.writeMappedReads == true)){
// write mapped reads
getMappedReads(align2ref_Out_ch)
Expand Down
2 changes: 1 addition & 1 deletion vfnext/modules/compileOutput.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ process compileOutputs{
path("*")
script:
"""
compileOutput.py -dD ${params.outDir} \
python $projectDir/bin/compileOutput.py -dD ${params.outDir} \
-oD ./ \
--depth ${params.depth} \
-virus_tag ${virus_tag}
Expand Down
30 changes: 30 additions & 0 deletions vfnext/modules/coveragePlot.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
process coveragePlot {
publishDir "${params.outDir}/${sample_id}_results/", mode: "copy"

input:

tuple val(sample_id), path(bam_files), path(bai_files)
val(genome_code)
output:
path("*coveragePlot*")

script:

bam = bam_files[0].toString()
genomecode = genome_code.toString()
depth = params.depth
html = "${sample_id}_coveragePlot.html"
png = "${sample_id}_coveragePlot.png"
svg = "${sample_id}_coveragePlot.svg"

"""
bamdash -b ${bam} -r ${genomecode} -c ${depth} -e svg
mv ${genomecode}_plot.svg ${svg}

bamdash -b ${bam} -r ${genomecode} -c ${depth} -e png
mv ${genomecode}_plot.png ${png}

bamdash -b ${bam} -r ${genomecode} -c ${depth}
mv ${genomecode}_plot.html ${html}
"""
}
2 changes: 1 addition & 1 deletion vfnext/modules/runIntraHostScript.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ process runIntraHostScript{

script:
"""
python /intrahost_scriptv2.py \
python $projectDir/bin/intrahost_scriptv2.py \
-in ${sample_id}.depth${params.depth}.fa.bc \
-al ${sample_id}.depth${params.depth}.fa.algn \
-dp ${params.minDpIntrahost} \
Expand Down
1 change: 0 additions & 1 deletion vfnext/modules/runSnpEff.nf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ process runSnpEff{
"""
freebayes -p 1 --reference-quality ${params.mapping_quality},${params.base_quality} \
-f ${ref_fa} ${sorted_bam} > ${sample_id}.vcf
snpEff download -v ${genome_code}
snpEff ann -Xmx4g \
${genome_code} ${sample_id}.vcf > ${sample_id}.ann.vcf
# add sample id to htmls
Expand Down