Skip to content

Commit

Permalink
Fix #190: Add checks for gse to srp conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
saketkc committed Apr 24, 2023
1 parent d915803 commit cd33b70
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
History
#######

******************
Unreleased
******************

* Fix for `gse-to-srp` returning unrequested GSEs (`#186 <https://github.com/saketkc/pysradb/issues/190>`)


******************
2.0.2 (2023-04-09)
******************

<<<<<<< HEAD
* Fix for `gse-to-srp` to handle cases where a project is missing but SRXs
are returned (`#186 <https://github.com/saketkc/pysradb/issues/186>`)
* Fix gse-to-gsm (`#187 <https://github.com/saketkc/pysradb/issues/187>`)
Expand Down
2 changes: 1 addition & 1 deletion pysradb/sraweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ def gse_to_srp(self, gse, **kwargs):
{"study_alias": gse_of_interest, "study_accession": srp_unique}
)
gse_df_subset = pd.concat([gse_df_subset_gse, new_gse_df])

gse_df_subset = gse_df_subset.loc[gse_df_subset.study_alias.isin(gse)]
return gse_df_subset[["study_alias", "study_accession"]].drop_duplicates()

def gsm_to_srp(self, gsm, **kwargs):
Expand Down
8 changes: 7 additions & 1 deletion tests/test_sraweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def test_gse_to_gsm1(sraweb_connection):
def test_gse_to_srp(sraweb_connection):
"""Test if gse is converted to srp correctly"""
df = sraweb_connection.gse_to_srp("GSE63858")
assert df["study_accession"][0] == "SRP050548"
assert df["study_accession"].tolist()[0] == "SRP050548"


def test_gse_to_srp2(sraweb_connection):
Expand Down Expand Up @@ -254,3 +254,9 @@ def test_GCP_url(sraweb_connection):
def test_GCP_url2(sraweb_connection):
df = sraweb_connection.sra_metadata(["DRR138929"], detailed=True)
assert df["gcp_url"].tolist()[-1].startswith("gs:")


def test_gse_to_srp3(sraweb_connection):
# https://github.com/saketkc/pysradb/issues/190
df = sraweb_connection.gse_to_srp(["GSE89545"])
assert df["study_accession"].tolist()[0] == "SRP093251"

0 comments on commit cd33b70

Please sign in to comment.