Skip to content

Commit

Permalink
195 replace infinity in enrichr response when not using background (#196
Browse files Browse the repository at this point in the history
)

* fix: perform same intermediate text to replace infinities with get call to enrichr

* chore: bump patch
  • Loading branch information
noamteyssier authored Oct 5, 2023
1 parent 2528bf0 commit ed97806
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ggetrs"
version = "0.1.77"
version = "0.1.78"
edition = "2021"
license = "MIT"
description = "Efficient querying of biological databases from the command line"
Expand Down
10 changes: 9 additions & 1 deletion src/enrichr/functions/enrich.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ pub fn enrich(
"{}/enrich?userListId={}&backgroundType={}",
ENRICHR_URL, list_id, alias
);
Ok(reqwest::blocking::get(request_url)?.json::<ResponseEnrich>()?)
let client = Client::new();
// Go through intermediate `text` to replace `Infinity` with `f64::MIN_POSITIVE`.
let text = client
.get(request_url)
.send()?
.text()?
.replace("Infinity", format!("{:e}", f64::MIN_POSITIVE).as_str());
// Parse the JSON from a string.
Ok(serde_json::from_str::<ResponseEnrich>(&text)?)
}
}

Expand Down

0 comments on commit ed97806

Please sign in to comment.