Question: How to get same reproducible value in R?
0
gravatar for Ankit
4 months ago by
Ankit140
Europe
Ankit140 wrote:

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

ADD COMMENTlink modified 4 months ago by zx87549.7k • written 4 months ago by Ankit140

Hi

If any suggestions in this issue please help.

Thank you

ADD REPLYlink written 4 months ago by Ankit140
0
gravatar for jrleary
4 months ago by
jrleary130
Lineberger Comprehensive Cancer Center
jrleary130 wrote:

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 COMMENTlink written 4 months ago by jrleary130

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 REPLYlink written 4 months ago by Ankit140

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 REPLYlink written 4 months ago by jrleary130

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

ADD REPLYlink written 4 months ago by Ankit140
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1739 users visited in the last hour