privefl / bigsnpr

R package for the analysis of massive SNP arrays.
https://privefl.github.io/bigsnpr/
186 stars 44 forks source link

Error in format_snp_id(snp_id) in snp_readBGEN and snp_readBGI #361

Closed JasperHof closed 2 years ago

JasperHof commented 2 years ago

Hello,

I have tried to load a BGI file in R, but I keep stumbling upon an error that I did not encounter in previous analyses. The head of my BGI file looks like this:

image

But when I try to load a subset of SNPs from the BGI file, my formatting seems to be wrong:

image

Also when I add the 'chr' part which is included in the chromsome column of the BGI file:

image

Is there something wrong with the formatting of the BGI file perhaps? The bgen file should be 8bits and of bgen version 1.2.

Any help is much appreciated!

privefl commented 2 years ago

I think you don't need to wrap snp_id with list().

JasperHof commented 2 years ago

Thank you for the suggestion! Unfortunately it is still not working if I leave out list(), for both options: image

privefl commented 2 years ago

I see. This function just does not expect to have chrAB in the chromosome column (just AB). Can you change how BGI files are generated on your end? Otherwise, I would need to update the function to also allow for this.

JasperHof commented 2 years ago

I think so too. My first attempts at changing the BGI file today failed, will keep you posted..

JasperHof commented 2 years ago

Hi privefl,

The issue is now resolved by removing 'chr' from the chromosome column in the BGI file. Not sure how it got there.

Thanks again!