From 490d7c85b4cfa049c25db6c31a1f422de98ab3a1 Mon Sep 17 00:00:00 2001 From: Marina Kan Date: Wed, 23 Oct 2024 16:52:14 +0100 Subject: [PATCH 1/4] Fix description file path --- impc_module/pyproject.toml | 2 +- impc_module/setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/impc_module/pyproject.toml b/impc_module/pyproject.toml index 16d2aa6..c25061e 100644 --- a/impc_module/pyproject.toml +++ b/impc_module/pyproject.toml @@ -19,7 +19,7 @@ dependencies = [ "pydantic>=2.9" ] -readme = "README.md" +readme = "impc_module/README.md" requires-python = ">=3.10" [project.optional-dependencies] diff --git a/impc_module/setup.py b/impc_module/setup.py index ca06914..4b4d7e0 100644 --- a/impc_module/setup.py +++ b/impc_module/setup.py @@ -2,7 +2,7 @@ # Read the README file for the long description -with open("README.md", "r", encoding="utf-8") as fh: +with open("impc_module/README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( From c6d0d33e5ae849cb24d64cc7f4334e6e8c315e52 Mon Sep 17 00:00:00 2001 From: Marina Kan Date: Wed, 23 Oct 2024 17:10:00 +0100 Subject: [PATCH 2/4] Edit installation instructions --- impc_module/README.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/impc_module/README.md b/impc_module/README.md index 53556b5..7c86f6a 100644 --- a/impc_module/README.md +++ b/impc_module/README.md @@ -1,23 +1,27 @@ # IMPC_API -`impc_api` is a python package. +`impc_api` is a Python package. -The functions in this package are intended for use on a Jupyter Notebook. +The functions in this package are intended for use in a Jupyter Notebook. + +## Installation Instructions 1. **Create a virtual environment (optional but recommended)**: On Mac: - `python3 -m venv .venv` - `source .venv/bin/activate` + ```bash + python3 -m venv .venv + source .venv/bin/activate + ``` + +2. **Install the package**: `pip install impc_api` +3. **Install Jupyter**: `pip install jupyter` +4. **Run the Jupyter Notebook**: `jupyter notebook` -2. **Install the package running**: `pip install impc_api` -3. **Try it out**: Create a [Jupyter Notebook](https://jupyter.org/install#jupyter-notebook) and try some of the examples below: +After executing the command, the Jupyter interface should open in your browser. If it does not, follow the instructions provided in the terminal. -## Installing the package for the first time +5. **Try it out**: -1. Clone the repository and navigate into it. Navigate into the package name until you can see `setup.py` and `pyproject.toml` -2. Run `python3 -m build`, this builds the package, a couple of new files/folders will appear. -3. Install the package running `pip install .` -4. Try it out: Go to Jupyter Notebook and some examples below: +Create a [Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/latest/) and try some of the examples below: ### Available functions From 721b9a8e73f42e0fb714cdcfcf0f4ae6d86e295f Mon Sep 17 00:00:00 2001 From: Marina Kan Date: Wed, 23 Oct 2024 17:12:07 +0100 Subject: [PATCH 3/4] Change headers level --- impc_module/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/impc_module/README.md b/impc_module/README.md index 7c86f6a..f0dbef7 100644 --- a/impc_module/README.md +++ b/impc_module/README.md @@ -23,7 +23,7 @@ After executing the command, the Jupyter interface should open in your browser. Create a [Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/latest/) and try some of the examples below: -### Available functions +## Available functions The available functions can be imported as: @@ -31,7 +31,7 @@ The available functions can be imported as: from impc_api import solr_request, batch_solr_request ``` -## 1. Solr request +# 1. Solr request The most basic request to the IMPC solr API @@ -46,7 +46,7 @@ num_found, df = solr_request( ) ``` -### a. Facet request +## a. Facet request `solr_request` allows facet requests @@ -64,11 +64,11 @@ num_found, df = solr_request( ) ``` -### b. Solr request validation +## b. Solr request validation A common pitfall when writing a query is the misspelling of `core` and `fields` arguments. For this, we have included a `validate` argument that raises a warning when these values are not as expected. Note this does not prevent you from executing a query; it just alerts you to a potential issue. -#### Core validation +### Core validation ```python num_found, df = solr_request( @@ -84,7 +84,7 @@ num_found, df = solr_request( > dict_keys(['experiment', 'genotype-phenotype', 'impc_images', 'phenodigm', 'statistical-result']) ``` -#### Field list validation +### Field list validation ```python num_found, df = solr_request( @@ -100,7 +100,7 @@ num_found, df = solr_request( > To see expected fields check the documentation at: https://www.ebi.ac.uk/mi/impc/solrdoc/ ``` -## 2. Batch Solr Request +# 2. Batch Solr Request `batch_solr_request` is available for large queries. This solves issues where a request is too large to fit into memory or where it puts a lot of strain on the API. @@ -110,11 +110,11 @@ Use `batch_solr_request` for: - Querying multiple items in a list - Downloading data in `json` or `csv` format. -### Large queries +## Large queries For large queries you can choose between seeing them in a DataFrame or downloading them in `json` or `csv` format. -### a. Large query - see in DataFrame +## a. Large query - see in DataFrame This will fetch your data using the API responsibly and return a Pandas DataFrame @@ -132,7 +132,7 @@ df = batch_solr_request( print(df.head()) ``` -### b. Large query - Download +## b. Large query - Download When using the `download=True` option, a file with the requested information will be saved as `filename`. The format is selected based on the `wt` parameter. A DataFrame may be returned, provided it does not exceed the memory available on your laptop. If the DataFrame is too large, an error will be raised. For these cases, we recommend you read the downloaded file in batches/chunks. @@ -151,7 +151,7 @@ df = batch_solr_request( print(df.head()) ``` -### c. Query by multiple values +## c. Query by multiple values `batch_solr_request` also allows to search multiple items in a list provided they belong to them same field. Pass the list to the `field_list` param and specify the type of `fl` in `field_type`. From 2b4146498805cdd9bfc15145d5eae1bfbd6f9148 Mon Sep 17 00:00:00 2001 From: Marina Kan Date: Thu, 24 Oct 2024 12:43:16 +0100 Subject: [PATCH 4/4] Remove long_description_content_type --- impc_module/pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/impc_module/pyproject.toml b/impc_module/pyproject.toml index c25061e..2b92fb9 100644 --- a/impc_module/pyproject.toml +++ b/impc_module/pyproject.toml @@ -6,7 +6,6 @@ build-backend = "setuptools.build_meta" name = "impc_api" version = "1.0.1" description = "A package to facilitate making API requests to the IMPC Solr API" -long_description_content_type = "text/markdown" authors = [ { name = "MPI2" }, { name = "Marina Kan" },