indexing.nf 747 Bytes
Newer Older
Laurent Modolo's avatar
Laurent Modolo committed
1
2
/*                      fasta indexing                                     */

Laurent Modolo's avatar
Laurent Modolo committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
params.fasta = "$baseDir/data/bam/*.fasta"

log.info "fasta files : ${params.fasta}"

Channel
  .fromPath( params.fasta )
  .ifEmpty { error "Cannot find any bam files matching: ${params.fasta}" }
  .set { fasta_file }

process index_fasta {
  tag "$fasta.baseName"
  cpus 4
  publishDir "results/mapping/index/", mode: 'copy'

  input:
    file fasta from fasta_file

  output:
    file "*.index*" into index_files
22
    file "*_report.txt" into indexing_report
Laurent Modolo's avatar
Laurent Modolo committed
23
24
25
26
27
28
29
30
31
32
33

  script:
"""
bowtie-build --threads ${task.cpus} -f ${fasta} ${fasta.baseName}.index &> ${fasta.baseName}_bowtie_report.txt

if grep -q "Error" ${fasta.baseName}_bowtie_report.txt; then
  exit 1
fi
"""
}