# How I debug this code?

I am trying to run CMSclassifier::classifyCMSfunction on my data but I am getting this error

library(CMSclassifier)

> Rfcms <- CMSclassifier::classifyCMS(my_data,method="RF")[[3]]
Error in match.names(clabs, names(xi)) :
names do not match previous names


This code classifies gene expression data

Code

But on example data code works

I have attached my data and example data here

My data

Example data

• Interesting question. Its a random forest (ML) algorithm. In truth I'd look to directly code this algorithm via Sci-Kit learn rather than use a forumulation in an R library. Just my thoughts. – M__ Apr 6 '19 at 22:52
• How did you do to debug this error? Did you try with the example data and you got the same result? Did you try to find what is causing the trouble on the example data? Did you searched how to debug this ? Have you used traceback() to locate the source of the error? – llrs Apr 7 '19 at 10:39
• I have done all but very complicated – Exhausted Apr 7 '19 at 12:50

The problem was I should use ENTREZ rather than gene symbols

• Geee, I don't know ... your code and approach looks very solid to me. I thought maybe the classification was using a different name to the training/test set. – M__ Apr 7 '19 at 16:47

I see what you mean but I'm not sure that is the source of the error. I kinda suspect that the example data set you provided works fine. What I think is happening is the labels between the classifier, test and training data are different at some point and so classification ceases.

Your code (albeit I rarely use R) and approach and data look fine. In fact very professional, the data appears scaled (not shown). It looks good.

Perhaps what you refer to is the row name consistency in labelling against the example data set. For example row name, ARHGEF19, this is a gene ID rather than a NCBI code, viz.

efetch -db nucleotide -format gpc -id "LS482351" | xtract -insd gene gene


Output

LS482351.1  ARHGEF19


Elsewhere you use an AL590644.1 as the label, I assume this is the genomic region for PADI4

efetch -db nucleotide -format gpc -id "AL590644" | xtract -insd source organism


Output

AL590644.14 Homo sapiens


(There appears to be version 14 for this subgenomic locus).

So the labelling is a bit mixed and you can feasible convert between them using efetch and scripting a hash/dictionary. However, I don't think its the problem here because its a random forest classification and a label is a label.

It is possible the package you are using is buggy and some of the labels are not getting parsed properly e.g. with a XXX-1 tag or even if a XXX.1 tag. The example data set uses "nice whole" integers. I don't know about R but if regex approaches are used for label parsing things can easily go wrong (its not a good approach). Just a guess however and its easy to check.

• If this was Python Sci-Kit learn I'd give the full debugging a whirl. I don't want to get caught up in R machine learning, but recognise you are using R as your ML approach. – M__ Apr 7 '19 at 17:49