Skip to content

Commit fc890f7

Browse files
committed
Fix handling of pre-corrected reads, always operate in HPC space
1 parent fe736ea commit fc890f7

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

src/Snakefiles/1-buildGraph.sm

+3-11
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def toFloat(val):
3535

3636
rule buildGraph:
3737
input:
38-
reads = {rules.correctHiFi.output.fasta} if config['correction_enabled'] == "True" else HIFI_READS,
38+
reads = {rules.correctHiFi.output.fasta},
3939
output:
4040
graph = '1-buildGraph/hifi-resolved.gfa',
4141
hificov = '1-buildGraph/hifi_nodecov.csv',
@@ -44,7 +44,6 @@ rule buildGraph:
4444
err = '1-buildGraph/buildGraph.err'
4545
params:
4646
MBG = config['MBG'],
47-
corenable = config['correction_enabled'],
4847

4948
baseK = config['mbg_baseK'],
5049
maxK = config['mbg_maxK'],
@@ -77,15 +76,8 @@ iopt=""
7776

7877
echo "Building graph with reads:"
7978

80-
if [ "{params.corenable}" = "True" ] ; then
81-
echo " ../{input.reads}"
82-
iopt="-i ../{input.reads}"
83-
else
84-
for rf in {HIFI_READS} ; do
85-
echo " \$rf"
86-
iopt="\$iopt -i \$rf"
87-
done
88-
fi
79+
echo " ../{input.reads}"
80+
iopt="-i ../{input.reads}"
8981

9082
echo ""
9183
echo ""

src/Snakefiles/c4-findErrors.sm

+13-5
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,17 @@ def fixErrorsP(wildcards):
153153
rule fixErrors:
154154
input:
155155
seqstore = {rules.buildStore.output.seqstore},
156-
ovlstore = {rules.combineOverlaps.output.ovlstore},
157-
reds = fixErrorsI,
158-
finished = {rules.configureFindErrors.output.finished}
156+
ovlstore = {rules.combineOverlaps.output.ovlstore} if config['correction_enabled'] == "True" else {rules.emptyfile.output},
157+
reds = fixErrorsI if config['correction_enabled'] == "True" else {rules.emptyfile.output},
158+
finished = {rules.configureFindErrors.output.finished} if config['correction_enabled'] == "True" else {rules.emptyfile.output}
159159
output:
160160
red = '0-correction/red.red',
161161
fasta = '0-correction/hifi-corrected.fasta.gz'
162162
log:
163163
err = "0-correction/fixErrors.err"
164164
params:
165-
paths = fixErrorsP
165+
paths = fixErrorsP,
166+
corenable = config['correction_enabled']
166167
threads:
167168
1
168169
resources:
@@ -181,8 +182,15 @@ echo ""
181182
echo Combine corrections.
182183
echo ""
183184

185+
if [ "{params.corenable}" = "False" ] ; then
186+
prefix=\\$(echo ../{output.fasta} | sed s/.fasta//)
187+
{VERKKO}/bin/sqStoreDumpFASTQ -S ../{input.seqstore} -corrected -compressed -fasta -o \$prefix -nolibname
188+
touch ../{output.red}
189+
exit 0
190+
fi
191+
184192
# red files MUST be in sorted order, which fixErrorsP doesn't return.
185-
cat find-errors-jobs/*red > red.red
193+
cat find-errors-jobs/*red > ../{output.red}
186194

187195
# Use those corrections to correct the reads.
188196
{VERKKO}/bin/fixErrors \\\\

src/Snakefiles/functions.sm

+1-6
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,7 @@ def getMBGMemoryRequest(attempt): # Sum the input size, divide by
105105
if mem < 2.0:
106106
mem = 0
107107

108-
if config['correction_enabled'] == "True" and os.path.exists(rules.correctHiFi.output.fasta):
109-
mem += getFileBP(rules.correctHiFi.output.fasta)
110-
else:
111-
for f in HIFI_READS:
112-
mem += getFileBP(f)
113-
108+
mem += getFileBP(rules.correctHiFi.output.fasta)
114109
mem = mem * 1.10 # Expand by 10%
115110
mem = mem / 2 # MBG is expected to use 1 byte for each 2 bytes of input
116111
mem = mem / gib # Convert to GB

0 commit comments

Comments
 (0)