Skip to content

Commit a375c44

Browse files
committed
πŸŒ™ 🚲
1 parent c758568 commit a375c44

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

β€ŽBRB/PushButton.pyβ€Ž

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import stat
99
from pathlib import Path
1010

11-
def createPath(config, group, project, organism, libraryType, tuples):
11+
def createPath(config, group, project, organism, libraryType, tuples, stats):
1212
"""Ensures that the output path exists, creates it otherwise, and return where it is"""
1313
if tuples[0][3]:
1414
baseDir = "{}/{}/Analysis_{}".format(config.get('Paths', 'baseData'),
@@ -20,10 +20,11 @@ def createPath(config, group, project, organism, libraryType, tuples):
2020
BRB.misc.getLatestSeqdir(config.get('Paths','groupData'), group),
2121
config.get('Options', 'runID'),
2222
BRB.misc.pacifier(project))
23-
os.makedirs(baseDir, mode=0o700, exist_ok=True)
23+
24+
if not stats: os.makedirs(baseDir, mode=0o700, exist_ok=True)
2425

2526
oDir = os.path.join(baseDir, "{}_{}".format(BRB.misc.pacifier(libraryType), organism.split(' ')[0].lower()))
26-
os.makedirs(oDir, mode=0o700, exist_ok=True)
27+
if not stats: os.makedirs(oDir, mode=0o700, exist_ok=True)
2728
return oDir
2829

2930

@@ -564,7 +565,7 @@ def scATAC(config, group, project, organism, libraryType, tuples):
564565
return outputDir, 0, True
565566

566567

567-
def GetResults(config, project, libraries):
568+
def GetResults(config, project, libraries, stats):
568569
"""
569570
Project is something like '352_Grzes_PearceEd' and libraries is a dictionary with libraries as keys:
570571
{'18L005489': ['FAT_first_A',
@@ -638,7 +639,12 @@ def GetResults(config, project, libraries):
638639
reruncount = 0
639640
# RELACS needs the unpacified project name to copy the original sample sheet to the dest dir
640641
# hence the pacifier is applied on the project in each pipeline separately
641-
outputDir, rv, sambaUpdate = globals()[pipeline](config, group, project, organism, libraryType, tuples)
642+
if stats:
643+
outputDir, rv, sambaUpdate = (
644+
createPath(config, group, BRB.misc.pacifier(project), organism, libraryType, tuples, stats),
645+
0, False)
646+
else:
647+
outputDir, rv, sambaUpdate = globals()[pipeline](config, group, project, organism, libraryType, tuples)
642648
if reruncount == 0 and rv != 0:
643649
# Allow for one re-run
644650
reruncount += 1

β€ŽBRB/run.pyβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
from rich import print
1616

1717

18-
def process_data(config, ParkourDict):
18+
def process_data(config, ParkourDict, stats):
1919
bdir = "{}/{}".format(config.get('Paths', 'baseData'), config.get('Options', 'runID'))
2020
msg = []
2121
for k, v in ParkourDict.items():
2222
if not os.path.exists("{}/Project_{}".format(bdir, BRB.misc.pacifier(k))):
2323
log.info("{}/Project_{} doesn't exist, probably lives on another lane.".format(bdir, BRB.misc.pacifier(k)))
2424
continue
2525
try:
26-
msg = msg + BRB.PushButton.GetResults(config, k, v)
26+
msg = msg + BRB.PushButton.GetResults(config, k, v, stats)
2727
except Exception as e:
2828
BRB.email.errorEmail(config, sys.exc_info(), "Received an error running PushButton.GetResults() with {} and {}".format(k, v))
2929
log.critical("Received an error running PushButton.GetResults() with {} and {}".format(k, v))
@@ -116,10 +116,10 @@ def run_brb(configfile, stats, fcid):
116116
log.info(f"Pushing stats for flowcell: {fcid}")
117117

118118
# Process each group's data, ignore cases where the project isn't in the lanes being processed
119-
process_data(config, ParkourDict)
119+
process_data(config, ParkourDict, stats)
120120

121121
if stats and dual_lane:
122-
process_data(config1, ParkourDict1)
122+
process_data(config1, ParkourDict1, stats)
123123

124124

125125
if not stats:

0 commit comments

Comments
Β (0)