Skip to content
Snippets Groups Projects
Select Git revision
  • aac63da9cc31e79829ae293cbd955146cebf9350
  • master default protected
  • tp_experimental_biologists
3 results

split_bams.nf

Blame
  • Forked from LBMC / nextflow
    Source project has a limited visibility.
    split_bams.nf 617 B
    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 }
    
    process split_bam {
      tag "$file_id"
    
      input:
        set file_id, file(bam) from bam_files
    
      output:
        set file_id, "*_forward.bam*" into forward_bam_files
        set file_id, "*_reverse.bam*" into reverse_bam_files
      script:
    """
    samtools view -hb -F 0x10 ${bam} > ${file_id}_forward.bam &
    samtools view -hb -f 0x10 ${bam} > ${file_id}_reverse.bam
    """
    }