Я пишу сценарий для создания коробчатых диаграмм из некоторых данных RNA-Seq.
Псевдокод
1. Select a row based on gene name
2. make a column for each type of cell
3. make box plot
У меня 1 и 3 вниз
df2 = df[df[0].str.match("TCAP")]
????
import plotly.express as px
fig = px.box(df,x="CellType",y = "Expression",title = "GENE")
fig.show()
Код должен преобразовать следующие таблицы
Gene Celltype-1_#1 Celltype-1_#2 Celltype-1_#3 Celltype-2_#1 Celltype-2_#2 Celltype-2_#3
A 1 1 1 3 3 3
B 5 5 5 4 4 4
к этому Используя: df2 = df [df [0] .str.match ("TCAP")]
Gene Celltype-1_#1 Celltype-1_#2 Celltype-1_#3 Celltype-2_#1 Celltype-2_#2 Celltype-2_#3
A 1 1 1 3 3 3
Затем мне нужен код, чтобы сделать это в этом
Gene CellType Expression
A 1 1
A 1 1
A 1 1
A 2 3
A 2 3
A 2 3