error while trying to cluster the samples

1,958 views
Skip to first unread message

rafia...@gmail.com

unread,
Aug 22, 2016, 9:34:16 AM8/22/16
to methylkit_discussion
Hei

I am getting an error while trying to cluster the samples I get the following error
Error in hclust(d, HCLUST.METHODS[hclust.method]) :
  NA/NaN/Inf in foreign function call (arg 11)


I have checked a previous question posted here but in my case PCA works fine and using head to see the files, I do not see any NA in the data. Attached below is a list of R command and output of head.

Any suggestions on how to fix it.

Thanks in advance.

Regards
Rafi


Dr. Rafi Ahmad, PhD

Associate Professor of Bioinformatics & Drug Discovery

Dept. of Natural Science & Technology

Hedmark University of Applied Sciences

NORWAY

_______________________________

Biohus, office 248

Holsetgate 22, Hamar, NORWAY

Tel:  (+47) 625 17845





> filtered.myobj=filterByCoverage(myobj,lo.count=10,lo.perc=NULL, hi.count=NULL,hi.perc=99.9)
> meth=unite(filtered.myobj, destrand=FALSE)
> clusterSamples(meth, dist="correlation", method="ward", plot=TRUE)
The "ward" method has been renamed to "ward.D"; note new "ward.D2"
Error in hclust(d, HCLUST.METHODS[hclust.method]) :
  NA/NaN/Inf in foreign function call (arg 11)

In addition: Warning message:
In cor(t(x), method = METHODS[method]) : the standard deviation is zero
> hc = clusterSamples(meth, dist="correlation", method="ward", plot=FALSE)
The "ward" method has been renamed to "ward.D"; note new "ward.D2"
Error in hclust(d, HCLUST.METHODS[hclust.method]) :
  NA/NaN/Inf in foreign function call (arg 11)

In addition: Warning message:
In cor(t(x), method = METHODS[method]) : the standard deviation is zero
> PCASamples(meth)
> head(meth)
methylBase object with 5 rows
--------------
  chr     start       end strand coverage1 numCs1 numTs1 coverage2 numCs2 numTs2 coverage3 numCs3 numTs3 coverage4 numCs4 numTs4
1   1 224126174 224126174      +        89      0     87        45      4     39        83      0     80        30      0     29
2   1 224126198 224126198      +        90      0     90        44      0     44        83      0     83        30      0     30
3   1 224126211 224126211      +        90      0     90        44      0     44        84      0     84        31      0     31
4   1 224126220 224126220      +        90      0     90        44      1     43        84      0     84        31      0     31
5   1 224126242 224126242      +        89      3     86        42      1     41        83      0     83        30      0     30
  coverage5 numCs5 numTs5 coverage6 numCs6 numTs6 coverage7 numCs7 numTs7 coverage8 numCs8 numTs8 coverage9 numCs9 numTs9 coverage10
1        21      0     21        99      0     99        86      0     86        21      0     21        43      0     42         74
2        20      0     20        99      0     99        88      2     86        21      0     21        45      0     45         76
3        21      0     21        99      0     99        89      0     89        21      0     21        44      0     44         76
4        21      0     20        99      0     99        89      1     88        21      0     21        43      0     43         76
5        20      0     20        97      0     97        88      3     85        20      0     20        45      0     45         74
  numCs10 numTs10 coverage11 numCs11 numTs11 coverage12 numCs12 numTs12 coverage13 numCs13 numTs13 coverage14 numCs14 numTs14
1       0      74        107       0     106         62       0      60         92       0      92         71       5      62
2       0      76        105       0     105         62       0      62         93       0      93         70       0      70
3       0      76        108       0     108         61       0      61         91       0      91         68       0      68
4       1      75        107       0     107         63       0      63         92       0      92         70       0      70
5       0      74        106       0     106         62       1      61         91       0      91         69       2      67
  coverage15 numCs15 numTs15 coverage16 numCs16 numTs16 coverage17 numCs17 numTs17 coverage18 numCs18 numTs18 coverage19 numCs19
1         38       0      38         78       0      76         90       0      90         12       0      12         35       2
2         38       0      38         77       0      77         91       0      91         12       0      12         36       0
3         38       0      38         78       0      78         89       0      89         12       0      12         35       0
4         38       0      38         77       0      77         91       0      91         12       1      11         35       0
5         37       0      36         77       1      76         91       1      89         11       2       9         36       2
  numTs19 coverage20 numCs20 numTs20 coverage21 numCs21 numTs21 coverage22 numCs22 numTs22 coverage23 numCs23 numTs23 coverage24
1      33         89       0      87         42       0      41         97       0      97         69       3      64         11
2      36         88       1      87         41       0      41        101       0     101         68       1      67         11
3      35         89       0      88         41       0      41        101       0     101         70       0      70         11
4      35         88       0      88         42       0      42        101       0     101         69       1      68         11
5      34         90       0      90         41       0      41         95       2      93         67       1      66         11
  numCs24 numTs24 coverage25 numCs25 numTs25 coverage26 numCs26 numTs26 coverage27 numCs27 numTs27 coverage28 numCs28 numTs28
1       0      11        109       1     107         32       0      32         99       0      97         37       0      36
2       0      11        109       1     108         31       0      31        100       0     100         38       0      38
3       0      11        108       0     108         33       0      33         99       0      99         37       0      37
4       0      11        109       1     108         32       0      32        101       0     101         38       0      38
5       0      11        106       0     106         33       0      33         99       1      98         38       0      38
  coverage29 numCs29 numTs29 coverage30 numCs30 numTs30 coverage31 numCs31 numTs31 coverage32 numCs32 numTs32
1        159       7     149         37       2      34         12       0      12        127       5     120
2        160       6     154         35       1      34         12       0      12        127       1     126
3        158       1     157         37       0      37         13       0      13        128       1     127
4        160       3     157         37       1      36         12       0      12        129       4     125
5        156       5     151         36       1      35         13       0      13        128       0     128
--------------
sample.ids: test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 control1 test14 test15 test16 control2 control3 control4 control5 control6 control7 control8 control9 control10 control11 control12 test17 test18 test19 test20
destranded FALSE
assembly: Pig
context: CpG
treament: 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
resolution: base

Altuna Akalin

unread,
Aug 23, 2016, 3:42:37 PM8/23/16
to methylkit_discussion, rafia...@gmail.com
There might still be NA values, head() may not show if NA values are present elsewhere in the data. You can try to use percMehylation() function to get a matrix of methylation values and use it in other clustering algorithms. If you can present a reproducible example, i can also take a look


Best,
Altuna

rafia...@gmail.com

unread,
Aug 25, 2016, 9:26:30 AM8/25/16
to methylkit_discussion, rafia...@gmail.com
Thanks Altuna, I was able to get the information out and use it for cluster.

Rafi

Altuna Akalin

unread,
Aug 25, 2016, 9:56:14 AM8/25/16
to methylkit_...@googlegroups.com
Great! Let me know if you can send a reproducible example I would like to know if it is bug or not 
--
You received this message because you are subscribed to the Google Groups "methylkit_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to methylkit_discussion+unsub...@googlegroups.com.
To post to this group, send email to methylkit_discussion@googlegroups.com.
Visit this group at https://groups.google.com/group/methylkit_discussion.
For more options, visit https://groups.google.com/d/optout.


--
Sent from mobile, excuse the brevity
Reply all
Reply to author
Forward
0 new messages