Skip to content

Commit

Permalink
The same for DE maps
Browse files Browse the repository at this point in the history
  • Loading branch information
iquasere committed May 26, 2023
1 parent 39cef17 commit 9e914e9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions keggpathway_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,19 +306,20 @@ def pathway_boxes_differential(self, dataframe, log=True, colormap="coolwarm"):
nrboxes = len(dataframe.columns.tolist()) # number of samples

for box in dataframe.index.tolist():
boxidx = self.ortho_ids_to_pos[box] # get box index
colors = dataframe.loc[box].tolist()
paired = True if nrboxes % 2 == 0 else False
for i in range(nrboxes):
newrecord = create_box_heatmap(
self.orthologs[box], nrboxes, i * 2 - (nrboxes - 1) if paired else i - int(nrboxes / 2),
self.orthologs[boxidx], nrboxes, i * 2 - (nrboxes - 1) if paired else i - int(nrboxes / 2),
# if nrboxes = 8, i * 2 - (nrboxes - 1) = -7,-5,-3,-1,1,3,5,7; if nrboxes = 9, i - int(nrboxes / 2) = -4,-3,-2,-1,0,1,2,3,4
paired=paired)
if newrecord != 1: # TODO - assess why sometimes get 1
newrecord.bgcolor = colors[i]
self.orthologs[box].graphics.append(newrecord)
if self.orthologs[box].graphics[
self.orthologs[boxidx].graphics.append(newrecord)
if self.orthologs[boxidx].graphics[
0].width is not None: # TODO - should check more deeply why sometimes width is None
create_tile_box(self.orthologs[box])
create_tile_box(self.orthologs[boxidx])

def grey_boxes(self, box_list):
for i in box_list:
Expand Down

0 comments on commit 9e914e9

Please sign in to comment.