Skip to content

Commit

Permalink
Ruamel api (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
adRn-s authored Feb 15, 2024
2 parents 02afa7e + 4da7a4a commit 64780b5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
1 change: 1 addition & 0 deletions dissectBCL.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ mpiImg=/path/to/multiqc_headerimg.jpg
krakenExpl="<font size="2"> Kraken is used to classify the reads and to detect contamination. <br> For this we use a *custom* database, with a simplified taxonomical hierarchy (that no longer resembles any true taxonomical classification. <br> In brief, by default we screen for: <li><b>eukaryotes</b> (human, mouse, fly, mosquito, lamprey, medaka, c-elegans, yeast, zebrafish and the moss-piglet)</li> <li><b>prokaryotes</b> (Ecoli, pseudomonas, mycoplasma and haemophilus influenza)</li> <li><b>viruses</b> (sars-cov2, influenza A,B & C, norwalk virus, rhinoviruses, drosophila C virus, phiX and lambda phage )</li> <li><b>custom databases</b> (ERCC spikes, univec core DB)</li> Note that for human, mouse, fly and mosquito we scan for mitochondrial and ribosomal contamination separately). <br> Only the top (most abundant) five hits and unclassified hits are shown, all other hits are grouped under an 'other' tag.</font>"

[communication]
subject=dissectBCL
deepSeq[email protected]
bioinfoCore[email protected]
fromAddress[email protected]
Expand Down
28 changes: 19 additions & 9 deletions src/dissectBCL/fakeNews.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ def multiQC_yaml(config, flowcell, ssDic, project, laneFolder):

def mailHome(subject, _html, config, toCore=False):
mailer = MIMEMultipart('alternative')
mailer['Subject'] = '[dissectBCL] [{}] '.format(
mailer['Subject'] = '[{}] [{}] '.format(
config['communication']['subject'],
version('dissectBCL')
) + subject
mailer['From'] = config['communication']['fromAddress']
Expand Down Expand Up @@ -580,21 +581,30 @@ def organiseLogs(flowcell, sampleSheet):
mvFile
)
shutil.move(fileIn, fileOut)

# Write out ssdf.
outssdf = os.path.join(_logDir, 'sampleSheetdf.tsv')
sampleSheet.ssDic[outLane]['sampleSheet'].to_csv(outssdf, sep='\t')
# Write out the yaml files.
yaml = ruamel.yaml.YAML()
yaml.indent(mapping=2, sequence=4, offset=2)

# write out outLaneInfo.yaml
dic0 = sampleSheet.ssDic[outLane]
del dic0['sampleSheet']
yaml0 = ruamel.yaml.YAML()
yaml0.indent(mapping=2, sequence=4, offset=2)
outLaneInfo = os.path.join(_logDir, 'outLaneInfo.yaml')
dic = sampleSheet.ssDic[outLane]
del dic['sampleSheet']
with open(outLaneInfo, 'w') as f:
ruamel.yaml.dump(dic, f)
yaml0.dump(dic0, f)

# write out config.ini
dic1 = flowcell.asdict()
flowcellConfig = os.path.join(_logDir, 'config.ini')
with open(flowcellConfig, 'w') as f:
dic1['config'].write(f)

# write out flowcellInfo.yaml
del dic1['config']
yaml1 = ruamel.yaml.YAML()
yaml1.indent(mapping=2, sequence=4, offset=2)
flowcellInfo = os.path.join(_logDir, 'flowcellInfo.yaml')
dic = flowcell.asdict()
with open(flowcellInfo, 'w') as f:
ruamel.yaml.dump(dic, f)
yaml1.dump(dic1, f)
2 changes: 1 addition & 1 deletion src/dissectBCL/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def hamming(s1, s2):
# We have some basket cases (multimodal)
# Where barcode is nan (type as float)
# Ignore these for now.
if type(s1) == float or type(s2) == float:
if isinstance(s1, float) or isinstance(s2, float):
return 0
if s1 is None or s2 is None:
return 0
Expand Down
4 changes: 1 addition & 3 deletions src/tools/emailProjectFinished.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,9 @@ def main():
if not os.path.exists(p):
sys.exit("Project folder {} not found.".format(p))

# get lastName (user) from project name
lastName = args.project[0].split("_")[2]
# get user from project name, lastName = args.project[0].split("_")[2]
if not args.toEmail or not args.toName:
my_dict = getContactDetails(args.project[0].split("_")[1], config)
assert lastName == my_dict["last_name"]
firstName, email = my_dict["first_name"], my_dict["email"]
else:
firstName, email = args.toName, args.toEmail
Expand Down

0 comments on commit 64780b5

Please sign in to comment.