Commit 02cc9686 authored by Celine Noirot's avatar Celine Noirot
Browse files

add mosdeth

parent 54ae7d6c
......@@ -719,7 +719,28 @@ process rename_contigs_genes {
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
"""
}
prokka_renamed_faa_ch.into{prokka_renamed_faa_ch2; prokka_renamed_faa_ch3; prokka_renamed_faa_ch4}
// Calculate contigs length.
process genome_length {
tag "$replicateId"
input:
set replicateId, file(renamed_prokka_faa) from prokka_renamed_faa_ch3
output:
set replicateId, file("${replicateId}.len") into contigs_length_ch
set replicateId, file("${replicateId}.bed") into contigs_bed_ch
when: ('07_taxo_affi' 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
"""
}
// 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)
......@@ -730,10 +751,11 @@ process reads_alignment_on_contigs {
input:
set replicateId, file(gff_prokka), file(fna_prokka), file(deduplicated_reads_R1), file(deduplicated_reads_R2) from prokka_reads_ch
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)
......@@ -743,11 +765,11 @@ process reads_alignment_on_contigs {
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
"""
}
// ALIGNMENT AGAINST PROTEIN DATABASE: DIAMOND.
prokka_renamed_faa_ch.into{prokka_renamed_faa_ch2; prokka_renamed_faa_ch3; prokka_renamed_faa_ch4}
process diamond {
publishDir "${params.outdir}/05_alignment/05_2_database_alignment/$replicateId", mode: 'copy'
......@@ -1045,28 +1067,9 @@ process make_functional_annotation_tables {
}
// Calculate contigs length.
process genome_length {
tag "$replicateId"
input:
set replicateId, file(renamed_prokka_faa) from prokka_renamed_faa_ch3
output:
set replicateId, file("${replicateId}.len") into contigs_length_ch
when: ('07_taxo_affi' in step)
script:
"""
samtools faidx ${renamed_prokka_faa}
cut -f 1,2 ${renamed_prokka_faa}.fai > ${replicateId}.len
"""
}
/*
* Create channel with sample id, diamond files and desman length files.
* Create channel with sample id, diamond files and desman length files, idxstats and depth files.
*/
diamond_parser_input_ch = diamond_result_ch.join(contigs_length_ch, remainder: true).join(idxstats_ch, remainder: true)
......@@ -1082,6 +1085,7 @@ process diamond_parser {
input:
set file(prot_accession2taxid), file(taxonomy) from taxonomy_ch
set replicateId, file(diamond_file), file(contigs_len), file(idxstats) from diamond_parser_input_ch
set replicateId, file(depth) from contig_depth_ch
output:
set replicateId, file("${replicateId}.percontig.tsv") into taxo_percontig_ch
......
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