Readvcf In R
2
2
Entering edit mode
8.7 years ago
farah ▴ 30

I am trying to run the R command readVcf in R, it shows function not found. I have already downloaded the package "VariantAnnotation". I don't know if it helps. Does anyone have any idea?

r bioconductor vcf • 23k views
ADD COMMENT
4
Entering edit mode

you write you have downloaded it, but have you installed the package and Bioconductor? rt(fine)m: http://bioconductor.org/install/

ADD REPLY
0
Entering edit mode
ADD REPLY
6
Entering edit mode
8.7 years ago

Have you loaded it , library('VariantAnnotation') !!

ADD COMMENT
3
Entering edit mode
8.7 years ago
henryvuong ▴ 810

Just run these 3 command lines in R:

source("http://bioconductor.org/biocLite.R") 
biocLite("VariantAnnotation") #install the package
library("VariantAnnotation") #load the package
example("readVcf") #optional, test the function by running example codes
ADD COMMENT
0
Entering edit mode

Hi,

 

I am trying to use VariantAnnotation and this is the error I am getting

 

library("VariantAnnotation")

f1 <-system.file("extdata","chr22.vcf.gz", package="VatiantAnnotation")

vcf<-readVcf(f1,"hg19")
Error in .io_check_exists(path(con)) : file(s) do not exist:
  ''

list.files(system.file("extdata", package="VariantAnnotation"))
[1] "chr22.vcf.gz"         "chr22.vcf.gz.tbi"     "chr7-sub.vcf.gz"
[4] "chr7-sub.vcf.gz.tbi"  "ex2.vcf"              "gl_chr1.vcf"
[7] "h1187-10k.vcf.gz"     "h1187-10k.vcf.gz.tbi" "structural.vcf"

Much appreciate help,

 

Thanks,

Tinu

ADD REPLY
2
Entering edit mode

Hi,

I had the same problem today. Basically the system.file command is for loading example data from the package. To load your own data, just do:

vcf<-readVcf("chr22.vcf.gz","hg19")

Stathis

ADD REPLY
0
Entering edit mode

True but if i read my own data using readVcf: file <- readVcf("file.vcf","hg19") the commands hdr <- scanVcfHeader(file)

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘scanVcfHeader’ for signature ‘"CollapsedVCF"’

and cannot follow the pipeline: rm(hdr) info(hdr) geno(hdr)

ADD REPLY
1
Entering edit mode

Is it not a spelling mistake in your cmd

f1 <-system.file("extdata","chr22.vcf.gz", package="VatiantAnnotation")

"VatiantAnnotation" should be "VariantAnnotation"

ADD REPLY

Login before adding your answer.

Traffic: 2188 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6