This is a test version of Biostars. For the public version, visit https://www.biostars.org.
VCF sample id format for snpgdsVCF2GDS (SNPRelate package)

I need to convert vcfs into gds format as input for another software package, and I've been working with SNPRelate functions to do so.

When I attempt to run the functon snpgdsVCF2GDS,

vcf.fn =  system.file("C:/<mypath>/chr22_testing.vcf","sequence.vcf",package="SNPRelate")
snpgdsVCF2GDS(vcf.fn,"test1.gds", method="biallelic.only")

I get an error message referencing incorrect format in the sample id, namely

Start file conversion from VCF to SNP GDS ...
Method: extracting biallelic SNPs
Error in VCF_SampID(vcf.fn[i]) : Error VCF format: invalid sample id!

Initially, I thought this error was due to the fact that the original ID column had the format chr:coordinate (e.g. 22:17072483). I corrected this by replacing those with known rs numbers with the actuals rs number, and the rest with placeholders, e.g. rs1 etc. However, even after doing so, I get the same error. Perhaps the issue is with the placeholders, though I don't see why one needs actual rs numbers in order to compress a file if the data fields/columns are all correct. Is there something else that I'm missing?

gds snprelate vcf

what is the output of

bcftools query -l /path/to/sequence.vcf

I do not have bcftools installed, I can install it and try to do so, but in the meantime, is there anything else that I can check? It seems to me that snpgdsVCF2GDS does find the vcf file in question since it's throwing an error associated with a particular data field, as opposed to not being able to find/read the vcf at all.

After installing bcftools in this workstation, the command bcftools query -l <myvcf> returns the sample ids (i.e. column names of every sample). So again, the problem doesn't seem to be with reading the file, there's something in the file that snpgdsVCF2GDS can't process, i.e. "Error VCF format: invalid sample id!".

The sample ID names are of the form e.g. X123_123, as far as I can determine, the underscore shouldn't be problem, nor the character preface (imposed by R when processing the files)

Are the sample IDs unique? Can you run the VCF validator to check if the file adheres to the correct format structure?

vcf-validator input.vcf

0 answers

No answers yet.

Log in to answer this question.