From db2787494c0e5f0ee043be30780f8f7442fbccfc Mon Sep 17 00:00:00 2001 From: Carl Kadie Date: Thu, 18 Jan 2024 14:10:21 -0800 Subject: [PATCH] make synthetic_v1_chr-10.fam/bim into local sample files --- bed_reader/_sample_data.py | 4 ++-- bed_reader/tests/registry.txt | 2 ++ bed_reader/tests/test_open_bed_cloud.py | 21 ++++++++++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/bed_reader/_sample_data.py b/bed_reader/_sample_data.py index f0c97e0f..18d82501 100644 --- a/bed_reader/_sample_data.py +++ b/bed_reader/_sample_data.py @@ -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", ) diff --git a/bed_reader/tests/registry.txt b/bed_reader/tests/registry.txt index 37b6fde5..7ce23e98 100644 --- a/bed_reader/tests/registry.txt +++ b/bed_reader/tests/registry.txt @@ -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 \ No newline at end of file diff --git a/bed_reader/tests/test_open_bed_cloud.py b/bed_reader/tests/test_open_bed_cloud.py index d601582b..58b3fe94 100644 --- a/bed_reader/tests/test_open_bed_cloud.py +++ b/bed_reader/tests/test_open_bed_cloud.py @@ -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() @@ -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)