Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper class to streamline access to expressions and metadata #225

Merged
merged 1 commit into from
Nov 23, 2020

Conversation

robertcv
Copy link
Contributor

This partially implements spec.

What is implemented:

  • extend ReSDK API similar to "Alternative 3" with some exceptions:
    • selection of the used collection is moved to class initialization as holding multiple collections in a single object seems a bit messy
    • instead of the name ResolweBio I used CollectionTables as this class functionality is, in a nutshell, exporting collections as tables of data
  • fetching expressions, counts, metadata from ReSDK server
  • caching data in memory and on disc as long as modified on samples doesn't change
  • returned tables have samples in rows and gene symbols for columns

Copy link
Member

@JureZmrzlikar JureZmrzlikar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, i have some smaller comments. Will try to play with it after lunch to see it in action :-)

src/resdk/utils/table_cache.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
src/resdk/collection_tables.py Outdated Show resolved Hide resolved
src/resdk/collection_tables.py Show resolved Hide resolved
src/resdk/collection_tables.py Show resolved Hide resolved
src/resdk/collection_tables.py Outdated Show resolved Hide resolved
src/resdk/collection_tables.py Outdated Show resolved Hide resolved
src/resdk/collection_tables.py Outdated Show resolved Hide resolved
Copy link
Member

@JureZmrzlikar JureZmrzlikar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I have a few additional small comments...

Please rebase to latest master to see if tests pass. You will probably see that you need to format your docstrings according to PEP8 and PEP257.

src/resdk/collection_tables.py Outdated Show resolved Hide resolved
src/resdk/collection_tables.py Outdated Show resolved Hide resolved
src/resdk/collection_tables.py Outdated Show resolved Hide resolved
src/resdk/collection_tables.py Outdated Show resolved Hide resolved
src/resdk/collection_tables.py Outdated Show resolved Hide resolved
src/resdk/collection_tables.py Show resolved Hide resolved
@robertcv robertcv force-pushed the collection_tables branch 2 times, most recently from 5292235 to 26eb57f Compare November 16, 2020 12:18
@codecov-io
Copy link

codecov-io commented Nov 16, 2020

Codecov Report

Merging #225 (153d705) into master (5c0f624) will increase coverage by 2.85%.
The diff coverage is 99.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #225      +/-   ##
==========================================
+ Coverage   77.86%   80.72%   +2.85%     
==========================================
  Files          25       27       +2     
  Lines        1455     1619     +164     
==========================================
+ Hits         1133     1307     +174     
+ Misses        322      312      -10     
Impacted Files Coverage Δ
src/resdk/utils/table_cache.py 96.66% <96.66%> (ø)
src/resdk/collection_tables.py 100.00% <100.00%> (ø)
src/resdk/__about__.py 84.61% <0.00%> (+84.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c0f624...153d705. Read the comment docs.

Copy link
Member

@JureZmrzlikar JureZmrzlikar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertcv This looks good for MVP, please make linters happy to ensure that tests pass. Thanks for your contribution!

@JureZmrzlikar JureZmrzlikar merged commit 153d705 into genialis:master Nov 23, 2020

def _get_gene_map(self, ensembl_ids: List[str]) -> dict:
"""Fetch gene mapping from resolwe server."""
sublists = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return {
    feature.feature_id: feature.name
    for feature in self.resolwe.feature.filter(
        feature_id__in=ensembl_ids,
        species=self._table_samples[0].metadata["general"]["species"],
        fields=["feature_id", "name"],
    ).iterate(CHUNK_SIZE)
}

@robertcv robertcv deleted the collection_tables branch August 26, 2021 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants