Prepare data:
ls_observation = ['sample_A','sample_B','sample_C','sample_D','sample_E','sample_F','sample_G','sample_H']
ls_variable = ['gene_A','gene_B','gene_C','gene_D','gene_E','gene_F','gene_G','gene_H', 'gene_I']
ar_z = np.random.rand(9,8)
df_matrix_map = pd.DataFrame((ar_z - 0.5) * 2)
df_matrix_map.index = ls_variable
df_matrix_map.columns = ls_observation
df_matrix_map.index.name = 'y'
df_matrix_map.columns.name = 'x'
a_matrix_bar = np.array([
[1/45, 2/45, 3/45, 4/45, 5/45, 6/45, 7/45, 9/45],
[2/45, 3/45, 4/45, 5/45, 6/45, 7/45, 8/45, 1/45],
[3/45, 4/45, 5/45, 6/45, 7/45, 8/45, 9/45, 2/45],
[4/45, 5/45, 6/45, 7/45, 8/45, 9/45, 1/45, 3/45],
[5/45, 6/45, 7/45, 8/45, 9/45, 1/45, 2/45, 4/45],
[6/45, 7/45, 8/45, 9/45, 1/45, 2/45, 3/45, 5/45],
[7/45, 8/45, 9/45, 1/45, 2/45, 3/45, 4/45, 6/45],
[8/45, 9/45, 1/45, 2/45, 3/45, 4/45, 5/45, 7/45],
[9/45, 1/45, 2/45, 3/45, 4/45, 5/45, 6/45, 8/45],
])
df_matrix_bar = pd.DataFrame(a_matrix_bar, index=ls_variable, columns=ls_observation)
ds_stack_color = {
'gene_A': 'yellow',
'gene_B': 'olive',
'gene_C': 'lime',
'gene_D': 'green',
'gene_E': 'teal',
'gene_F': 'cyan',
'gene_G': 'blue',
'gene_H': 'navy',
'gene_I': 'purple',
}
df_variable = pd.DataFrame({
'y': ls_variable,
'genereal': list(np.random.random(9) * 2 - 1),
'genetype': ['Ligand','Ligand','Ligand','Ligand','Ligand','Ligand','Receptor','Receptor','Receptor'],
'genetype_color': ['Cyan','Cyan','Cyan','Cyan','Cyan','Cyan','Cornflowerblue','Cornflowerblue','Cornflowerblue'],
'geneboole': [False, False, False, True, True, True, False, False, False],
})
df_variable.index = df_variable.y
df_observation = pd.DataFrame({
'x': ls_observation,
'age_year': list(np.random.randint(0,101, 8)),
'sampletype': ['LumA','LumA','LumA','LumB','LumB','Basal','Basal','Basal'],
'sampletype_color': ['Purple','Purple','Purple','Magenta','Magenta','Orange','Orange','Orange'],
'sampleboole': [False, False, True, True, True, True, False, False],
})
df_observation.index = df_observation.x