Skip to content

Coef Bug and EdgeR Design Inquiries #107

Description

@Marwansha

Hi,

thanks for developing such useful tool.

i have some questions regarding the edgeR pipline as am not very familiar with it and it will be very helpful if you can answer my 4 rather naive questions

i have this design CMV+AGE+Batch+sex and i have some specific Questions

Testing Covariates:

1)How do I specify which covariates to test in glmLRT(fit,)? Attempting glmLRT(fit, coef="AGE") results in an error., same error for any of the covarites put in coef="" , the error dont rise if i use the index number glmLRT(fit, coef=[2]), or not indicating any.

  1. based on what we put the group_col in DGEList , ** for my design am not sure what should i put as group_col?**

in the description it says "group_col : str the name of the column containing the group information in :code:samples.
only used if :code:group is not :code:None"

  1. does the processing steps include a similar function to calcNormFactors? or its not necessary for edgeR?

example code and error below



                design = dmatrix("~CMV+AGE+Batch+sex", data=anno,)
                dge_list = DGEList(counts=counts, samples=anno, group_col="sex", genes=mono.var)
                dge_list.estimateGLMCommonDisp(design=design)

                print(design)
                fit = dge_list.glmFit(design=design)
                lrt = glmLRT(fit)
               glmLRT(fit,coef="AGE")

 specifying a coef. it  give an error saying  
ValueError                                Traceback (most recent call last)
Cell In[286], line 1
----> 1 glmLRT(fit,coef="AGE")

File [~/venvs/CODA/lib/python3.9/site-packages/inmoose/edgepy/glmFit.py:454](https://rstudio.pasteur.fr/s/01e0021f2ed724eb5240a/lab/workspaces/auto-n/tree/appa/homes/~/venvs/CODA/lib/python3.9/site-packages/inmoose/edgepy/glmFit.py#line=453), in glmLRT(glmfit, coef, contrast)
    452 tab["pvalue"] = LRT_pvalue
    453 tab.index = glmfit.counts.index
--> 454 res = DGELRT(tab, glmfit)
    455 res.comparison = coef_name
    456 res.df_test = df_test

File [~/venvs/CODA/lib/python3.9/site-packages/inmoose/edgepy/DGELRT.py:41](https://rstudio.pasteur.fr/s/01e0021f2ed724eb5240a/lab/workspaces/auto-n/tree/appa/homes/~/venvs/CODA/lib/python3.9/site-packages/inmoose/edgepy/DGELRT.py#line=40), in DGELRT.__init__(self, df, glmfit, *args, **kwargs)
     40 def __init__(self, df, glmfit, *args, **kwargs):
---> 41     super().__init__(df, *args, **kwargs)
     42     self.fit = glmfit

File [~/venvs/CODA/lib/python3.9/site-packages/inmoose/diffexp/DEResults.py:45](https://rstudio.pasteur.fr/s/01e0021f2ed724eb5240a/lab/workspaces/auto-n/tree/appa/homes/~/venvs/CODA/lib/python3.9/site-packages/inmoose/diffexp/DEResults.py#line=44), in DEResults.__init__(self, df, *args, **kwargs)
     43 for col in ["log2FoldChange", "lfcSE", "pvalue"]:
     44     if col not in self.columns:
---> 45         raise ValueError(f"{col} missing from results table")

ValueError: log2FoldChange missing from results table

4 ) the tutorial only mentions estimating common dispersion. However, edgeR documentation recommends estimating tagwise dispersion as well. so what i did is estimate GLMCommonDisp followed by estimateGLMTagwiseDisp?
and then feed the tagwise dispersion into the fit function as below . is this correct?

fit = dge_list.glmFit(design=design, dispersion=dge_list.tagwise_dispersion)

fit.design
DesignMatrix with shape (287, 5)
  Intercept  CMV[T.Positive]  Batch[T.batch2]  sex[T.male]  AGE
          1                0                1            1   31
          1                0                0            1   37
          1                0                0            1   36
          1                1                1            1   35
          1                0                1            1   36
          1                1                0            1   37
          1                1                1            1   37
          1                0                1            0   31
          1                0                0            0   41
          1                0                0            0   48
          1                0                1            0   47
          1                1                0            0   47
          1                0                1            0   47
          1                1                1            0   43
          1                0                0            0   42
          1                0                1            0   41
          1                0                1            0   46
          1                0                1            0   40
          1                0                0            0   39
          1                0                0            0   44
          1                0                0            0   45
          1                1                0            0   41
          1                0                1            0   41
          1                0                0            0   39
          1                0                1            0   42
          1                0                1            0   41
          1                0                1            0   47
          1                1                0            0   49
          1                0                1            0   40
          1                0                1            0   40
  [257 rows omitted]
  Terms:
    'Intercept' (column 0)
    'CMV' (column 1)
    'Batch' (column 2)
    'sex' (column 3)
    'AGE' (column 4)
  (to view full data, use np.asarray(this_obj)
    'sex' (column 3)
    'AGE' (column 4)
  (to view full data, use np.asarray(this_obj))

thanks alot for your help

Marwan

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions