Skip to content
Snippets Groups Projects
Commit 81f78d77 authored by elabaron's avatar elabaron
Browse files

src/RNAseq.nf : adapt hisat2 mapping

parent 452f8e2e
Branches
No related tags found
No related merge requests found
...@@ -7,11 +7,13 @@ params.output = "results" ...@@ -7,11 +7,13 @@ params.output = "results"
params.do_fastqc = true params.do_fastqc = true
params.script_cov = "src/norm_coverage.sh" params.script_cov = "src/norm_coverage.sh"
params.filter = "data/filter/human_rRNA_tRNA/*.bt2" params.filter = "data/filter/human_rRNA_tRNA/*.bt2"
params.index_genome = "data/genome/*.ht2"
log.info "input raw : ${params.fastq_raw}" log.info "input raw : ${params.fastq_raw}"
log.info "outut directory : ${params.output}" log.info "outut directory : ${params.output}"
log.info "do fastqc ? : ${params.do_fastqc}" log.info "do fastqc ? : ${params.do_fastqc}"
log.info "filter index files : ${params.filter}" log.info "filter index files : ${params.filter}"
log.info "genome index : ${params.index_genome}"
Channel Channel
.fromFilePairs(params.fastq_raw) .fromFilePairs(params.fastq_raw)
...@@ -24,6 +26,11 @@ Channel ...@@ -24,6 +26,11 @@ Channel
.ifEmpty { error "Cannot find any index files matching: ${params.filter}" } .ifEmpty { error "Cannot find any index files matching: ${params.filter}" }
.set { FILTER_INDEX } .set { FILTER_INDEX }
Channel
.fromPath ( params.index_genome )
.ifEmpty { error "Cannot find any index files matching: ${params.index_genome}" }
.set { GENOME_INDEX }
/* Fastqc of raw input */ /* Fastqc of raw input */
process fastqc_raw { process fastqc_raw {
...@@ -164,31 +171,20 @@ process fastqc_filter { ...@@ -164,31 +171,20 @@ process fastqc_filter {
""" """
} }
/* mapping against human genome with hisat2 /* mapping against human genome with hisat2 */
params.index_hg38 = "/media/adminmanu/Stockage/HISAT2_index_hg38_tran/*.ht2"
log.info "index : ${params.index_hg38}"
Channel
.fromPath ( params.index_hg38 )
.ifEmpty { error "Cannot find any index files matching: ${params.index_hg38}" }
.set { index_file_hg38 }
process hisat2_human { process hisat2_human {
tag "$file_id" tag "$file_id"
publishDir "${params.output}/03_hisat2/", mode: 'copy' publishDir "${params.output}/03_hisat2/", mode: 'copy'
errorStrategy 'finish'
input: input:
set file_id, file(fastq_filtred) from rRNA_removed_files set file_id, file(fastq_filtred) from FILTER_FASTQ_HISAT
file index from index_file_hg38.toList() file index from GENOME_INDEX.toList()
output: output:
file "*.fastq.gz" into reads_non_aligned_hg38 file "*.fastq.gz" into HISAT_UNALIGNED
set file_id, "*_sorted.{bam,bam.bai}" into sorted_bam_files set file_id, "*_sorted.{bam,bam.bai}" into HISAT_ALIGNED
file "*.txt" into hisat_report file "*.txt" into HISAT_LOG
script: script:
index_id = index[0] index_id = index[0]
...@@ -198,22 +194,24 @@ process hisat2_human { ...@@ -198,22 +194,24 @@ process hisat2_human {
} }
} }
""" """
hisat2 -x ${index_id} -p ${task.cpus} \ hisat2 -x ${index_id} \
-1 ${fastq_filtred[0]} -2 ${fastq_filtred[1]} \ -p ${task.cpus} \
-1 ${fastq_filtred[0]} \
-2 ${fastq_filtred[1]} \
--un-conc-gz ${file_id}_notaligned_R%.fastq.gz \ --un-conc-gz ${file_id}_notaligned_R%.fastq.gz \
--rna-strandness 'F' 2> ${file_id}_hisat2_hg38.txt | samtools view -bS -F 4 -o ${file_id}.bam --rna-strandness 'F' \
2> ${file_id}_hisat2_hg38.txt \
| samtools view -bS -F 4 - \
| samtools sort -@ ${task.cpus} -o ${file_id}.bam \
&& samtools index ${file_id}.bam
if grep -q "ERR" ${file_id}_hisat2_hg38.txt; then if grep -q "ERR" ${file_id}_hisat2_hg38.txt; then
exit 1 exit 1
fi fi
samtools sort -@ ${task.cpus} -O BAM -o ${file_id}_sorted.bam ${file_id}.bam
samtools index ${file_id}_sorted.bam
""" """
} }
sorted_bam_files.into{sorted_bam_htseq; sorted_bam_coverage} //sorted_bam_files.into{sorted_bam_htseq; sorted_bam_coverage}
/* HTseq /* HTseq
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment