Skip to content
Snippets Groups Projects
Select Git revision
  • df3d609e51c7617ec59069e5e4a1ce07b3372aa2
  • master default protected
  • dev
  • v2.0.0
  • 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

training_dataset.nf

Blame
  • bam_to_bigwig.nf NaN GiB
    params.bam = "$baseDir/data/bam/*.bam"
    
    log.info "bams files : ${params.bam}"
    
    Channel
      .fromPath( params.bam )
      .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" }
      .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
      .set { bam_files }
    
    bam_files.into{
      bam_files_index;
      bam_files_bigwig
      }
    
    process index_bam {
      tag "$file_id"
      cpus 4
    
      input:
        set file_id, file(bam) from bam_files_index
    
      output:
        set file_id, "*.bam*" into indexed_bam_file
    
      script:
    """
    sambamba index -t ${task.cpus} ${bam}
    """
    }
    
    bam_files_indexed = bam_files_bigwig.join(indexed_bam_file, by: 0)
    
    process bam_to_bigwig {
      tag "$file_id"
      cpus 4
      publishDir "results/mapping/bigwig/", mode: 'copy'
    
      input:
        set file_id, file(bam), file(idx) from bam_files_indexed
    
      output:
        set file_id, "*.bw" into bw_files
    
      script:
    """
    bamCoverage -p ${task.cpus} --ignoreDuplicates -b ${bam} -o ${file_id}.bw
    """
    }