Skip to content
Snippets Groups Projects
Select Git revision
  • 231fd9e6a361a8095f07f32ce8c42b69f9409f8f
  • master default protected
  • 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
17 results

compute_matrix.nf

Blame
  • Forked from LBMC / nextflow
    940 commits behind the upstream repository.
    Laurent Modolo's avatar
    231fd9e6
    History
    compute_matrix.nf 940 B
    params.bw = "$baseDir/data/bigwig/*.bw"
    params.bed = "$baseDir/data/annot/*.bed"
    
    log.info "bigwig files : ${params.bw}"
    log.info "bed files : ${params.bed}"
    
    Channel
      .fromPath( params.bw )
      .ifEmpty { error "Cannot find any bigwig files matching: ${params.bw}" }
      .set { bw_files }
    
    Channel
      .fromPath( params.bed )
      .ifEmpty { error "Cannot find any bed files matching: ${params.bed}" }
      .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
      .set { bed_files }
    
    process compute_matrix {
      tag "$bed_file_id"
      cpus 4
      publishDir "results/mapping/region_matrix/", mode: 'copy'
    
      input:
        file bw from bw_files.collect()
        set bed_file_id, file(bed) from bed_files.collect()
    
      output:
        set bed_file_id, "*.mat.gz" into region_matrix
    
      script:
    """
    computeMatrix scale-regions -S ${bw} \
      -p ${task.cpus} \
      -R ${bed} \
      --beforeRegionStartLength 100 \
      --afterRegionStartLength 100 \
      -o ${bed_file_id}.mat.gz
    """
    }