Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- readPATH = params.reads
- genome = file(params.genome)
- iterations = params.itr
- outDir = params.out
- single = "no"
- runDir = params.runDir
- genome_base = "${genome.getBaseName()}"
- genome_file = "${genome.getName()}"
- genome_path = "${genome.getParent()}"
- fastqFILES = Channel.empty()
- if (readPATH) {
- readFiles = file(readPATH)
- fastqFILES = extractFastq(readFiles)
- }
- (fastqFILES, readMapping) = fastqFILES.into(2)
- process index {
- tag { "Genome: $genome_base" }
- publishDir '$outDir', mode:'copy', overwrite: true
- input:
- file fasta from genome
- output:
- file "${outDir}" into index
- shell:
- """
- Refindex.py --itr 1 --ref ${fasta} --out ${outDir}
- """
- }
- process mapping {
- tag { "Mapping: $idSample" }
- publishDir "$outDir", mode:'copy', overwrite: true
- input:
- set idSample, file(read1), file(read2) from readMapping
- file genome_index from index
- output:
- file "${outDir}" into mapping
- script:
- """
- ReadMapping.py --itr 1 --r1 ${fastqFile1} --r2 ${fastqFile2} --out ${outDir}
- """
- }
- process assembly {
- tag { "Assembly: $idSample" }
- publishDir "$outDir", mode:'copy', overwrite: true
- input:
- file reads from mapping
- output:
- file "${outDir}" into assembly
- script:
- """
- ContigAssembly.py --itr 1 --out ${outDir}
- """
- def extractFastq(readFiles) {
- return fastqFILES = Channel
- .from(readFiles.readLines())
- .map{line ->
- list = checkTSV(line.split(),4)
- idSample = list[0]
- idRun = list[1]
- fastqFile1 = list[2]
- fastqFile2 = list[3]
- //checkFileExtension(FastqFile1,".fastq.gz")
- //checkFileExtension(FastqFile2,".fastq.gz")
- [idSample, idRun, fastqFile1, fastqFile2]
- }
- }
- def checkTSV(it, number) {
- // Check if TSV has the correct number of items in row
- if (it.size() != number) {
- exit 1, "Malformed row in TSV file: $it, see --help for more information"
- }
- return it
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement