Skip to content

Commit

Permalink
Merge branch 'main' of github.com:pachterlab/gget into main
Browse files Browse the repository at this point in the history
merging main into local
  • Loading branch information
josephrich98 committed Sep 25, 2024
2 parents 98a2ef4 + 2840ed1 commit 15717e8
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 31 deletions.
14 changes: 7 additions & 7 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

# Manual
* [gget alphafold](en/alphafold.md)
* [gget archs4](en/archs4.md)
* [gget archs4](en/archs4.md)
* [gget bgee](en/bgee.md)
* [gget blast](en/blast.md)
* [gget blat](en/blat.md)
* [gget blat](en/blat.md)
* [gget cbio](en/cbio.md)
* [gget cellxgene](en/cellxgene.md)
* [gget cosmic](en/cosmic.md)
* [gget diamond](en/diamond.md)
Expand All @@ -20,15 +22,13 @@
* [gget gpt](en/gpt.md)
* [gget info](en/info.md)
* [gget muscle](en/muscle.md)
* [gget mutate](en/mutate.md)
* [gget mutate](en/mutate.md)
* [gget opentargets](en/opentargets.md)
* [gget pdb](en/pdb.md)
* [gget ref](en/ref.md)
* [gget search](en/search.md)
* [gget setup](en/setup.md)
* [gget seq](en/seq.md)
* [gget opentargets](en/opentargets.md)
* [gget cbio](en/cbio.md)
* [gget bgee](en/bgee.md)
* [gget seq](en/seq.md)

---

Expand Down
5 changes: 3 additions & 2 deletions docs/src/en/cbio.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Return format: JSON (command-line) or string list (Python).

**Positional argument**
`keywords`
Space-separated list of keywords to search for, e.g. <code>breast&nbsp;lung</code>.
Space-separated list of keywords to search for, e.g. <code>breast&nbsp;lung</code>.
Python: Pass keywords as a list of strings.

### `plot` subcommand (Python: `gget.cbio_plot`)
Plot cancer genomics heatmaps using data from cBioPortal.
Expand Down Expand Up @@ -89,7 +90,7 @@ gget cbio search esophag ovary ovarian
```python
# Python
import gget
gget.cbio_search('esophag', 'ovary', 'ovarian')
gget.cbio_search(['esophag', 'ovary', 'ovarian'])
```
&rarr; Returns a list of studies with cancer types matching the keywords `esophag`, `ovary`, or `ovarian`.

Expand Down
8 changes: 5 additions & 3 deletions gget/gget_cbio.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,12 @@ def _extract_study_name(name: str) -> str:
return name


def cbio_search(*key_words: str):
def cbio_search(key_words):
"""
Find cBioPortal study IDs by keyword.
Args:
:param key_words: list of keywords to search for
key_words list of keywords to search for
Return:
Expand All @@ -315,6 +314,9 @@ def cbio_search(*key_words: str):
)
return []

if isinstance(key_words, str):
key_words = [key_words]

api = SwaggerClient.from_url(
"https://www.cbioportal.org/api/v2/api-docs",
config={
Expand Down
7 changes: 5 additions & 2 deletions gget/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ def _get_help_string(self, action):
help_str += " (default: %(default)s)"
return help_str


def convert_to_list(*args):
args_list = list(args)
return args_list

def int_or_str(value):
try:
return int(value)
Expand Down Expand Up @@ -3314,7 +3317,7 @@ def main():
## cbio return
if args.command == "cbio":
if args.subcommand == "search":
cbio_results = cbio_search(*args.keywords)
cbio_results = cbio_search(convert_to_list(*args.keywords))
print(json.dumps(cbio_results, ensure_ascii=False, indent=4))
elif args.subcommand == "plot":
cbio_plot(
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/test_cbio.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"/tmp/test_cbio_download/msk_impact_2017/sv.txt": "24ce260e03b417d47929f8fc34fc49a4",

"/tmp/test_cbio_download/egc_msk_2023/clinical_patient.txt": "6fbd67c0eca7a24fa6918f37c989033f",
"/tmp/test_cbio_download/egc_msk_2023/clinical_sample.txt": "8469bcc199fc653afb867242b3ab6e00",
"/tmp/test_cbio_download/egc_msk_2023/clinical_sample.txt": "a4423dfa78788df1b9f49fef31f282a9",
"/tmp/test_cbio_download/egc_msk_2023/cna.txt": "1acb67c06284754ee472402753e54263",
"/tmp/test_cbio_download/egc_msk_2023/mutations.txt": "be28497d2f95d933ad8e14a04adc2beb",
"/tmp/test_cbio_download/egc_msk_2023/sv.txt": "c1a0011480b533d2b659373ffd178c32"
Expand All @@ -42,4 +42,4 @@
},
"expected_result": false
}
}
}
29 changes: 16 additions & 13 deletions tests/fixtures/test_cbio_search.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@
"ovarian"
],
"expected_result": [
"egc_tmucih_2015",
"egc_msk_2017",
"egc_msk_2023",
"egc_msk_tp53_ccr_2022",
"egc_mskcc_2020",
"egc_tmucih_2015",
"egc_trap_ccr_msk_2023",
"egc_trap_msk_2020",
"egc_msk_tp53_ccr_2022",
"escc_ucla_2014",
"esca_broad",
"esca_tcga",
"esca_tcga_pan_can_atlas_2018",
"escc_icgc",
"escc_ucla_2014",
"egc_trap_msk_2020",
"hgsoc_msk_2021",
"lgsoc_mapk_msk_2022",
"msk_spectrum_tme_2022",
"ov_tcga",
"ov_tcga_pan_can_atlas_2018",
"ov_tcga_pub",
"scco_mskcc",
"stes_tcga_pub"
"stes_tcga_pub",
"egc_trap_ccr_msk_2023",
"esca_tcga",
"egc_msk_2023",
"ov_tcga",
"msk_spectrum_tme_2022",
"esca_tcga_pan_can_atlas_2018",
"ov_tcga_pan_can_atlas_2018",
"esca_tcga_gdc",
"hgsoc_tcga_gdc",
"ovary_cptac_gdc"
]
}
}
}
4 changes: 2 additions & 2 deletions tests/fixtures/test_enrichr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5821,7 +5821,7 @@
"species": "fish"
},
"expected_result": "ValueError",
"expected_msg": "Database 'pathway' is not supported for species 'fish'. Please select a database from the species-specific libraries listed at: https://maayanlab.cloud/FishEnrichr/#libraries."
"expected_msg": "Database 'pathway' is not supported for species 'fish'. Please select a database from the species-specific libraries listed at: https://maayanlab.cloud/FishEnrichr/#stats."
},
"test_enrichr_bad_background": {
"type": "error",
Expand Down Expand Up @@ -6310,4 +6310,4 @@
]
]
}
}
}

0 comments on commit 15717e8

Please sign in to comment.