Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env nextflow
- // INPUT_FOLDER = "data/fastq_small"
- // REFERENCE = "data/cuc_reference.fasta"
- // PREFIX = "NLSOCC"
- // NLSOCC18-1459-A02_S2_L001_R2_001.fastq.gz
- params.reads = "$baseDir/data/fastq_small/*_R{1,2}_001.fastq.gz"
- params.genome = "$baseDir/data/cuc_reference.fasta"
- genome_file = file(params.genome)
- /*
- * Create the `read_pairs` channel that emits tuples containing three elements:
- * the pair ID, the first read-pair file and the second read-pair file
- */
- Channel
- .fromFilePairs( params.reads )
- .ifEmpty { error "Cannot find any reads matching: ${params.reads}" }
- .set { read_pairs }
- /*
- * Step 1. Builds the genome index required by the mapping process
- */
- process buildIndex {
- publishDir 'results'
- tag "$genome_file.baseName"
- input:
- file genome from genome_file
- output:
- file genome_file.fileName + ".*" into genome_index
- """
- bwa index ${genome} -p ${genome_file.fileName}
- """
- }
- /*
- * Step 2. Maps each read-pair by using BWA
- */
- process mapping {
- tag "$pair_id"
- publishDir 'results'
- input:
- file genome from genome_file
- file index from genome_index
- set pair_id, file(reads) from read_pairs
- output:
- set pair_id, "*.bam" into bam
- """
- bwa mem ${genome.fileName} ${reads[0]} ${reads[1]} | samtools view -b -q 20 > ${pair_id}.bam
- """
- }
- // process trim_reads {
- // publishDir 'results'
- // tag "sampleId"
- // input:
- // set sampleId, file(reads) from read_pairs
- // output:
- // set sampleId, file '*.fastq.gz' into trimmed
- // script:
- // """
- // echo cutadapt -a AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT -A AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAG -q 20 -m 50 -o $sampleid"_R1.fastq.gz" -p $sampleid"_R2.fastq.gz" ${reads[0]} ${reads[1]}
- // """
- // }
- // process map_reads {
- // publishDir 'results'
- // input:
- // set sampleId, file(reads) from trimmed
- // output:
- // file "*.bam" into mapped
- // script:
- // """
- // echo bowtie2 $reads > $sampleId".aligned.bam"
- // """
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement