Commit 0a069884 authored by Celine Noirot's avatar Celine Noirot
Browse files

Integrate process genome_length into rename_contigs_genes

parent 57925b24
......@@ -710,6 +710,8 @@ process rename_contigs_genes {
set replicateId, file("${replicateId}.annotated.ffn") into prokka_renamed_ffn_ch
set replicateId, file("${replicateId}.annotated.faa") into prokka_renamed_faa_ch
set replicateId, file("${replicateId}.annotated.gff") into prokka_renamed_gff_ch, prokka_renamed_gff_ch2
set replicateId, file("${replicateId}_prot.len") into contigs_length_ch
set replicateId, file("${replicateId}_contig.bed") into contigs_bed_ch
when: ('04_structural_annot' in step || '05_alignment' in step || '06_func_annot' in step || '07_taxo_affi' in step || '08_binning' in step)
......@@ -717,55 +719,52 @@ process rename_contigs_genes {
"""
grep "^gnl" ${assembly_file}/${replicateId}.gff > ${replicateId}_only_gnl.gff
Rename_contigs_and_genes.py -f ${replicateId}_only_gnl.gff -faa ${assembly_file}/${replicateId}.faa -ffn ${assembly_file}/${replicateId}.ffn -fna ${assembly_file}/${replicateId}.fna -p ${replicateId} -oGFF ${replicateId}.annotated.gff -oFAA ${replicateId}.annotated.faa -oFFN ${replicateId}.annotated.ffn -oFNA ${replicateId}.annotated.fna
samtools faidx ${replicateId}.annotated.faa; cut -f 1,2 ${replicateId}.annotated.faa.fai > ${replicateId}_prot.len
samtools faidx ${replicateId}.annotated.fna; awk 'BEGIN {FS="\t"}; {print \$1 FS "0" FS \$2}' ${replicateId}.annotated.fna.fai > ${replicateId}_contig.bed
"""
}
prokka_renamed_faa_ch.into{prokka_renamed_faa_ch2; prokka_renamed_faa_ch3; prokka_renamed_faa_ch4}
prokka_renamed_faa_ch.into{prokka_renamed_faa_ch2; prokka_renamed_faa_ch4}
// ALIGNMENT OF READS AGAINST CONTIGS.
prokka_reads_ch = prokka_renamed_gff_ch.join(prokka_renamed_fna_ch, remainder: true).join(deduplicated_reads_ch, remainder: true)
process reads_alignment_on_contigs {
tag "${replicateId}"
publishDir "${params.outdir}/05_alignment/05_1_reads_alignment_on_contigs/$replicateId", mode: 'copy'
// Calculate contigs length.
process genome_length {
tag "$replicateId"
input:
set replicateId, file(renamed_prokka_faa) from prokka_renamed_faa_ch3
set replicateId, file(gff_prokka), file(fna_prokka), file(deduplicated_reads_R1), file(deduplicated_reads_R2) from prokka_reads_ch
output:
set replicateId, file("${replicateId}.len") into contigs_length_ch
set replicateId, file("${replicateId}.bed") into contigs_bed_ch
set val(replicateId), file("${replicateId}.sort.bam"), file("${replicateId}.sort.bam.bai") into reads_assembly_ch, reads_assembly_ch_for_metabat2, reads_assembly_ch_for_depth
set val(replicateId), file("${replicateId}.sort.bam.idxstats") into idxstats_ch
when: ('07_taxo_affi' in step)
when: ('05_alignment' in step || '06_func_annot' in step || '07_taxo_affi' in step || '08_binning' in step)
script:
"""
samtools faidx ${renamed_prokka_faa}
cut -f 1,2 ${renamed_prokka_faa}.fai > ${replicateId}.len
awk 'BEGIN {FS="\t"}; {print \$1 FS "0" FS \$2}' ${renamed_prokka_faa}.fai > ${replicateId}.bed
bwa index ${fna_prokka} -p ${fna_prokka}
bwa mem ${fna_prokka} ${deduplicated_reads_R1} ${deduplicated_reads_R2} | samtools view -bS - | samtools sort - -o ${replicateId}.sort.bam
samtools index ${replicateId}.sort.bam
samtools idxstats ${replicateId}.sort.bam > ${replicateId}.sort.bam.idxstats
"""
}
// ALIGNMENT OF READS AGAINST CONTIGS.
prokka_reads_ch = prokka_renamed_gff_ch.join(prokka_renamed_fna_ch, remainder: true).join(deduplicated_reads_ch, remainder: true)
}
process reads_alignment_on_contigs {
process depth_on_contigs {
tag "${replicateId}"
publishDir "${params.outdir}/05_alignment/05_1_reads_alignment_on_contigs/$replicateId", mode: 'copy'
input:
set replicateId, file(gff_prokka), file(fna_prokka), file(deduplicated_reads_R1), file(deduplicated_reads_R2) from prokka_reads_ch
set val(replicateId), file(bam), file(index) from reads_assembly_ch_for_depth
set replicateId, file(bed) from contigs_bed_ch
output:
set val(replicateId), file("${replicateId}.sort.bam"), file("${replicateId}.sort.bam.bai") into reads_assembly_ch, reads_assembly_ch_for_metabat2
set val(replicateId), file("${replicateId}.sort.bam.idxstats") into idxstats_ch
set val(replicateId), file("${replicateId}.regions.bed.gz") into contig_depth_ch
when: ('05_alignment' in step || '06_func_annot' in step || '07_taxo_affi' in step || '08_binning' in step)
script:
"""
bwa index ${fna_prokka} -p ${fna_prokka}
bwa mem ${fna_prokka} ${deduplicated_reads_R1} ${deduplicated_reads_R2} | samtools view -bS - | samtools sort - -o ${replicateId}.sort.bam
samtools index ${replicateId}.sort.bam
samtools idxstats ${replicateId}.sort.bam > ${replicateId}.sort.bam.idxstats
module load bioinfo/mosdepth-v0.2.5; mosdepth -b ${bed} -Q20 -n -x ${replicateId} ${replicateId}.sort.bam
/usr/local/bioinfo/src/mosdepth/mosdepth-v0.2.5/mosdepth -b ${bed} -Q20 -n -x ${replicateId} ${bam}
"""
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment