epigen / RnBeads

Git working Repo synced to the Bioconductor: http://bioconductor.org/packages/devel/bioc/html/RnBeads.html
https://rnbeads.org/
7 stars 8 forks source link

Update differentialMethylation.R #28

Closed ClarissaFeuersteinAkgoz closed 2 years ago

ClarissaFeuersteinAkgoz commented 2 years ago

I just tried to use the limmaP function as an isolated function, so I might have misunderstood the usage of the function, but: if I understand it correctly, you reorder the methylation matrix putting samples of group1 and then samples of group2. However the adtjustment.table was not ordered. Or is it ordered already somewhere else?

ClarissaFeuersteinAkgoz commented 2 years ago

I tested the results given from rnb.execute.computeDiffMeth and the results of the limmaP function including the suggested corrections and it gives the same results. That means that the reordering of the adjustment.table happens somewhere else right? so all right, was just a bit confused!

demuellae commented 2 years ago

Dear Clarissa, You were correct in the first place. This was a bug that we were not aware of. rnb.execute.computeDiffMeth just calls upon limmaP and that's why you get the same results. The issue should be fixed now. Please update your version of RnBeads to the latest one (2.12.1 (release) or 2.13.1 (development)). These versions are available on github and should come online on Bioconductor in the next few days. Thank you so much for spotting this!

Fabian

ClarissaFeuersteinAkgoz commented 2 years ago

Sorry, let me explain again, because I still think the old version was working correctly and now it will not work anymore. I did some debugging and I wanted to explain that when I print the adtjustment.table in the limma table, the samples are somehow already ordered correctly, so if you do the changes in the function, the covariates are not matching anymore. I run the differential with the new function and I think everything is messed up. Can you please also do the debugging and confirm this?

this is now the debugging with the old limma function, I printed the df and columnnames of the Mvalue matrix. and with my dataset the annotation fits to the columnnames.

    df <- cbind(df,adjustment.table)
    print(df)
    print(colnames(X.m))

however with the following change the sample annotation will not match anymore.

    df <- cbind(df,adjustment.table[ind.vec,])
    print(df)
    print(colnames(X.m))
demuellae commented 2 years ago

You are correct. It's been a while since I implemented that. I forgot that we already reorder the adjustment table upstream. I reverted the committed changes. Thanks for pointing this out again!

ClarissaFeuersteinAkgoz commented 2 years ago

you are welcome!