How to get same reproducible value in R?
1
0
Entering edit mode
4.4 years ago
Ankit ▴ 500

Hi everyone,

I have methylation array data. I am using ChAMP package to process the data. What I noticed is when I run the function champ.norm(), the beta values comes different everytime. They are not too much different and generally the third decimmal place show bit up or down. It does not also change the overall output or interpretation. But heirarchical clustering at a later stage changes a bit.

Therefore, it will be good if I get same values everytime I run the function. More important questions is. Is it the package related issue or in general can happen with any R function? I tried to set.seed(1), but the values change again every time.

This might be new issue for me but some of you might have experienced it before. So I request you all to please guide me in this.

Thanks

Champ Methylation arrays R Bioconductor • 1.3k views
ADD COMMENT
0
Entering edit mode

Hi

If any suggestions in this issue please help.

Thank you

ADD REPLY
0
Entering edit mode
4.4 years ago
jrleary ▴ 210

Looking at the champ.norm documentation on Bioconductor, the function does not appear to have any sort of seed argument. You could look at the inner workings of the function by typing champ.norm (no parentheses) into the console, which will you give you the function's code. I'd try and see which functions it calls internally, then determine which one is causing the stochasticity, and see if you can somehow pass a seed argument to that function specifically.

ADD COMMENT
0
Entering edit mode

Hi thanks for replying.

See this source code. https://rdrr.io/bioc/ChAMP/src/R/champ.norm.R

I used BMIQ normalization so champ.BMIQ() function. But it already has set.seed argument. If you see here https://rdrr.io/bioc/ChAMP/src/R/champ.BMIQ.R

set.seed(1234567)

What do you think could be the issue?

I would like to add here i did not observe any discrepancies with champ.load default function. Only with champ.norm() bmiq normalization.

Please help

ADD REPLY
0
Entering edit mode

Reading through the BMIQ.R file, it looks to me that the programmers invoke set.seed before any of the function calls that involve stochasticity, so I think it should be handled. I'm not entirely sure what's going on as I can't run your code myself, but it could be an issue with how R rounds numbers. For example, sometimes when R converts between number types, it saves 0 as some ridiculously small number instead of as just 0. My best guess would be that something like that is happening, but others would certainly know better than I.

ADD REPLY
0
Entering edit mode

I would appreciate if you can suggest something. How to deal with this fluctuating value?

ADD REPLY

Login before adding your answer.

Traffic: 2593 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6