cmk badges go here
Read and write the PLINK BED format, simply and efficiently.
Features:
Add this to your Cargo.toml:
[dependencies]
bed_reader = "0.1.0"
Read genomic data from a .bed file.
```rust use bed_reader;
fn main() { let filename = samplefile("small.bed"); mut bed = bedreader::openbed(file_name)?; let val = bed.read()?; println!("{:?}", val); } ```
Read every second individual and SNPs (variants) from 20 to 30.
```rust use bed_reader;
fn main() { let filename2 = samplefile("somemissing.bed"); mut bed2 = bedreader::openbed(filename2)?; let val2 = bed2.read(index=(::2,20:30))?; println!("{:?}", val2); } ```
List the first 5 individual (sample) ids, the first 5 SNP (variant) ids, and every unique chromosome. Then, read every value in chromosome 5.
use bed_reader;
cmk See slicing macro s! https://docs.rs/ndarray/latest/ndarray/macro.s.html
rust
fn main() {
let file_name2 = sample_file("some_missing.bed");
mut bed3 = bed_reader::open_bed(file_name2)?;
println!("{:?}", bed3.iid[:5]);
println!("{:?}", bed3.sid[:5]);
println!("{:?}", bed3.chromosome.unique());
let val3 = bed.read(index=np.s_[:,bed3.chromosome=='5'])?;
println!("{:?}", val3);
}
cmk how do you show output?
cmk update - Documentation - Questions to: fastlmm-dev@python.org - Source code - PyPI - Bug reports - Mailing list - Project Website