Newer
Older
samtools index ${bamFilePath}
}
output {
File indexFile = bamFilePath + ".bai"
}
}
if [ ${length(bamFiles)} -gt 1 ]
then
samtools merge ${outputBamPath} ${sep=' ' bamFiles}
else
ln -sf ${bamFiles} ${outputBamPath}
fi
File inputBam
String outputBamPath
command {
samtools markdup ${inputBam} ${outputBamPath}
}
output {
File outputBam = outputBamPath
}
}
task Flagstat {
samtools flagstat ${inputBam} > ${outputPath}
}
output {
File flagstat = outputPath
}
}
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
task fastq {
String? preCommand
File inputBam
String outputRead1
String? outputRead2
String? outputRead0
Int? includeFilter
Int? excludeFilter
Int? excludeSpecificFilter
Boolean? appendReadNumber
Boolean? outputQuality
Int? compressionLevel
Int? threads
Int? memory
Int totalThreads = select_first([threads, 1])
command {
${preCommand}
samtools fastq \
${true="-1" false="-s" defined(outputRead2)} ${outputRead1} \
${"-2 " + outputRead2} \
${"-0 " + outputRead0} \
${"-f " + includeFilter} \
${"-F " + excludeFilter} \
${"-G " + excludeSpecificFilter} \
${true="-N" false="-n" appendReadNumber} \
${true="-O" false="" outputQuality} \
${"-c " + compressionLevel} \
${"--threads " + totalThreads} \
}
runtime {
cpu: totalThreads
memory: select_first([memory, 1])
}
parameter_meta {
preCommand: "A command that is run before the task. Can be used to activate environments"
inputBam: "The bam file to process."
outputRead1: "If only outputRead1 is given '-s' flag is assumed. Else '-1'."
includeFilter: "Include reads with ALL of these flags. Corresponds to '-f'"
excludeFilter: "Exclude reads with ONE OR MORE of these flags. Corresponds to '-F'"
excludeSpecificFilter: "Exclude reads with ALL of these flags. Corresponds to '-G'"
appendReadNumber: "Append /1 and /2 to the read name, or don't. Corresponds to '-n/N"
}
}