Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: loading plink file #5

Open
complexgenome opened this issue Dec 17, 2020 · 1 comment
Open

question: loading plink file #5

complexgenome opened this issue Dec 17, 2020 · 1 comment

Comments

@complexgenome
Copy link

Thanks for this package.

I would like to use this to read plink data.

https://rdrr.io/cran/ARTP2/man/read.bed.html

If I use following code however, I was wondering when reading plink file are the data loaded completely in memory or in chunks or index?

read.bed(bed, bim, fam, sel.snps = NULL, sel.subs = NULL, encode012 = TRUE)

I have plink data for about ~200K individuals.
Thank you.

@zhangh12
Copy link
Owner

zhangh12 commented Dec 18, 2020

Thanks for this package.

I would like to use this to read plink data.

https://rdrr.io/cran/ARTP2/man/read.bed.html

If I use following code however, I was wondering when reading plink file are the data loaded completely in memory or in chunks or index?

read.bed(bed, bim, fam, sel.snps = NULL, sel.subs = NULL, encode012 = TRUE)

I have plink data for about ~200K individuals.
Thank you.

refer to /src/ReadBED.cpp for more details.

read.bed will only read SNPs specified by sel.snps. With its default value NULL, all SNPs are loaded, thus more memory is needed.

Depending on how many SNPs are stored in the bed file for 200k samples, read.bed should be able to load relative large file, although I did not test it for some extreme cases. I can use read.bed to load a bed file of 3Gb without any problem.

You can try it on your data. If it does not work out, an alternative is to feed a chunk of SNPs at a time, and call read.bed several times. You can then combine the loaded data by yourself in R. Let me know if you still have any problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants