From 682da1dd903b351dbcab8e133f9e8040adc1ffbf Mon Sep 17 00:00:00 2001 From: Carl Kadie Date: Thu, 18 Jan 2024 14:23:38 -0800 Subject: [PATCH] udpate http_two on the rust side --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/lib.rs | 2 +- tests/tests_api_cloud.rs | 21 ++++++++++++--------- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8ea6715..9847920 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,6 +173,7 @@ dependencies = [ "statrs", "temp_testdir", "thiserror", + "thousands", "tokio", "url", ] @@ -2070,6 +2071,12 @@ dependencies = [ "syn 2.0.13", ] +[[package]] +name = "thousands" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" + [[package]] name = "tinyvec" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index 03d6b3b..e7bad73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,6 +79,7 @@ pyo3-asyncio = { version = "0.20.0", features = [ ] } temp_testdir = "0.2.3" object_store = { version = "0.9.0", features = ["aws","http"]} +thousands = "0.2.0" [build-dependencies] diff --git a/src/lib.rs b/src/lib.rs index 067a396..edb7128 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7162,7 +7162,7 @@ fn matrix_subset_no_alloc< #[fetch_data::ctor] static STATIC_FETCH_DATA: FetchData = FetchData::new( include_str!("../bed_reader/tests/registry.txt"), - "https://raw.githubusercontent.com/fastlmm/bed-reader/rustybed/bed_reader/tests/data/", + "https://raw.githubusercontent.com/fastlmm/bed-sample-files/main/", "BED_READER_DATA_DIR", "github.io", "fastlmm", diff --git a/tests/tests_api_cloud.rs b/tests/tests_api_cloud.rs index 80a441d..33530e3 100644 --- a/tests/tests_api_cloud.rs +++ b/tests/tests_api_cloud.rs @@ -11,6 +11,7 @@ use bed_reader::path_to_url_string; use bed_reader::sample_bed_file; use bed_reader::sample_bed_object_path; use bed_reader::sample_bed_url; +use bed_reader::sample_file; use bed_reader::sample_object_path; use bed_reader::sample_object_paths; use bed_reader::BedCloud; @@ -29,6 +30,7 @@ use object_store::aws::AmazonS3Builder; use object_store::local::LocalFileSystem; use object_store::path::Path as StorePath; use object_store::ObjectStore; +use thousands::Separable; use tokio::runtime; use url::Url; @@ -2422,29 +2424,30 @@ async fn http_one() -> Result<(), Box> { #[tokio::test] async fn http_two() -> Result<(), Box> { + let local_fam_file = sample_file("synthetic_v1_chr-10.fam")?; + let local_bim_file = sample_file("synthetic_v1_chr-10.bim")?; // cmk make this a const let empty_skip_set = HashSet::::new(); let metadata = Metadata::new() - .read_fam( - r"C:\Users\carlk\Downloads\S-BSST936\example\synthetic_small_v1_chr-10.fam", - &empty_skip_set, - )? + .read_fam(local_fam_file, &empty_skip_set)? .0 - .read_bim( - r"C:\Users\carlk\Downloads\S-BSST936\example\synthetic_small_v1_chr-10.bim", - &empty_skip_set, - )? + .read_bim(local_bim_file, &empty_skip_set)? .0; // Open the bed file with a URL and any needed cloud options, then use as before. let mut bed_cloud = BedCloud::builder( - "https://www.ebi.ac.uk/biostudies/files/S-BSST936/example/synthetic_small_v1_chr-10.bed", + "https://www.ebi.ac.uk/biostudies/files/S-BSST936/genotypes/synthetic_v1_chr-10.bed", [("timeout", "100")], // cmk must figure this out )? .metadata(&metadata) .skip_early_check() .build() .await?; + println!( + "iid_count={}, sid_count={}", + bed_cloud.iid_count().await?.separate_with_underscores(), + bed_cloud.sid_count().await?.separate_with_underscores() + ); println!("{:?}", bed_cloud.iid().await?.slice(s![..5])); println!("{:?}", bed_cloud.sid().await?.slice(s![..5])); println!(