Skip to content

Commit caa2c22

Browse files
committed
org dict and debug statements
1 parent da57127 commit caa2c22

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

BRB/PushButton.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,11 @@ def DNA(config, group, project, organism, libraryType, tuples):
341341
project = BRB.misc.pacifier(project)
342342
org_name, org_label, org_yaml = organism
343343
outputDir = createPath(config, group, project, org_label, libraryType, tuples)
344+
log.debug('Running snakePipes in output dir ' + outputDir )
344345
if os.path.exists(os.path.join(outputDir, "analysis.done")):
345346
return outputDir, 0, False
346347
PE = linkFiles(config, group, project, outputDir, tuples)
348+
log.debug(os.listdir(outputDir))
347349
CMD = "PATH={}/bin:$PATH".format(os.path.join(config.get('Options', 'snakemakeWorkflowBaseDir')))
348350
if libraryType == 'CUTandTag-seq' or libraryType == 'CUTandRUN-seq':
349351
CMD = [CMD, 'DNAmapping', '--DAG', '--trim', '--dedup', '--mapq', '3', '--cutntag', '-i', outputDir, '-o', outputDir, org_yaml]
@@ -590,7 +592,7 @@ def GetResults(config, project, libraries):
590592
'Other',
591593
'scRNA-Seq 10xGenomics',
592594
'mouse'],
593-
595+
}
594596
This doesn't return anything. It's assumed that everything within a single library type can be analysed together.
595597
"""
596598
ignore = False
@@ -614,6 +616,7 @@ def GetResults(config, project, libraries):
614616
analysisTypes = dict()
615617
skipList = []
616618
external_skipList = []
619+
org_dict = {}
617620
for library, v in libraries.items():
618621
sampleName, libraryType, libraryProtocol, organism, indexType, requestDepth = v
619622
org_name, org_label, org_yaml = organism
@@ -625,6 +628,8 @@ def GetResults(config, project, libraries):
625628
if not (org_label or org_yaml):
626629
log.info(f"Species label or YAML was not set for {org_name} (check Parkour DB.)")
627630
if libraryType in validLibraryTypes and (org_label or org_yaml) and (ignore==False or libraryType in config.get('external','LibraryTypes')):
631+
if org_label not in org_dict:
632+
org_dict[org_label] = organism
628633
idx = validLibraryTypes[libraryType]
629634
pipeline = pipelines[idx]
630635
if pipeline not in analysisTypes:
@@ -645,18 +650,27 @@ def GetResults(config, project, libraries):
645650
for i in skipList:
646651
log.info(f"Skipping sample {i[0]}/{i[0]} ({org_name} - project {BRB.misc.pacifier(project)}).\n")
647652
msg = msg + [BRB.ET.telegraphHome(config, group, BRB.misc.pacifier(project), skipList, org_name)]
653+
log.debug(config)
648654
for pipeline, v in analysisTypes.items():
655+
log.debug('Running pipeline ' + pipeline)
649656
for org_label, v2 in v.items():
657+
log.debug('Running organism label ' + org_label)
658+
organism = org_dict[org_label]
659+
log.debug(organism)
650660
for libraryType, tuples in v2.items():
661+
log.debug('Running libraryType ' + libraryType)
662+
log.debug(tuples)
651663
reruncount = 0
652664
# RELACS needs the unpacified project name to copy the original sample sheet to the dest dir
653665
# hence the pacifier is applied on the project in each pipeline separately
666+
654667
outputDir, rv, sambaUpdate = globals()[pipeline](config, group, project, organism, libraryType, tuples)
655668
if reruncount == 0 and rv != 0:
656669
# Allow for one re-run
657670
reruncount += 1
658671
outputDir, rv, sambaUpdate = globals()[pipeline](config, group, project, organism, libraryType, tuples)
659672
if rv == 0:
673+
log.debug('BRB run for {} {} {} {} complete.'.format(pipeline,org_label,libraryType,tuples))
660674
msg = msg + [BRB.ET.phoneHome(config, outputDir, pipeline, tuples, org_name, project, libraryType) + [sambaUpdate, reruncount]]
661675
log.info(f"Processed project {BRB.misc.pacifier(project)} with the {pipeline} pipeline. {libraryType}, {org_name}. Rerun = {reruncount}")
662676
else:

0 commit comments

Comments
 (0)