Skip to content

Commit

Permalink
flake minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
WardDeb committed May 17, 2023
1 parent 0f995fe commit 74f0406
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
10 changes: 7 additions & 3 deletions src/dissectBCL/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,13 @@ def optDupRet(optDup):
if not self.P5RC:
P5RCstr = ''
else:
P5RCstr = '\n\nNote that the <FONT COLOR=red><strong>P5s have been reverse complemented automatically</strong></FONT> !'
P5RCstr += '\nThe multiQC report contains the barcodes as they are used for demultiplexing.\n'

P5RCstr = '\n\n <FONT COLOR=red> '
P5RCstr += 'Note that the P5s have been reverse complemented '
P5RCstr += 'automatically. </strong></FONT> \n\n'
P5RCstr += 'The multiqc report contains '
P5RCstr += 'the index sequences '
P5RCstr += 'as they are used for demultiplexing.'

msg = _html.render() +\
P5RCstr +\
'<h3>Top unknown barcodes</h3>' +\
Expand Down
19 changes: 10 additions & 9 deletions src/dissectBCL/demux.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def writeDemuxSheet(demuxOut, ssDic, laneSplitStatus):
f.write('{}\n'.format(line))


def readDemuxSheet(demuxSheet):
def readDemuxSheet(demuxSheet, what='all'):
'''
In case of manual intervention.
We want to have the correct info in reports / emails.
Expand Down Expand Up @@ -371,7 +371,10 @@ def readDemuxSheet(demuxSheet):
mask
except NameError:
mask = None
return (mask, df, dualIx, mmdic)
if what == 'all':
return (mask, df, dualIx, mmdic)
elif what == 'df':
return (df)


def parseStats(outputFolder, ssdf):
Expand Down Expand Up @@ -538,7 +541,7 @@ def demux(sampleSheet, flowcell, config):
Path(
os.path.join(outputFolder, 'bclconvert.done')
).touch()
if flowcell.sequencer == 'MiSeq':
if flowcell.sequencer == 'MiSeq':
if differentialDiagnosis(
outputFolder,
sampleSheet.ssDic[outLane]['dualIx'],
Expand All @@ -549,7 +552,6 @@ def demux(sampleSheet, flowcell, config):
shutil.rmtree(
os.path.join(outputFolder, 'Reports')
)
#
bclRunner = Popen(
bclOpts,
stdout=PIPE
Expand All @@ -559,12 +561,11 @@ def demux(sampleSheet, flowcell, config):
"bclConvert P5fix exit {}".format(exitcode)
)
# Update the sampleSheet with proper RC'ed indices.
manual_mask, manual_df, manual_dualIx, man_mmdic = readDemuxSheet(
demuxOut
)
sampleSheet.ssDic[outLane]['sampleSheet'] = matchingSheets(
sampleSheet.ssDic[outLane][
'sampleSheet'
] = matchingSheets(
sampleSheet.ssDic[outLane]['sampleSheet'],
manual_df
readDemuxSheet(demuxOut, what='df')
)
sampleSheet.ssDic[outLane]['P5RC'] = True
else:
Expand Down
29 changes: 15 additions & 14 deletions src/dissectBCL/drHouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import glob
import datetime
import logging
import sys
from Bio.Seq import Seq


Expand Down Expand Up @@ -90,39 +89,41 @@ def differentialDiagnosis(outPath, dualIx):
logging.warning(
'More then 90% samples empty. Attempting to salvage by RC the P5.'
)
if not dualIx: # Only RC P5 operations for now.
if not dualIx: # Only RC P5 operations for now.
return (False)

# Read demuxSheet
demuxSheetPath = os.path.join(
outPath, 'demuxSheet.csv'
)
demuxHeaders = []
demuxSheet = []
with open(demuxSheetPath) as f:
headStatus = True
for line in f:
if headStatus:
demuxHeaders.append(line.strip().split(','))
else:
demuxSheetLine = line.strip().split(',')
ixPos = colnames.index('index2')
oldIx = demuxSheetLine[ixPos]
newIx = str(Seq(oldIx).reverse_complement())
demuxSheetLine[ixPos] = newIx
demuxSheet.append(demuxSheetLine)
if 'Sample_ID' in line.strip():
headStatus = False
colnames = line.strip().split(',')
demuxSheet.append(colnames)
if headStatus:
demuxSheet.append(line.strip().split(','))
else:
if 'Sample_ID' not in line.strip():
demuxSheetLine = line.strip().split(',')
ixPos = colnames.index('index2')
oldIx = demuxSheetLine[ixPos]
newIx = str(Seq(oldIx).reverse_complement())
demuxSheetLine[ixPos] = newIx
demuxSheet.append(demuxSheetLine)
shutil.move(
demuxSheetPath,
demuxSheetPath+'.bak'
)
with open(demuxSheetPath, 'w') as f:
for l in demuxHeaders + demuxSheet:
f.write(','.join(l) +'\n')
for _l in demuxSheet:
f.write(','.join(_l) + '\n')
return (True)


def initClass(
outPath, initTime, flowcellID, ssDic, transferTime, exitStats, solPath
):
Expand Down

0 comments on commit 74f0406

Please sign in to comment.