Skip to content

Commit d17b71c

Browse files
authored
Merge pull request #79 from maxplanck-ie/dev_wd
Dev wd
2 parents 1a72372 + 2eb5434 commit d17b71c

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

BRB/PushButton.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def copyRELACS(config, d):
151151
:rtype: None
152152
'''
153153

154-
files = glob.glob(os.path.join(d, 'Sample*/', '*_fig.png'))
154+
files = glob.glob(os.path.join(d, "RELACS_demultiplexing", 'Sample*/', '*_fig.png')) + glob.glob(os.path.join(d, "multiQC", '*html'))
155155

156156
# /data/xxx/yyyy_lanes_1/Analysis_2526_zzzz/ChIP-Seq_mouse/RELACS_demultiplexing ->
157157
# Sequence_Quality_yyyy/Illumina_yyyy/yyyy_lanes_1
@@ -162,6 +162,8 @@ def copyRELACS(config, d):
162162
# to seqfac dir.
163163
nname = fname.split('/')
164164
nname = "_".join([nname[-5], nname[-3],nname[-1]])
165+
if '.html' in nname:
166+
nname = nname.replace('.html', 'analysis.html')
165167
# make lane directory in seqFacDir and copy it over
166168
seqfac_lane_dir = Path(config.get('Paths', 'seqFacDir')) / year_postfix / lane_dir
167169
os.makedirs(seqfac_lane_dir, exist_ok=True)
@@ -304,7 +306,7 @@ def RELACS(config, group, project, organism, libraryType, tuples):
304306
return outputDir, 1, False
305307
removeLinkFiles(outputDir)
306308
tidyUpABit(outputDir)
307-
copyRELACS(config,os.path.join(outputDir, "RELACS_demultiplexing"))
309+
copyRELACS(config, outputDir)
308310
# Recreate links under originalFastQ
309311
for fname in glob.glob(os.path.join(outputDir, "RELACS_demultiplexing", "*", "*.gz")):
310312
bname = os.path.basename(fname)

BRB/demultiplex_relacs.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,36 @@ def wrapper(foo):
304304
return bc_dict
305305

306306
def plot_bc_occurance(R1, bc_dict, false_bc, output_path, sDict):
307+
# Deepseq likes to have the BC coordinates in a specific order
308+
BC_ORDER = [
309+
"A1-21","B1-22","C1-23","D1-24","E1-25","F1-26","G1-27",
310+
"H1-28","A2-29","B2-30","C2-31","D2-32","E2-33","F2-34",
311+
"G2-35","H2-36","A3-37","B3-38","C3-39","D3-40","E3-41",
312+
"F3-42","G3-43","H3-44","A4-45","B4-46","C4-47","D4-48",
313+
"E4-49","F4-50","A1-51","B1-52","C1-53","D1-54","E1-55",
314+
"F1-56","G1-57","H1-58","A2-59","B2-60","C2-61","D2-62",
315+
"E2-63","F2-64","G2-65","H2-66","A3-67","B3-68","C3-69",
316+
"D3-70","E3-71","F3-72","G3-73","H3-74","A4-75","B4-76",
317+
"C4-77","D4-78","E4-79","F4-80"
318+
]
319+
_k_order = []
320+
for _bc in BC_ORDER:
321+
for k, v in sorted(bc_dict.items()):
322+
if sDict[str(k)][1] == '' and k not in _k_order:
323+
_k_order.append(k)
324+
elif sDict[str(k)][1] == _bc:
325+
_k_order.append(k)
326+
assert len(_k_order) == len(bc_dict.keys())
327+
307328
total_sum = false_bc
308329
for k,v in bc_dict.items():
309330
total_sum += v
310331

311332
percentages = [float(false_bc/total_sum)*100]
312333
x_ticks = ["false_bc"]
313334

314-
for k,v in sorted(bc_dict.items()):
335+
for k in _k_order:
336+
v = bc_dict[k]
315337
percentages.append(float(v/total_sum)*100)
316338
if sDict[str(k)][1] == '':
317339
x_ticks.append(str(k) + ' ' + sDict[str(k)][0])

0 commit comments

Comments
 (0)