Skip to content

Commit

Permalink
Merge pull request #101 from pepkit/dev
Browse files Browse the repository at this point in the history
release 0.11.1
  • Loading branch information
khoroshevskyi committed Nov 29, 2022
2 parents 7934ed6 + 83a9cd4 commit 16794b6
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.7", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest]

steps:
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [0.11.1] -- 2022-11-28
- Fixed requirements file
- Fixed bug in expanding metadata list
- Fixed bug in metadata links

## [0.11.0] -- 2022-10-26
- Added initialization of peppy Project without saving any files (from within Python using an API)
- Added Finder (searching GSE tool)
Expand Down
2 changes: 1 addition & 1 deletion geofetch/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.11.0"
__version__ = "0.11.1"
31 changes: 21 additions & 10 deletions geofetch/geofetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ def fetch_all(self, input: str, name: str = None) -> Union[NoReturn, peppy.Proje
acc_GSE_list = parse_accessions(
input, self.metadata_expanded, self.just_metadata
)

if len(acc_GSE_list) == 1:
self.disable_progressbar = True
metadata_dict_combined = {}
subannotation_dict_combined = {}

Expand Down Expand Up @@ -829,8 +830,18 @@ def _expand_metadata_list_item(self, metadata_list: list, dict_key: str):
"""
try:
element_is_list = any(
type(list_item.get(dict_key)) is list for list_item in metadata_list
isinstance(list_item.get(dict_key), list) for list_item in metadata_list
)

# # checking if some items have two keys:
# # This code should deal with strings with few keys. e.g. "key1: key2: value"
# if not element_is_list:
# if any(
# (len(list_item.get(dict_key).split(": ")) > 0)
# for list_item in metadata_list
# ):
# element_is_list = True

if element_is_list:
for n_elem in range(len(metadata_list)):
try:
Expand Down Expand Up @@ -878,9 +889,10 @@ def _expand_metadata_list_item(self, metadata_list: list, dict_key: str):
else:
del metadata_list[n_elem][dict_key]
except KeyError as err:
self._LOGGER.warning(
f"expand_metadata_list: Key Error: {err}, continuing ..."
)
# self._LOGGER.warning(
# f"expand_metadata_list: Key Error: {err}, continuing ..."
# )
pass

return metadata_list
else:
Expand Down Expand Up @@ -1472,7 +1484,6 @@ def _get_list_of_processed_files(
self.metadata_expanded, gse_numb + "_file_list.txt"
)

# TODO: make new function of code below:
if not os.path.isfile(filelist_path) or self.refresh_metadata:
result = requests.get(tar_files_list_url)
if result.ok:
Expand Down Expand Up @@ -1702,8 +1713,8 @@ def _get_SRA_meta(self, file_gse_content: list, gsm_metadata, file_sra=None):
# If I can't get an SRA accession, maybe raw data wasn't submitted to SRA
# as part of this GEO submission. Can't proceed.
self._LOGGER.warning(
"\033[91mUnable to get SRA accession (SRP#) from GEO GSE SOFT file. "
"No raw data detected! Continuing anyway...\033[0m"
"Unable to get SRA accession (SRP#) from GEO GSE SOFT file. "
"No raw data detected! Continuing anyway..."
)
# but wait; another possibility: there's no SRP linked to the GSE, but there
# could still be an SRX linked to the (each) GSM.
Expand Down Expand Up @@ -1740,8 +1751,8 @@ def _get_SRA_meta(self, file_gse_content: list, gsm_metadata, file_sra=None):

except Exception as err:
self._LOGGER.warning(
f"\033[91mError occurred, while downloading SRA Info Metadata of {acc_SRP}. "
f"Error: {err} \033[0m"
f"Warning: error, while downloading SRA Info Metadata of {acc_SRP}. "
f"Error: {err}. Probably no SRA metadata found"
)
return []
else:
Expand Down
3 changes: 2 additions & 1 deletion geofetch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def parse_SOFT_line(l: str) -> dict:
:return dict[str, str]: A python Dict object representing the key-value.
"""
elems = l[1:].split("=")
return {elems[0].rstrip(): elems[1].lstrip()}
return {elems[0].rstrip(): "=".join(elems[1:]).lstrip()}


class AccessionException(Exception):
Expand Down Expand Up @@ -203,6 +203,7 @@ def fetch_metadata(
_LOGGER.debug("Fetching: '%s'", full_url)

result = requests.get(full_url)

if result.ok:
result.encoding = "UTF-8"
result_text = result.text
Expand Down
7 changes: 2 additions & 5 deletions requirements/requirements-all.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
attmap>=0.1.8
colorama>=0.3.9
peppy>=0.19.1
logmuse>=0.0.2
ubiquerg>=0.4.4
logmuse>=0.2.7
ubiquerg>=0.6.0
logmuse>=0.2.6
ubiquerg>=0.6.2
requests>=2.28.1
xmltodict>=0.13.0
pandas>=1.3.5
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
mock>=2.0.0
pytest==3.10.1

0 comments on commit 16794b6

Please sign in to comment.