zhengxwen / gds2bgen

R package for the format conversion from bgen to gds
3 stars 1 forks source link

rename "variant.id" header #2

Closed gianolga closed 5 years ago

gianolga commented 5 years ago

Hello,

Many thanks for the tool!! I have managed to convert my bgen files to gds using the pipeline suggested here. However, the downstream analysis of my project requires to read in the gds data and create a GenotypeData class object (I'm using GWASTools for that). However, I'm getting an error that it can't find a "snp.id" column, so I was wondering if I can manually change the variable.id name. Many apologies if this is not exactly the right place for my question.

Many thanks, Olga

zhengxwen commented 5 years ago

It is sequencing GDS format, not SNP GDS format. You should use SeqArray and SeqVarTools to open the file.

wangshuang2024 commented 9 months ago

It is sequencing GDS format, not SNP GDS format. You should use SeqArray and SeqVarTools to open the file.

hello, I also met the same problem. my gdsfile can successfully opened by "seqOpen" [gdsfile <- seqOpen("C:\Users\Desktop\chr8.gds")] . However, when I used "GdsGenotypeReader" , I got some error waring. geno <- GdsGenotypeReader(gdsfile) [Error in index.gdsn(object@handler, varname) : No such GDS node "snp.id"!] or geno <- GdsGenotypeReader(filename = "chr8.gds") [Error in openfn.gds(filename = filename, allow.fork = allow.fork) : The file 'C:\Users\Desktop\chr8.gds' has been created or opened.] My variant id name changed like this. head(seqGetData(gdsfile,"annotation/id")) [1] "chr8_700009_ACCCGCACACGCGCACAGACCCTCACAGGCGCACAGG_A"
[2] "chr8_700114_C_G"
[3] "chr8_700138_C_CGCACAGGCGCACAGACCCGCACACGCGCACAGGCCCGCACACGCGCACAGGCCG" [4] "chr8_700153_A_G"
[5] "chr8_700209_GCGCACACACCCGCACACGCGCACAGGCC_G"
[6] "chr8_700216_C_G"
So, how to solve this problem. Thanks for your kind.

zhengxwen commented 9 months ago

Use seqOpen() to open your gds file:

gdsfile <- SeqArray::seqOpen("chr8.gds")

For the association testing, please check the GENESIS package.