Skip to content

Commit

Permalink
udpate http_two on the rust side
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlKCarlK committed Jan 18, 2024
1 parent db27874 commit 682da1d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 12 additions & 9 deletions tests/tests_api_cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -2422,29 +2424,30 @@ async fn http_one() -> Result<(), Box<BedErrorPlus>> {

#[tokio::test]
async fn http_two() -> Result<(), Box<BedErrorPlus>> {
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::<MetadataFields>::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!(
Expand Down

0 comments on commit 682da1d

Please sign in to comment.