This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Limma: how can I maintain molecule names in the matrix?

Hi all,

I am pretty new at bioinformatics and I am dealing with some proteins in Limma to see if they are differentially expressed. However, the matrix requires all data are numerical. So in my inexperience to deal with this issue I delete the column with the IDs of my proteins. So my question is:

How can I work in order to not delete protein IDs and see them when I execute the TopTable function??

<h5>EDIT</h5>

Originally I have this data frame (with much more data), I used the same data to illustrate the replicates:

C_IgG

         Entry    IgG      C   IgG2     C2
    A0A068BFR3   1.15   1.44   1.15   1.44
    A0A068BIS1   0.07   0.14   0.07   0.14
    A0A075B5M7   0.33   0.77   0.33   0.77
    A0A075B5P4   0.42   0.30   0.42   0.30
    A0A075DC90   1.61   1.61   1.61   1.61
    A0A087WNT1   1.25   0.50   1.25   0.50
    A0A087WPF9   0.11   0.38   0.11   0.38
    A0A087WQA5   0.15   0.50   0.15   0.50
    A0A087WRE7   0.14   0.14   0.14   0.14
    A0A087WS46   0.17   0.36   0.17   0.36

Then, I delete the Entries to avoid future errors. So, I delete the first column. and I transform it to a matrix.

C_IgG <- C_IgG[, c(2,3,4,5)]
C_IgG <- as.matrix(C_IgG)

And after this, I have my matrix with only values. So I define my condition to study if they are differentially expressed

Condition <- c("IgG", "C", "IgG", "C")
design <- model.matrix(~ Condition)
cont_matrix <- makeContrasts(IgGvsC = C-IgG, levels = Condition) #Specify what to compare
fit_C01 <- lmFit(C_IgG, design) #Fit the matrix to a linear model
fit_C02 <- eBayes(fit_C01)

With this instructions I can create my TopTable to see what proteins have been differentially expressed between the two conditions. However, I would like to maintain the column "Entry". But, if I maintain it, I cannot proceed

After this I execute for my TopTable function, and I obtain it but without the Entry column because I deleted before. Instead, I have the raw number.

toptable(fit_C02)

     logFC            t      P.Value    adj.P.Val        B
82   18.38 3.048660e+19 1.942123e-46 2.044716e-43 95.06032
878  12.70 2.106528e+19 4.632481e-46 2.044716e-43 95.03053
691  10.83 1.796354e+19 6.737350e-46 2.044716e-43 95.00948
1050  9.49 1.574090e+19 9.191462e-46 2.044716e-43 94.98644
874   9.32 1.545893e+19 9.590598e-46 2.044716e-43 94.98282
647   8.33 1.381683e+19 1.248928e-45 2.218929e-43 94.95734
259   7.50 1.244012e+19 1.598579e-45 2.434407e-43 94.92824
317   6.72 1.114635e+19 2.069610e-45 2.757756e-43 94.89122
126   4.94 8.193895e+18 4.267441e-45 4.570821e-43 94.74033
1026  4.93 8.177308e+18 4.287825e-45 4.570821e-43 94.73905

Thanks!

r limma differential expression

It would be very useful if you provide your original matrix, what you want, what you did, and your results giving rise to what errors instead of describing all the problems in words

You're asking for clarification, not answering the question. Please use Add Comment for this purpose. Add an answer only when you're answering the top level question. I'm moving your post to a comment, but please be more careful in the future.

Thanks! It was my first time, I am sorry

You should have either edited your question and added the new content in there, or added it as a comment-reply to the person that asked you the question. Adding an answer should only be done when you're answering the top level question.

I'm moving the content you added to your top-level post and deleting your "answer" below.

2 answers

Forgive me for jumping in, but I think that you just need to set the rownames of your C_IgG object.

rownames(C_IgG) <- C_IgG$Entry

Then, proceed to:

C_IgG <- C_IgG[, c(2,3,4,5)]
C_IgG <- as.matrix(C_IgG)

Kevin

Thanks a lot!! It solved my problem!!!

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one answer if they all work.

Upvote|Bookmark|Accept

Originally I have this data frame (with much more data), I used the same data to illustrate the replicates:

C_IgG

         Entry    IgG      C   IgG2     C2
    A0A068BFR3   1.15   1.44   1.15   1.44
    A0A068BIS1   0.07   0.14   0.07   0.14
    A0A075B5M7   0.33   0.77   0.33   0.77
    A0A075B5P4   0.42   0.30   0.42   0.30
    A0A075DC90   1.61   1.61   1.61   1.61
    A0A087WNT1   1.25   0.50   1.25   0.50
    A0A087WPF9   0.11   0.38   0.11   0.38
    A0A087WQA5   0.15   0.50   0.15   0.50
    A0A087WRE7   0.14   0.14   0.14   0.14
    A0A087WS46   0.17   0.36   0.17   0.36

Then, I delete the Entries to avoid future errors. So, I delete the first column. and I transform it to a matrix.

C_IgG <- C_IgG[, c(2,3,4,5)]
C_IgG <- as.matrix(C_IgG)

And after this, I have my matrix with only values. So I define my condition to study if they are differentially expressed

Condition <- c("IgG", "C", "IgG", "C")

design <- model.matrix(~ Condition)

cont_matrix <- makeContrasts(IgGvsC = C-IgG, levels = Condition) #Specify what to compare

fit_C01 <- lmFit(C_IgG, design) #Fit the matrix to a linear model

fit_C02 <- eBayes(fit_C01)

With this instructions I can create my TopTable to see what proteins have been differentially expressed between the two conditions. However, I would like to maintain the column "Entry". But, if I maintain it, I cannot proceed

After this I execute for my TopTable function, and I obtain it but without the Entry column because I deleted before. Instead, I have the raw number.

toptable(fit_C02)

     logFC            t      P.Value    adj.P.Val        B
82   18.38 3.048660e+19 1.942123e-46 2.044716e-43 95.06032
878  12.70 2.106528e+19 4.632481e-46 2.044716e-43 95.03053
691  10.83 1.796354e+19 6.737350e-46 2.044716e-43 95.00948
1050  9.49 1.574090e+19 9.191462e-46 2.044716e-43 94.98644
874   9.32 1.545893e+19 9.590598e-46 2.044716e-43 94.98282
647   8.33 1.381683e+19 1.248928e-45 2.218929e-43 94.95734
259   7.50 1.244012e+19 1.598579e-45 2.434407e-43 94.92824
317   6.72 1.114635e+19 2.069610e-45 2.757756e-43 94.89122
126   4.94 8.193895e+18 4.267441e-45 4.570821e-43 94.74033
1026  4.93 8.177308e+18 4.287825e-45 4.570821e-43 94.73905

Thanks!!

Log in to answer this question.