Search
Question: champ.impute doesn't update beta matrix
0
gravatar for rasmus.rydbirk
17 months ago by
rasmus.rydbirk10 wrote:

I've been using champ.impute, both Combine and KNN, to replace NAs. After running I receive this (I have 700k+ rows):

$beta
1            2            3            4            5            6
5.040964e-03 3.260464e-03 2.506848e-03 6.241857e-03 4.080995e-03 1.144493e-03
1.797270e-01 2.464607e-02 1.094900e-01 1.123960e-01 5.046866e-01 4.868431e-01

But when I ask head(myLoad$beta) I get this:

1           2           3          4           5           6
NA          NA 0.002506848         NA 0.004080995 0.001144493
NA          NA          NA 0.11239598 0.504686622 0.486843136

Am I missing something or shouldn't champ.impute replace the beta matrix with the imputed values?

I'm running R v. 3.3.3, ChAMP 2.6.0, I receive no errors.

ADD COMMENTlink modified 17 months ago by Yuan Tian80 • written 17 months ago by rasmus.rydbirk10
2
gravatar for Yuan Tian
17 months ago by
Yuan Tian80
London
Yuan Tian80 wrote:

Hello:

 

Can I have your code? I tested the function below, but it seems fine:

 

In below test, myLoad$beta is the 450K dataset included in ChAMP. I used it as an example, we can see that there is no NA in it, so I manually added 2000 NA value in it, then used champ.Impute() function to remove it. Finally, the result seems correct. There is no NA in final myImpute$beta.

> TestData <- myLoad$beta
> sum(is.na(TestData))
[1] 0
> TestData[sample(1:length(TestData),2000)] <- NA
> sum(is.na(TestData))
[1] 2000
> myImpute <- champ.impute(TestData)
[===========================]
[<<< ChAMP.IMPUTE START >>>>]
-----------------------------
<method>:Combine. (Suitable for Large Data Set)
(1): 2 Probes contain 0.2 or above NA will be removed.
(2): 0 Samples contain 0.1 or above NA will be removed.
Cluster size 404381 broken into 187865 216516
Cluster size 187865 broken into 136737 51128
Cluster size 136737 broken into 35195 101542
Cluster size 35195 broken into 30533 4662
Cluster size 30533 broken into 3146 27387
Cluster size 3146 broken into 1407 1739
Done cluster 1407
Cluster size 1739 broken into 988 751
Done cluster 988
Done cluster 751
...
> sum(is.na(myImpute$beta))
[1] 0


Best

Yuan Tian

 

ADD COMMENTlink written 17 months ago by Yuan Tian80

Thank you for your reply!

My code is:

champ.impute(beta=myLoad_Combine$beta,
pd=myLoad_Combine$pd,
SampleCutoff=0.5)

> traceback()
7: cat("Cluster size", p, "broken into", size, "\n")
6: knnimp.split(x, k, imiss, irmiss, p, n, maxp = maxp)
5: knnimp.internal(x[index, ], k, imiss[index, ], irmiss[index], 
       p, n, maxp)
4: knnimp.split(x, k, imiss, irmiss, p, n, maxp = maxp)
3: knnimp(x, k, maxmiss = rowmax, maxp = maxp)
2: impute.knn(beta)
1: champ.impute(beta = myLoad_Combine$beta, pd = myLoad_Combine$pd, 
       SampleCutoff = 0.5)
> sumis.na(myLoad_Combine$beta))
[1] 1830898

And yes, I know I have a high number of NAs...

ADD REPLYlink written 17 months ago by rasmus.rydbirk10

Wait a minute, you write results to myImpute? Wow.. I feel stupid now. Of course I need to assign a target.

I just recieved an output with 0 NAs. Thank you for your help, as always!

ADD REPLYlink written 17 months ago by rasmus.rydbirk10
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.2.0
Traffic: 251 users visited in the last hour