0
$\begingroup$

I have two data sets

  1. Mutations in 10 genes
  2. Gene expression in 18 cancer 3D models

For every (mutation, gene) and gene expression pair we run an ANOVA test

This is my data


> mut=read.delim("mut.tsv",row.names = 1)
> expr=as.data.frame(t(read.delim("expr.tsv",row.names = 1)))

dput(expr)

structure(list(GeneA_KO = c(0.0756383119639074, -0.162841965682723, 
-0.110703100204517, -0.457154616239399, -0.505815193885352, 0.366072775033448, 
0.288650458935083, -0.0287646498640309, -0.690732824311905, 0.157366122620995, 
-1.29451546737684, 0.124167425460344, -0.168045313861751, 0.0186504943306465, 
-0.495880827400706, -0.206668627339351, -0.148609490335447, 0.066844529089804
), GeneB_KO = c(-0.870157285953621, -0.35900872537626, -0.990406888128838, 
-0.120656981579292, -1.41427631791049, -0.866421095836781, -0.816936112146099, 
-0.894597236248507, -1.00084584207823, -0.850754488133456, -1.05314239761653, 
-1.07580675428372, -1.24708324665688, -1.04098460460899, -0.232388675985086, 
-1.48513703581865, -1.48373348870346, -1.76484058374354), class = "data.frame", row.names = c("ModelM", 
"ModelO", "ModelS", "ModelA", "ModelI", "ModelC", "ModelT", "ModelH", 
"ModelE", "ModelR", "ModelA2", "ModelP", "ModelE2", "ModelU", 
"ModelT2", "ModelC2", "ModelS2", "ModelX"))

dput(mut)

structure(list(ModelM = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 
0L), ModelO = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelS = c(0L, 
0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelA = c(0L, 0L, 0L, 1L, 
0L, 0L, 0L, 0L, 0L, 0L), ModelI = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 
0L, 0L, 0L), ModelC = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L
), ModelT = c(0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L), ModelH = c(1L, 
1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L), ModelE = c(1L, 0L, 0L, 0L, 
1L, 0L, 0L, 0L, 0L, 1L), ModelR = c(1L, 0L, 0L, 1L, 0L, 0L, 1L, 
0L, 1L, 0L), ModelA2 = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 
0L), ModelP = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L), ModelE2 = c(1L, 
0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L), ModelU = c(1L, 0L, 1L, 1L, 
0L, 1L, 0L, 1L, 1L, 1L), ModelT2 = c(0L, 0L, 0L, 1L, 0L, 0L, 
0L, 0L, 0L, 0L), ModelI2 = c(1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 
0L, 0L), ModelC2 = c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L), 
    ModelS2 = c(0L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 0L, 1L)), class = "data.frame", row.names = c("Gene1_mut", 
"Gene2_mut", "Gene3_mut", "Gene4_mut", "Gene5_mut", "Gene6_mut", 
"Gene7_mut", "Gene8_mut", "Gene9_mut", "Gene10_mut"))

To test this, for the first 3D cancer model as instance, I have done like below

           GeneA_KO   GeneB_KO
ModelM   0.07563831 -0.8701573
ModelO  -0.16284197 -0.3590087
ModelS  -0.11070310 -0.9904069
ModelA  -0.45715462 -0.1206570
ModelI  -0.50581519 -1.4142763
ModelC   0.36607278 -0.8664211
ModelT   0.28865046 -0.8169361
ModelH  -0.02876465 -0.8945972
ModelE  -0.69073282 -1.0008458
ModelR   0.15736612 -0.8507545
ModelA2 -1.29451547 -1.0531424
ModelP   0.12416743 -1.0758068
ModelE2 -0.16804531 -1.2470832
ModelU   0.01865049 -1.0409846
ModelT2 -0.49588083 -0.2323887
ModelC2 -0.20666863 -1.4851370
ModelS2 -0.14860949 -1.4837335
ModelX   0.06684453 -1.7648406
           ModelM ModelO ModelS ModelA ModelI ModelC ModelT ModelH ModelE
Gene1_mut       0      0      0      0      0      0      0      1      1
Gene2_mut       0      0      0      0      0      0      0      1      0
Gene3_mut       0      0      0      0      0      0      0      1      0
Gene4_mut       1      1      1      1      1      1      1      1      0
Gene5_mut       0      0      0      0      0      0      0      0      1
Gene6_mut       0      0      0      0      0      0      1      1      0
Gene7_mut       0      0      0      0      0      0      0      1      0
Gene8_mut       0      0      0      0      0      0      1      1      0
Gene9_mut       0      0      0      0      0      0      1      0      0
Gene10_mut      0      0      0      0      0      0      0      0      1
           ModelR ModelA2 ModelP ModelE2 ModelU ModelT2 ModelI2 ModelC2 ModelS2
Gene1_mut       1       0      0       1      1       0       1       1       0
Gene2_mut       0       0      0       0      0       0       0       1       1
Gene3_mut       0       0      0       0      1       0       0       0       0
Gene4_mut       1       1      1       1      1       1       1       0       1
Gene5_mut       0       0      0       0      0       0       0       0       1
Gene6_mut       0       0      0       1      1       0       0       1       1
Gene7_mut       1       0      0       0      0       0       0       0       1
Gene8_mut       0       0      0       0      1       0       0       1       0
Gene9_mut       1       0      0       0      1       0       0       0       0
Gene10_mut      0       0      1       0      1       0       0       0       1
> my_data=cbind(mut[,1],expr[,1])
> colnames(my_data)=c("mut","expr")
> res.aov <- aov(expr ~ mut, data = as.data.frame(my_data))
> # Summary of the analysis
> summary(res.aov)
            Df Sum Sq Mean Sq F value Pr(>F)
mut          1  0.145  0.1448   0.192  0.673
Residuals    8  6.022  0.7527

Now I do a for loop for all of the 18 cancer cell lines

> for(i in 1:ncol(g))
+ {
+   my_data=as.data.frame(cbind(m[,1],g[,1]))
+   #tidy will summarise and return neat format
+   print(broom::tidy(aov(my_data[,2] ~ my_data[,1], data = my_data)))
+ }
# A tibble: 2 × 6
  term            df sumsq meansq statistic p.value
  <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
1 my_data[, 1]     1 0.145  0.145     0.192   0.673
2 Residuals        8 6.02   0.753    NA      NA    
# A tibble: 2 × 6
  term            df sumsq meansq statistic p.value
  <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
1 my_data[, 1]     1 0.145  0.145     0.192   0.673
2 Residuals        8 6.02   0.753    NA      NA   

I done this in R but of course I got when doing in Python

Python

import os
import pandas as pd
from statsmodels.formula.api import ols
import statsmodels.api as sm
os.getcwd()
os.chdir("/Users//Downloads/test")
os.getcwd()
m = pd.read_csv("mut.tsv", sep="\t", index_col=0,delim_whitespace=True)
m=pd.DataFrame(m)
m
g = pd.read_csv("expr.tsv", sep="\t",index_col=0,delim_whitespace=True).T
g=pd.DataFrame(g)
g
lst = list(g.columns)

lst
dfs = []
for Model in lst:
   dfs.append(pd.concat([m.iloc[:, 0].reset_index(drop=True), g.iloc[0,:].reset_index(drop=True)],axis=1))
   dfs.append(df.dropna())
   dfs.append(df.columns==['mut','expr'])
   model = ols('expr ~ C(mut)', data=df).fit()
   aov_table = sm.stats.anova_lm(model, typ=2)
   aov_table
   final = pd.concat(dfs, ignore_index=True)
    for Model in lst:
      Input In [165]
        for Model in lst:
                         ^
    IndentationError: expected an indented block

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ When asking about errors, please remember to always include the actual error. We cannot help you debug errors you don't share. $\endgroup$
    – terdon
    Commented Sep 18, 2023 at 12:00
  • $\begingroup$ thank you, I have added the error in my main post $\endgroup$
    – Zizogolu
    Commented Sep 18, 2023 at 13:33
  • 1
    $\begingroup$ @Angel, you still did not include the error that you get when you are using R. Anyway, why would you define i in your loop and not use it? And when it comes to the Python error, it is obvious! $\endgroup$
    – haci
    Commented Sep 18, 2023 at 13:51
  • $\begingroup$ Thank you @haci I get error in Python part only. The R code is OK $\endgroup$
    – Zizogolu
    Commented Sep 18, 2023 at 13:54
  • $\begingroup$ Thanks I have edited my post so I believe the R code will run smoothly. I have added the desire output from R code to the post. First, I have tried for one sample then using a for loop to doing one-way ANOVA over 18 samples. But, I do not know how to do this by Python $\endgroup$
    – Zizogolu
    Commented Sep 19, 2023 at 0:00

1 Answer 1

4
$\begingroup$

Here is one potential approach:

Example data:

expr1 <- structure(list(GeneA_KO = c(0.0756383119639074, -0.162841965682723, -0.110703100204517, -0.457154616239399, -0.505815193885352, 0.366072775033448, 0.288650458935083, -0.0287646498640309, -0.690732824311905, 0.157366122620995, -1.29451546737684, 0.124167425460344, -0.168045313861751, 0.0186504943306465, -0.495880827400706, -0.206668627339351, -0.148609490335447, 0.066844529089804), GeneB_KO = c(-0.870157285953621, -0.35900872537626, -0.990406888128838, -0.120656981579292, -1.41427631791049, -0.866421095836781, -0.816936112146099, -0.894597236248507, -1.00084584207823, -0.850754488133456, -1.05314239761653, -1.07580675428372, -1.24708324665688, -1.04098460460899, -0.232388675985086, -1.48513703581865, -1.48373348870346, -1.76484058374354)), class = "data.frame", row.names = c("ModelM", "ModelO", "ModelS", "ModelA", "ModelI", "ModelC", "ModelT", "ModelH", "ModelE", "ModelR", "ModelA2", "ModelP", "ModelE2", "ModelU", "ModelT2", "ModelC2", "ModelS2", "ModelX"))
mut <- structure(list(ModelM = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelO = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelS = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelA = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelI = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelC = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelT = c(0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L), ModelH = c(1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L), ModelE = c(1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L), ModelR = c(1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 0L), ModelA2 = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelP = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L), ModelE2 = c(1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L), ModelU = c(1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L), ModelT2 = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelI2 = c(1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L), ModelC2 = c(1L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L),     ModelS2 = c(0L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 0L, 1L)), class = "data.frame", row.names = c("Gene1_mut", "Gene2_mut", "Gene3_mut", "Gene4_mut", "Gene5_mut", "Gene6_mut", "Gene7_mut", "Gene8_mut", "Gene9_mut", "Gene10_mut"))

R code:

my_data=cbind(mut[,1],expr1[1:10,1])
colnames(my_data)=c("mut","expr1")
res.aov <- aov(expr1 ~ mut, data = as.data.frame(my_data))
summary(res.aov)
#>             Df Sum Sq Mean Sq F value Pr(>F)
#> mut          1 0.1364  0.1364   1.114  0.322
#> Residuals    8 0.9789  0.1224

for (j in 1:nrow(mut)) {
  for(i in 1:ncol(expr1)) {
    my_data=as.data.frame(cbind(mut[,j],expr1[1:10,i]))
    print(broom::tidy(aov(my_data[,2] ~ my_data[,1], data = my_data)))
  }
}
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.136  0.136      1.11   0.322
#> 2 Residuals        8 0.979  0.122     NA     NA    
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.541 0.541       7.38  0.0264
#> 2 Residuals        8 0.587 0.0733     NA    NA     
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.136  0.136      1.11   0.322
#> 2 Residuals        8 0.979  0.122     NA     NA    
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.541 0.541       7.38  0.0264
#> 2 Residuals        8 0.587 0.0733     NA    NA     
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.136  0.136      1.11   0.322
#> 2 Residuals        8 0.979  0.122     NA     NA    
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.541 0.541       7.38  0.0264
#> 2 Residuals        8 0.587 0.0733     NA    NA     
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.136  0.136      1.11   0.322
#> 2 Residuals        8 0.979  0.122     NA     NA    
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.541 0.541       7.38  0.0264
#> 2 Residuals        8 0.587 0.0733     NA    NA     
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.136  0.136      1.11   0.322
#> 2 Residuals        8 0.979  0.122     NA     NA    
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.541 0.541       7.38  0.0264
#> 2 Residuals        8 0.587 0.0733     NA    NA     
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.136  0.136      1.11   0.322
#> 2 Residuals        8 0.979  0.122     NA     NA    
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.541 0.541       7.38  0.0264
#> 2 Residuals        8 0.587 0.0733     NA    NA     
#> # A tibble: 2 × 6
#>   term            df  sumsq meansq statistic p.value
#>   <chr>        <dbl>  <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.0612 0.0612     0.465   0.515
#> 2 Residuals        8 1.05   0.132     NA      NA    
#> # A tibble: 2 × 6
#>   term            df  sumsq meansq statistic p.value
#>   <chr>        <dbl>  <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.0637 0.0637     0.479   0.508
#> 2 Residuals        8 1.06   0.133     NA      NA    
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.246  0.246      2.26   0.171
#> 2 Residuals        8 0.869  0.109     NA     NA    
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.313  0.313      3.07   0.118
#> 2 Residuals        8 0.815  0.102     NA     NA    
#> # A tibble: 2 × 6
#>   term            df   sumsq  meansq statistic p.value
#>   <chr>        <dbl>   <dbl>   <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.00108 0.00108   0.00777   0.932
#> 2 Residuals        8 1.11    0.139    NA        NA    
#> # A tibble: 2 × 6
#>   term            df sumsq meansq statistic p.value
#>   <chr>        <dbl> <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.220  0.220      1.94   0.201
#> 2 Residuals        8 0.907  0.113     NA     NA    
#> # A tibble: 2 × 6
#>   term            df  sumsq meansq statistic p.value
#>   <chr>        <dbl>  <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.0529 0.0529     0.398   0.546
#> 2 Residuals        8 1.06   0.133     NA      NA    
#> # A tibble: 2 × 6
#>   term            df  sumsq meansq statistic p.value
#>   <chr>        <dbl>  <dbl>  <dbl>     <dbl>   <dbl>
#> 1 my_data[, 1]     1 0.0901 0.0901     0.695   0.429
#> 2 Residuals        8 1.04   0.130     NA      NA

# write.csv(mut, "mut.csv", quote = FALSE, row.names = FALSE)
# write.csv(expr1[1:10,], "expr1.csv", quote = FALSE, row.names = FALSE)

Created on 2023-09-19 with reprex v2.0.2


Python code:

import os
import pandas as pd
from statsmodels.formula.api import ols
import statsmodels.api as sm
m = pd.read_csv("mut.csv", sep=",")
m=pd.DataFrame(m)
m.info()
g = pd.read_csv("expr1.csv", sep=",")
g=pd.DataFrame(g)

lst = list(g.columns)
m_lst = list(m.columns)

dfs = pd.DataFrame({})
for Mut in m_lst:
    for Model in lst:
        df = pd.concat([m[[Mut]].reset_index(drop=True), g[[Model]].reset_index(drop=True)],axis=1)
        df = df.rename(columns={Mut: "mut", Model: "g"})
        model = ols('g ~ C(mut)', data=df).fit()
        aov_table = sm.stats.anova_lm(model, typ=2)
        aov_table[['Model']] = Model
        aov_table[['Mut']] = Mut
        dfs = dfs.append(aov_table)

with pd.option_context('display.max_rows', None, 'display.max_columns', None):
    print(dfs)
            sum_sq   df         F    PR(>F)     Model      Mut
C(mut)    0.136365  1.0  1.114460  0.321950  GeneA_KO   ModelM
Residual  0.978877  8.0       NaN       NaN  GeneA_KO   ModelM
C(mut)    0.540949  1.0  7.375925  0.026417  GeneB_KO   ModelM
Residual  0.586718  8.0       NaN       NaN  GeneB_KO   ModelM
C(mut)    0.136365  1.0  1.114460  0.321950  GeneA_KO   ModelO
Residual  0.978877  8.0       NaN       NaN  GeneA_KO   ModelO
C(mut)    0.540949  1.0  7.375925  0.026417  GeneB_KO   ModelO
Residual  0.586718  8.0       NaN       NaN  GeneB_KO   ModelO
C(mut)    0.136365  1.0  1.114460  0.321950  GeneA_KO   ModelS
Residual  0.978877  8.0       NaN       NaN  GeneA_KO   ModelS
C(mut)    0.540949  1.0  7.375925  0.026417  GeneB_KO   ModelS
Residual  0.586718  8.0       NaN       NaN  GeneB_KO   ModelS
C(mut)    0.136365  1.0  1.114460  0.321950  GeneA_KO   ModelA
Residual  0.978877  8.0       NaN       NaN  GeneA_KO   ModelA
C(mut)    0.540949  1.0  7.375925  0.026417  GeneB_KO   ModelA
Residual  0.586718  8.0       NaN       NaN  GeneB_KO   ModelA
C(mut)    0.136365  1.0  1.114460  0.321950  GeneA_KO   ModelI
Residual  0.978877  8.0       NaN       NaN  GeneA_KO   ModelI
C(mut)    0.540949  1.0  7.375925  0.026417  GeneB_KO   ModelI
Residual  0.586718  8.0       NaN       NaN  GeneB_KO   ModelI
C(mut)    0.136365  1.0  1.114460  0.321950  GeneA_KO   ModelC
Residual  0.978877  8.0       NaN       NaN  GeneA_KO   ModelC
C(mut)    0.540949  1.0  7.375925  0.026417  GeneB_KO   ModelC
Residual  0.586718  8.0       NaN       NaN  GeneB_KO   ModelC
C(mut)    0.061205  1.0  0.464539  0.514753  GeneA_KO   ModelT
Residual  1.054037  8.0       NaN       NaN  GeneA_KO   ModelT
C(mut)    0.063734  1.0  0.479234  0.508361  GeneB_KO   ModelT
Residual  1.063933  8.0       NaN       NaN  GeneB_KO   ModelT
C(mut)    0.245964  1.0  2.263619  0.170857  GeneA_KO   ModelH
Residual  0.869278  8.0       NaN       NaN  GeneA_KO   ModelH
C(mut)    0.312937  1.0  3.072788  0.117706  GeneB_KO   ModelH
Residual  0.814730  8.0       NaN       NaN  GeneB_KO   ModelH
C(mut)    0.001082  1.0  0.007771  0.931920  GeneA_KO   ModelE
Residual  1.114159  8.0       NaN       NaN  GeneA_KO   ModelE
C(mut)    0.220171  1.0  1.940909  0.201060  GeneB_KO   ModelE
Residual  0.907496  8.0       NaN       NaN  GeneB_KO   ModelE
C(mut)    0.052891  1.0  0.398296  0.545575  GeneA_KO   ModelR
Residual  1.062350  8.0       NaN       NaN  GeneA_KO   ModelR
C(mut)    0.090105  1.0  0.694741  0.428739  GeneB_KO   ModelR
Residual  1.037562  8.0       NaN       NaN  GeneB_KO   ModelR
C(mut)    0.136365  1.0  1.114460  0.321950  GeneA_KO  ModelA2
Residual  0.978877  8.0       NaN       NaN  GeneA_KO  ModelA2
C(mut)    0.540949  1.0  7.375925  0.026417  GeneB_KO  ModelA2
Residual  0.586718  8.0       NaN       NaN  GeneB_KO  ModelA2
C(mut)    0.004637  1.0  0.033399  0.859537  GeneA_KO   ModelP
Residual  1.110605  8.0       NaN       NaN  GeneA_KO   ModelP
C(mut)    0.276724  1.0  2.601573  0.145422  GeneB_KO   ModelP
Residual  0.850943  8.0       NaN       NaN  GeneB_KO   ModelP
C(mut)    0.044310  1.0  0.331000  0.580888  GeneA_KO  ModelE2
Residual  1.070932  8.0       NaN       NaN  GeneA_KO  ModelE2
C(mut)    0.170278  1.0  1.422852  0.267110  GeneB_KO  ModelE2
Residual  0.957389  8.0       NaN       NaN  GeneB_KO  ModelE2
C(mut)    0.001687  1.0  0.012120  0.915049  GeneA_KO   ModelU
Residual  1.113555  8.0       NaN       NaN  GeneA_KO   ModelU
C(mut)    0.008679  1.0  0.062048  0.809563  GeneB_KO   ModelU
Residual  1.118988  8.0       NaN       NaN  GeneB_KO   ModelU
C(mut)    0.136365  1.0  1.114460  0.321950  GeneA_KO  ModelT2
Residual  0.978877  8.0       NaN       NaN  GeneA_KO  ModelT2
C(mut)    0.540949  1.0  7.375925  0.026417  GeneB_KO  ModelT2
Residual  0.586718  8.0       NaN       NaN  GeneB_KO  ModelT2
C(mut)    0.017610  1.0  0.128353  0.729416  GeneA_KO  ModelI2
Residual  1.097631  8.0       NaN       NaN  GeneA_KO  ModelI2
C(mut)    0.260821  1.0  2.407079  0.159387  GeneB_KO  ModelI2
Residual  0.866846  8.0       NaN       NaN  GeneB_KO  ModelI2
C(mut)    0.191207  1.0  1.655405  0.234206  GeneA_KO  ModelC2
Residual  0.924035  8.0       NaN       NaN  GeneA_KO  ModelC2
C(mut)    0.033474  1.0  0.244741  0.634101  GeneB_KO  ModelC2
Residual  1.094193  8.0       NaN       NaN  GeneB_KO  ModelC2
C(mut)    0.044621  1.0  0.333425  0.579533  GeneA_KO  ModelS2
Residual  1.070620  8.0       NaN       NaN  GeneA_KO  ModelS2
C(mut)    0.096956  1.0  0.752533  0.410940  GeneB_KO  ModelS2
Residual  1.030711  8.0       NaN       NaN  GeneB_KO  ModelS2
```
$\endgroup$
9
  • $\begingroup$ Sorry I was running your python code but I get this error for Mut in m_lst: Input In [81] for Mut in m_lst: ^ IndentationError: expected an indented block $\endgroup$
    – Zizogolu
    Commented Sep 21, 2023 at 20:17
  • 3
    $\begingroup$ The IndentationError means you haven't got the correct whitespace - you need 4 spaces in front of each indented line @Angel and no whitespace in front of 'non-indented' lines (basically, copy it exactly as I have it in my answer and it will work) $\endgroup$ Commented Sep 22, 2023 at 0:04
  • $\begingroup$ Thanks a lot that's weird I just copied and pasted that but gives error $\endgroup$
    – Zizogolu
    Commented Sep 22, 2023 at 9:26
  • 2
    $\begingroup$ That error is harder to understand, sorry @Angel; I think you should post another question with a reproducible example showing how you got that error so we can figure out what the problem is. $\endgroup$ Commented Sep 22, 2023 at 21:58
  • 2
    $\begingroup$ Apparently the pd.option_context('display.max_rows', None, 'display.max_columns', None) approach doesn't work with jupyter notebooks; see stackoverflow.com/questions/16424493/… for more details @envs_h_gang_5 $\endgroup$ Commented Sep 26, 2023 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.