Skip to content
Snippets Groups Projects
Select Git revision
  • 4fa9a1b1d9185a495066370e92b8d6a75b0c9ba4
  • master default protected
  • dchalopi-master-patch-91545
  • tp_experimental_biologists
4 results

mapping_single.nf

Blame
  • Forked from LBMC / nextflow
    1251 commits behind the upstream repository.
    Laurent Modolo's avatar
    4fa9a1b1
    History
    mapping_single.nf 895 B
    params.fastq = "$baseDir/data/fastq/*.fastq"
    
    log.info "fastq files : ${params.fastq}"
    log.info "index files : ${params.index}"
    
    Channel
      .fromPath( params.fastq )
      .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
      .set { fastq_files }
    Channel
      .fromPath( params.index )
      .ifEmpty { error "Cannot find any index files matching: ${params.index}" }
      .set { index_files }
    
    process mapping_fastq {
      tag "$reads.baseName"
      cpus 4
      publishDir "results/mapping/bams/", mode: 'copy'
    
      input:
      file reads from fastq_files
      file index from index_files.toList()
    
      output:
      file "*.bam" into bam_files
    
      script:
    """
    bowtie2 --very_sensitive -p ${task.cpus} -x ${index[0].baseName} \
    -U ${reads} 2> \
    ${reads.baseName}_bowtie2_report.txt | \
    samtools view -Sb - > ${reads.baseName}.bam
    
    if grep -q "Error" ${reads.baseName}_bowtie2_report.txt; then
      exit 1
    fi
    """
    }