Skip to content

Commit

Permalink
make synthetic_v1_chr-10.fam/bim into local sample files
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlKCarlK committed Jan 18, 2024
1 parent 70cc25e commit db27874
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions bed_reader/_sample_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
path=pooch.os_cache("bed_reader"),
# The remote data is on Github
base_url="https://raw.githubusercontent.com/"
+ "fastlmm/bed-reader/Oct2023/bed_reader/tests/data/",
+ "fastlmm/bed-sample-files/main/",
# If this is a development version, get the data from the master branch
version_dev="master",
version_dev="main",
# The registry specifies the files that can be fetched
env="BED_READER_DATA_DIR",
)
Expand Down
2 changes: 2 additions & 0 deletions bed_reader/tests/registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ toydata.5chrom.fam 9551c70290580c9b23cb83c98ccc7791f380169bdaddfbc2edb905ff78879
sparse.bed 70f76a3920b4c8498ecfae9c8837c3ea841a874f88f60c082141905a24d63114
sparse.fam 729bb46dab41082c6b5937f7f9e3a68d0c0f27d2ad795f1fa1fd146354fb6aa7
sparse.bim 77917e8645ce0744a7d89bfca0d78a594a8e3d5640a4bf90ceae3c1ab2ea5479
synthetic_v1_chr-10.fam 394bd3da24760327d6103466cb83002dde25440a650e667cf1597d471fd73fea
synthetic_v1_chr-10.bim 0f889d32bb183de0d26581ae59d94058204645f3325d78fe4cb96156d9792ac9
21 changes: 12 additions & 9 deletions bed_reader/tests/test_open_bed_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@


def test_cloud_read1(shared_datadir):
import math

file = shared_datadir / "plink_sim_10s_100v_10pmiss.bed"
file = PurePath(file).as_uri()

Expand Down Expand Up @@ -1068,17 +1066,22 @@ def test_http_one():


def test_http_two():
from bed_reader import open_bed, sample_file

local_fam_file = sample_file("synthetic_v1_chr-10.fam")
local_bim_file = sample_file("synthetic_v1_chr-10.bim")
with open_bed(
"https://www.ebi.ac.uk/biostudies/files/S-BSST936/example/synthetic_small_v1_chr-10.bed",
fam_filepath=r"C:\Users\carlk\Downloads\S-BSST936\example\synthetic_small_v1_chr-10.fam",
bim_filepath=r"C:\Users\carlk\Downloads\S-BSST936\example\synthetic_small_v1_chr-10.bim",
"https://www.ebi.ac.uk/biostudies/files/S-BSST936/genotypes/synthetic_v1_chr-10.bed",
fam_filepath=local_fam_file,
bim_filepath=local_bim_file,
skip_format_check=True,
) as bed:
print(bed.iid[:5])
print(bed.sid[:5])
print(np.unique(bed.chromosome))
print(f"iid_count={bed.iid_count:_}, sid_count={bed.sid_count:_}")
print(f"iid={bed.iid[:5]}...")
print(f"sid={bed.sid[:5]}...")
print(f"unique chromosomes = {np.unique(bed.chromosome)}")
val = bed.read(index=np.s_[:10, :: bed.sid_count // 10])
print(val)
print(f"val={val}")
assert val.shape == (10, 10) or val.shape == (10, 11)


Expand Down

0 comments on commit db27874

Please sign in to comment.