zhengxwen / SNPRelate

R package: parallel computing toolset for relatedness and principal component analysis of SNP data (Development version only)
http://www.bioconductor.org/packages/SNPRelate
101 stars 25 forks source link

is.character(vcf.fn) & is.vector(vcf.fn) is not TRUE #54

Closed PlantDr430 closed 5 years ago

PlantDr430 commented 5 years ago

Hello,

I am trying to reformat a .vcf file that I got at the end of running [https://github.com/tseemann/snippy]. it is the final output of snippy-core which shows all snps that are present in all samples. The core.vcf file looks like this:


#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  Clav04  Clav26  Clav46  Clav52  Clav55  LM14    LM207   LM223   LM232   LM233   LM28    LM30    LM33    LM39    LM4 LM46    LM461   LM469   LM470   LM474   LM5 LM582   LM60    LM71
CAGA010001911   9533    .   T   G   .   PASS    TYPE=snp    GT  0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
CAGA010001911   41071   .   G   A   .   PASS    TYPE=snp    GT  0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
CAGA010001911   41084   .   C   A   .   PASS    TYPE=snp    GT  0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
CAGA010001911   41203   .   G   C   .   PASS    TYPE=snp    GT  0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
CAGA010001911   41213   .   C   T   .   PASS    TYPE=snp    GT  0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
CAGA010001911   41301   .   T   C   .   PASS    TYPE=snp    GT  0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
CAGA010001911   41381   .   C   G   .   PASS    TYPE=snp    GT  0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

When I run:

> vcf.fn <- read.delim("~/CSU_PhD/SNP_calling/core.vcf")
> snpgdsVCF2GDS(vcf.fn, "test.gds", method="copy.num.of.ref")

I get the error:

Error in snpgdsVCF2GDS(vcf.fn, "test.gds", method = "copy.num.of.ref") : 
  is.character(vcf.fn) & is.vector(vcf.fn) is not TRUE

Any idea what is causing this / how to fix the .vcf to be able to be reformatted?

PlantDr430 commented 5 years ago

Sorry, realized I still left in "read.delim" which was causing the problem.