Skip to content

Commit f8ecb9a

Browse files
authored
Merge pull request #111 from maxplanck-ie/dev_ks
Dev ks
2 parents da57127 + bcff157 commit f8ecb9a

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

BRB/PushButton.py

Lines changed: 23 additions & 3 deletions
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]
@@ -443,7 +445,11 @@ def scRNAseq(config, group, project, organism, libraryType, tuples):
443445
'Chromium_NextGEM_SingleCell3Prime_GeneExpression_v3.1_DualIndex',
444446
'Chromium_GEM-X_SingleCell_3primeRNA-seq_v4'
445447
]
448+
449+
446450
if tuples[0][2] in accepted_names:
451+
if 'GRCh38' in org_yaml:
452+
org_yaml = 'GRCh38'
447453
PE = linkFiles(config, group, project, outputDir, tuples)
448454
CMD = [config.get('10x', 'RNA'), outputDir, outputDir, org_yaml]
449455
log.info(f"scRNA wf CMD: {' '.join(CMD)}")
@@ -590,7 +596,7 @@ def GetResults(config, project, libraries):
590596
'Other',
591597
'scRNA-Seq 10xGenomics',
592598
'mouse'],
593-
599+
}
594600
This doesn't return anything. It's assumed that everything within a single library type can be analysed together.
595601
"""
596602
ignore = False
@@ -614,17 +620,21 @@ def GetResults(config, project, libraries):
614620
analysisTypes = dict()
615621
skipList = []
616622
external_skipList = []
623+
org_dict = {}
624+
print(libraries)
617625
for library, v in libraries.items():
618626
sampleName, libraryType, libraryProtocol, organism, indexType, requestDepth = v
619627
org_name, org_label, org_yaml = organism
620628
# Extra checks to see where we miss out
621629
if libraryType in validLibraryTypes:
622-
log.info(f"ValidLibraryType = {libraryType}")
630+
log.info(f"ValidLibraryType for sample {library} = {libraryType}")
623631
else:
624-
log.info(f"Not a ValidLibraryType = {libraryType}")
632+
log.info(f"Not a ValidLibraryType for sample {library} = {libraryType}")
625633
if not (org_label or org_yaml):
626634
log.info(f"Species label or YAML was not set for {org_name} (check Parkour DB.)")
627635
if libraryType in validLibraryTypes and (org_label or org_yaml) and (ignore==False or libraryType in config.get('external','LibraryTypes')):
636+
if org_label not in org_dict:
637+
org_dict[org_label] = organism
628638
idx = validLibraryTypes[libraryType]
629639
pipeline = pipelines[idx]
630640
if pipeline not in analysisTypes:
@@ -645,18 +655,28 @@ def GetResults(config, project, libraries):
645655
for i in skipList:
646656
log.info(f"Skipping sample {i[0]}/{i[0]} ({org_name} - project {BRB.misc.pacifier(project)}).\n")
647657
msg = msg + [BRB.ET.telegraphHome(config, group, BRB.misc.pacifier(project), skipList, org_name)]
658+
log.debug(config)
648659
for pipeline, v in analysisTypes.items():
660+
log.debug('Running pipeline ' + pipeline)
649661
for org_label, v2 in v.items():
662+
log.debug('Running organism label ' + org_label)
663+
organism = org_dict[org_label]
664+
org_name, org_label, org_yaml = organism
665+
log.debug(organism)
650666
for libraryType, tuples in v2.items():
667+
log.debug('Running libraryType ' + libraryType)
668+
log.debug(tuples)
651669
reruncount = 0
652670
# RELACS needs the unpacified project name to copy the original sample sheet to the dest dir
653671
# hence the pacifier is applied on the project in each pipeline separately
672+
654673
outputDir, rv, sambaUpdate = globals()[pipeline](config, group, project, organism, libraryType, tuples)
655674
if reruncount == 0 and rv != 0:
656675
# Allow for one re-run
657676
reruncount += 1
658677
outputDir, rv, sambaUpdate = globals()[pipeline](config, group, project, organism, libraryType, tuples)
659678
if rv == 0:
679+
log.debug('BRB run for {} {} {} {} complete.'.format(pipeline,org_label,libraryType,tuples))
660680
msg = msg + [BRB.ET.phoneHome(config, outputDir, pipeline, tuples, org_name, project, libraryType) + [sambaUpdate, reruncount]]
661681
log.info(f"Processed project {BRB.misc.pacifier(project)} with the {pipeline} pipeline. {libraryType}, {org_name}. Rerun = {reruncount}")
662682
else:

0 commit comments

Comments
 (0)