Package: ensembl-valuesets
Ensembl Python TemplateEnsembl ValueSet API Project.This repo contains code for the ValueSets API app.
The ValueSets API expose gRPC end points for providing information
about Ensembl Value Sets.An EnsemblValueSetis a collection of key/value pairs that are related to a given topic.
For example, biotypes, APPRIS annotation terms, or transcript support level (TSL) definitions.A ValueSet item should have the following fields:accession_id(str): value set unique identifier - e.g. "mane.select"label(str): short human friendly name - e.g. "MANE Select"value(str): short machine friendly name - e.g. "select"definition(str): short description - e.g. "A Transcript which is matched between Ensembl/GENCODE and RefSeq as part of the MANE project"description(str|None): optional and verbose definition - e.g. "The Matched Annotation from NCBI and EMBL-EBI is a collaboration between Ensembl/GENCODE and RefSeq. The MANE Select is a default transcript per human gene that is representative of biology, well-supported, expressed and highly-conserved. This transcript set matches GRCh38 and is 100% identical between RefSeq and Ensembl/GENCODE for 5' UTR, CDS, splicing and 3'UTR."Requirementspyenv (with pyenv-virtualenv plugin)Python 3.10+grpciogrpcio-tools 1.30+openpyxl 3.*+ (optional)poetryPython packagesTestpytestpylintmypyDocsSphinxmocksphinx-rtd-themeDevipythonblackGetting StartedClone this repo:git clone --depth 1 -b main https://github.com/Ensembl/ensembl-valuesets-api.gitInstall the python part (of the pipelines) and test it:pip install ./ensembl-valuesets-api

# test
# do something!Run the server, listening on default port 50051:python scripts/run_server.pyTest the server with the provided basic client:python scripts/client.pyOptional installationIf you need to install "editable" python package use '-e' optionpip install -e ./ensembl-valuesets-apiThe following files (or folder names) will need to be modified:docs/conf.py: Change accordigly to project's namedocs/install.rst: Change installation instructions accordinglyREADME.md: Write a meaningful README for your projectOnce done with the basic customisation, create the initial commit:cd <NEW_PROJECT_NAME>
git add .
git commit -m 'Initial commit'Installing the development environment (with Pyenv)pyenv virtualenv 3.8 <VIRTUAL-ENVIRONMENT-NAME>
cd <NEW_PROJECT_NAME>
pyenv local <VIRTUAL-ENVIRONMENT-NAME>
pip install -r requirements-dev.txt
pip install -e .TestingRun test suite:cd <NEW_PROJECT_NAME>
pytestTo run tests, calculate and display testing coverage stats:cd <NEW_PROJECT_NAME>
coverage run -m pytest
coverage report -mGenerate documentationcd <NEW_PROJECT_NAME>
./scripts/build_docs.shOpen automatically generated documentation page atdocs/_build/html/index.htmlAutomatic Formattingcd <NEW_PROJECT_NAME>
black --check src testsUse--diffto print a diff of what Black would change, without actually changing the files.To actually reformat all files contained insrcandtest:cd <NEW_PROJECT_NAME>
black src testsLinting and type checkingcd <NEW_PROJECT_NAME>
pylint src tests
mypy src testsPylint will check the code for syntax, name errors and formatting style.
Mypy will use type hints to statically type check the code.It should be relatively easy (and definitely useful) to integrate bothpylintandmypyin your IDE/Text editor.Project setup with poetryClone this repo:git clone --depth 1 -b main https://github.com/Ensembl/ensembl-valuesets-api.gitNavigate to repo directory and create virtual environmentpoetry env use python3Verify when virtual environment is activated or notpoetry env listInstall the dependenciespoetry installRun the grpc and rest server from project directorypoetry run python3 -m src.grpc.ensembl.server
poetry run python3 -m uvicorn src.rest.server:appTest the rest endpointscurl --location --request GET 'http://localhost:8000/api/valuesets/accession_id/mane.select'
curl --location --request GET 'http://localhost:8000/api/valuesets/value/amino_acid_alphabet?is_current=true'
curl --location --request GET 'http://localhost:8000/api/valuesets?is_current=false'Installing from pypiResourcesPython DocumentationOfficial Python DocsPython distributions and virtual environments managementPyenv docsPyenv virtualenv docsAuto-generating documentationSpinx DocsLinting, type checking and formattingPylintMypyBlackGoogle Python Style GuideTestingpytestCoverageDevelopment toolsIPythonDistributingPackaging PythonApache 2.0 LicenseSemantic Versioning