Search
Question: makeVRangesFromGRanges throws coercing "factor" to "NA" error
1
gravatar for solo7773
18 months ago by
solo777310
solo777310 wrote:

Dear all,

When I use makeVRangesFromGRanges (R package VariantAnnotation), I got the following error,

Error in as(mcols(gr)[, i], type[i]) : no method or default for coercing "factor" to "NA"

My operations shown below

> library(SomaticSignatures)
> data(ov_tcga, package = "SomaticCancerAlterations")
> ov_tcga_2_vr <- makeVRangesFromGRanges(ov_tcga, ref.field="Reference_Allele", alt.field = "Tumor_Seq_Allele2")
Error in as(mcols(gr)[, i], type[i]) :
no method or default for coercing "factor" to "NA"

Can anybody help me to solve this problem? Thank.

ADD COMMENTlink modified 18 months ago by Martin Morgan ♦♦ 21k • written 18 months ago by solo777310

Can any body give me some advice?

ADD REPLYlink written 18 months ago by solo777310
2
gravatar for Martin Morgan
18 months ago by
Martin Morgan ♦♦ 21k
United States
Martin Morgan ♦♦ 21k wrote:

I think this is a bug in VariantAnnotation 1.18.1 / 1.19.5. A work-around is to make the order of the columns of the GRanges match the order in the argument list

idx = match(c("Reference_Allele", "Tumor_Seq_Allele2"), names(mcols(ov_tcga)))
mcols(ov_tcga) = cbind(mcols(ov_tcga)[idx], mcols(ov_tcga)[-idx])
ADD COMMENTlink written 18 months ago by Martin Morgan ♦♦ 21k

Dear Martin Morgan, thank you very much. It works now.

ADD REPLYlink modified 18 months ago • written 18 months ago by solo777310
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: 288 users visited in the last hour