How to retrieve the list of rsid from .bgen file?
1
0
Entering edit mode
3.2 years ago
garyzhubc • 0

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.6k views
ADD COMMENT
0
Entering edit mode
3.2 years ago
carlk ▴ 40

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/

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 1644 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6