Closed lian0090 closed 9 years ago
Can you show me the complete code?
Hi Zhengxweng, I hope it is okay to post this on a closed issue, but I am I am also having the same issue. I am currently working with a small sample dataset (10 SNPs and 5 individuals) and working my way through the PCA for SNP genotype data pipeline posted here. The code seems to work just fine until I try to add my new data frame in. I will post my code below:
snpgdsVCF2GDS("snps.first30.5ind.vcf","snps.first30.5ind.gds",verbose=T)
genofile=openfn.gds("snps.first30.5ind.gds")
RV <- snpgdsPCA(genofile, num.thread=2)
samp.annot<-data.frame(pop.group = c("EUR","EUR","EUR","EUR","EUR"))
add.gdsn(genofile, "sample.annot", samp.annot)
I get this as the following error:
Error in add.gdsn(genofile, "sample.annot", samp.annot) :
Invalid argument
Please open the GDS file with a writable option:
genofile = openfn.gds("snps.first30.5ind.gds", readonly=FALSE)
and,
add.gdsn(genofile, "sample.annot", val=samp.annot)
Also please try installing the latest version of gdsfmt
and SNPRelate
.
Thank you for your quick response. Updating my R to version 3.4.2 allowed me to update SNPRelate to 1.4.2 and gdsfmt to 1.6.2, which was the key to my problem. I hope you have a very nice evening and again, thank you for your help.
When I try to add some data into my gdsn object, R reports this error add.gdsn(genofile, "try", "da") : Invalid argument