This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to retrieve the list of rsid from .bgen file?

How to retrieve the list of rsid from .bgen file? Is there a simple way in linux to browse .bgen file?

snp bgen plink r

1 answer

If you have Python available, you can use the "bgen-reader" library (via "pip install bgen-reader")

from bgen_reader
with open_bgen("haplotypes.bgen", verbose=False) as bgen:
    print(bgen.rsids)

Output:

['RS1' 'RS2' 'RS3' 'RS4']

See https://bgen-reader.readthedocs.io/en/latest/quickstart2.html

  • Carl

(I'm a contributor to bgen-reader)

Carl Kadie, Ph.D.

(Microsoft Research, retired)

https://www.linkedin.com/in/carlk/

@carlk: Welcome to Biostars! Please add links (e.g. linkedin) to your biostars profile. Do not include these links in your comments/answers.

I think you missed "import open_bgen" in the first line of the codes.

Log in to answer this question.