-
Notifications
You must be signed in to change notification settings - Fork 999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set changes original data (as.data.table on DESeq/GRanges objects) #3230
Milestone
Comments
Thank you for reporting. In future reports please include calls to attach required libraries in your minimal reproducible example. From brief investigation it looks like sapply(res, address)==sapply(as.data.frame(res), address)
# baseMean log2FoldChange lfcSE stat pvalue padj
# TRUE TRUE TRUE TRUE TRUE TRUE Will fix |
re-opening as PR with the fix is not yet merged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I noticed a real pitfall (bug) while examining wrong results in my analysis.
Changing a data.table object also alters the original data from which it was copied with as.data.table. This happens for objects like DESeqResults and GRanges.
According to the vignette:
But this is apparently not true.
Here is a minimal example:
Now using a set function on DT also changes the values in the original res object.
We notice that the values for genes A and C are swapped. This is probably due to the fact that the values are sorted by setkey but the rownames of res are not!
Therefore any analysis using the original res will be completly wrong.
I am aware that there are fixes for this like:
but my main issue is the fact, that this behaviour is not obvious and very dangerous for downstream work.
This was already somehow reported but nothing has changed.
data.table issue
GRanges copy
I love using data.table, it is simply amazing.
Hopefully you can address this issue.
Thank you!
The text was updated successfully, but these errors were encountered: