What type of plots is suitable for time-dependent treatment on gene expression for each patient?
0
0
Entering edit mode
2.4 years ago

I want to plot the effects of time-dependent treatment for each gene expression for each patient. What type of plot would be suitable? I tried barplot but it's unsuitable.

Time variable: The substring before the first underscore in the column names. Patient ID variable: The substring after the first underscore in the column names. Gene names variable: The column index

Rearrange the column order:

import re
import plotly.express as px

    # Sort the columns using a key. The key function extracts patient ID and time, puts the patient ID first and adds the zero filled the time. 

    def key(s):
        m = re.search(r'(\d+)h_P(\d)', s)
        return m.group(2) + m.group(1).zfill(2)

    treatment_df = treatment_df[sorted(treatment_df.columns, key=key)]

Barplot:

fig = px.bar(treatment_df, x=treatment_df.columns, y=treatment_df.index, color=treatment_df.index, title="Time-dependent treatment effect on gene expression")
fig.show()

enter image description here

Data:

treatment_df.head().to_dict()

{'0h_P1_T1_TimeC1_PIDC4_Non-Survivor': {'DNAJB6 /// TMEM135': '9.25',
  'DNAJC14': '8.44',
  'DNAJC15': '8.66',
  'DNAJC30': '7.34',
  'DNAJC9': '7.62'},
 '0h_P2_T1_TimeC2_PIDC2_Survivor': {'DNAJB6 /// TMEM135': '9.26',
  'DNAJC14': '8.34',
  'DNAJC15': '8.63',
  'DNAJC30': '7.42',
  'DNAJC9': '7.19'},
 '0h_P3_T1_TimeC1_PIDC1_Survivor': {'DNAJB6 /// TMEM135': '9.07',
  'DNAJC14': '8.67',
  'DNAJC15': '8.91',
  'DNAJC30': '7.15',
  'DNAJC9': '7.22'},
 '0h_P4_T1_TimeC1_PIDC1_Survivor': {'DNAJB6 /// TMEM135': '8.56',
  'DNAJC14': '8.63',
  'DNAJC15': '9.29',
  'DNAJC30': '7.46',
  'DNAJC9': '7.16'},
 '0h_P5_T1_TimeC4_PIDC3_Survivor': {'DNAJB6 /// TMEM135': '9.42',
  'DNAJC14': '8.32',
  'DNAJC15': '8.63',
  'DNAJC30': '7.29',
  'DNAJC9': '7.29'},
 '12h_P1_T4_TimeC2_PIDC4_Non-Survivor': {'DNAJB6 /// TMEM135': '8.58',
  'DNAJC14': '8.64',
  'DNAJC15': '8.98',
  'DNAJC30': '7.2',
  'DNAJC9': '7.23'},
 '12h_P2_T4_TimeC3_PIDC2_Survivor': {'DNAJB6 /// TMEM135': '8.94',
  'DNAJC14': '8.38',
  'DNAJC15': '8.03',
  'DNAJC30': '7.32',
  'DNAJC9': '7.26'},
 '12h_P3_T4_TimeC2_PIDC1_Survivor': {'DNAJB6 /// TMEM135': '9.27',
  'DNAJC14': '8.57',
  'DNAJC15': '8.27',
  'DNAJC30': '7.32',
  'DNAJC9': '7.39'},
 '12h_P4_T4_TimeC2_PIDC2_Survivor': {'DNAJB6 /// TMEM135': '8.5',
  'DNAJC14': '8.25',
  'DNAJC15': '8.47',
  'DNAJC30': '6.98',
  'DNAJC9': '7.12'},
 '12h_P5_T4_TimeC2_PIDC3_Survivor': {'DNAJB6 /// TMEM135': '9.18',
  'DNAJC14': '8.25',
  'DNAJC15': '8.66',
  'DNAJC30': '7.38',
  'DNAJC9': '7.6'},
 '24h_P1_T5_TimeC4_PIDC4_Non-Survivor': {'DNAJB6 /// TMEM135': '8.13',
  'DNAJC14': '8.43',
  'DNAJC15': '8.33',
  'DNAJC30': '7.41',
  'DNAJC9': '6.68'},
 '24h_P2_T5_TimeC3_PIDC2_Survivor': {'DNAJB6 /// TMEM135': '8.85',
  'DNAJC14': '8.54',
  'DNAJC15': '8.73',
  'DNAJC30': '7.26',
  'DNAJC9': '7.49'},
 '24h_P3_T5_TimeC3_PIDC1_Survivor': {'DNAJB6 /// TMEM135': '8.99',
  'DNAJC14': '8.42',
  'DNAJC15': '8.92',
  'DNAJC30': '7.25',
  'DNAJC9': '7.27'},
 '24h_P4_T5_TimeC3_PIDC2_Survivor': {'DNAJB6 /// TMEM135': '9.26',
  'DNAJC14': '8.6',
  'DNAJC15': '7.62',
  'DNAJC30': '6.93',
  'DNAJC9': '7.3'},
 '24h_P5_T5_TimeC3_PIDC3_Survivor': {'DNAJB6 /// TMEM135': '9.31',
  'DNAJC14': '8.14',
  'DNAJC15': '8.11',
  'DNAJC30': '7.52',
  'DNAJC9': '7.64'},
 '48h_P1_T6_TimeC3_PIDC1_Non-Survivor': {'DNAJB6 /// TMEM135': '9.05',
  'DNAJC14': '8.27',
  'DNAJC15': '7.63',
  'DNAJC30': '7.46',
  'DNAJC9': '7.42'},
 '48h_P2_T6_TimeC3_PIDC3_Survivor': {'DNAJB6 /// TMEM135': '8.57',
  'DNAJC14': '8.23',
  'DNAJC15': '8.6',
  'DNAJC30': '7.45',
  'DNAJC9': '7.62'},
 '48h_P3_T6_TimeC3_PIDC1_Survivor': {'DNAJB6 /// TMEM135': '9.23',
  'DNAJC14': '8.65',
  'DNAJC15': '7.71',
  'DNAJC30': '6.77',
  'DNAJC9': '7.26'},
 '48h_P4_T6_TimeC3_PIDC2_Survivor': {'DNAJB6 /// TMEM135': '8.99',
  'DNAJC14': '8.7',
  'DNAJC15': '7.99',
  'DNAJC30': '7.28',
  'DNAJC9': '7.5'},
 '48h_P5_T6_TimeC3_PIDC3_Survivor': {'DNAJB6 /// TMEM135': '8.78',
  'DNAJC14': '8.21',
  'DNAJC15': '8.02',
  'DNAJC30': '7.56',
  'DNAJC9': '7.69'},
 '4h_P1_T2_TimeC1_PIDC4_Non-Survivor': {'DNAJB6 /// TMEM135': '8.25',
  'DNAJC14': '8.69',
  'DNAJC15': '8.78',
  'DNAJC30': '7.53',
  'DNAJC9': '7.29'},
 '4h_P2_T2_TimeC2_PIDC1_Survivor': {'DNAJB6 /// TMEM135': '9.49',
  'DNAJC14': '8.47',
  'DNAJC15': '8.7',
  'DNAJC30': '7.41',
  'DNAJC9': '7.23'},
 '4h_P3_T2_TimeC2_PIDC1_Survivor': {'DNAJB6 /// TMEM135': '9.87',
  'DNAJC14': '8.38',
  'DNAJC15': '8.03',
  'DNAJC30': '7.29',
  'DNAJC9': '7.57'},
 '4h_P5_T2_TimeC2_PIDC3_Survivor': {'DNAJB6 /// TMEM135': '9.2',
  'DNAJC14': '8.1',
  'DNAJC15': '7.9',
  'DNAJC30': '7.47',
  'DNAJC9': '7.62'},
 '8h_P1_T3_TimeC4_PIDC4_Non-Survivor': {'DNAJB6 /// TMEM135': '8.49',
  'DNAJC14': '8.58',
  'DNAJC15': '8.22',
  'DNAJC30': '7.29',
  'DNAJC9': '7.13'},
 '8h_P2_T3_TimeC2_PIDC2_Survivor': {'DNAJB6 /// TMEM135': '9.16',
  'DNAJC14': '8.13',
  'DNAJC15': '7.88',
  'DNAJC30': '7.58',
  'DNAJC9': '7.18'},
 '8h_P3_T3_TimeC4_PIDC1_Survivor': {'DNAJB6 /// TMEM135': '8.52',
  'DNAJC14': '8.44',
  'DNAJC15': '9.23',
  'DNAJC30': '7.38',
  'DNAJC9': '7.2'},
 '8h_P4_T3_TimeC4_PIDC1_Survivor': {'DNAJB6 /// TMEM135': '9.28',
  'DNAJC14': '8.53',
  'DNAJC15': '8.22',
  'DNAJC30': '7.32',
  'DNAJC9': '6.84'},
 '8h_P5_T3_TimeC4_PIDC3_Survivor': {'DNAJB6 /// TMEM135': '9.29',
  'DNAJC14': '8.41',
  'DNAJC15': '9.08',
  'DNAJC30': '7.28',
  'DNAJC9': '7.69'}}
time-series plot visualization plotly • 491 views
ADD COMMENT

Login before adding your answer.

Traffic: 2053 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6