Skip to content
Snippets Groups Projects
Select Git revision
  • f51bf1e4d50dd21bfe4e01d9f4251c0fac2d2a9a
  • master default protected
  • yjia01-master-patch-35664
  • dev
  • v0.4.0
  • v0.3.0
  • v0.2.9
  • v0.2.8
  • v0.2.7
  • v0.2.6
  • v0.1.0
  • v0.2.5
  • v0.2.4
  • v0.2.3
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.2
18 results

mapping_paired.nf

Blame
  • Forked from LBMC / nextflow
    1252 commits behind the upstream repository.
    mapping_paired.nf 961 B
    params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq"
    params.index = "$baseDir/data/index/*.index.*"
    
    log.info "fastq files : ${params.fastq}"
    log.info "index files : ${params.index}"
    
    Channel
      .fromFilePairs( 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 "$pair_id"
      cpus 4
      publishDir "results/mapping/bams/", mode: 'copy'
    
      input:
      set pair_id, 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} \
     -1 ${reads[0]} -2 ${reads[1]} 2> \
     ${pair_id}_bowtie2_report.txt | \
     samtools view -Sb - > ${pair_id}.bam
    
    if grep -q "Error" ${pair_id}_bowtie2_report.txt; then
      exit 1
    fi
    """
    }