This repository contains the code implementing the pipeline used to construct the MetaSRA database described in our publication: https://doi.org/10.1093/bioinformatics/btx334.
This pipeline re-annotates key-value descriptions of biological samples using biomedical ontologies.
The MetaSRA can be searched and downloaded from: https://metasra.platformx.wisc.edu/
This project is currently compatible with Python 3 and requires the following Python libraries:
- numpy (http://www.numpy.org)
- scipy (https://www.scipy.org/scipylib/)
- scikit-learn (http://scikit-learn.org/stable/)
- setuptools (https://pypi.python.org/pypi/setuptools)
- marisa-trie (https://pypi.python.org/pypi/marisa-trie)
- nltk (http://www.nltk.org/)
- singledispatch (https://pypi.python.org/pypi/singledispatch)
- pybktree (https://pypi.python.org/pypi/pybktree)
A conda environment specification is provided in the environment.yml file. To create the environment, run the following from the root directory of the repository:
conda create -n metasra -f environment.ymlThis will create a conda environment named metasra with the required dependencies. To activate the environment, run:
conda activate metasraThe nltk library requires the punkt tokenizer and stopwords to be downloaded. To do this, run:
python -c "import nltk; nltk.download('punkt_tab'); nltk.download('stopwords')"Finally, the PYTHONPATH environment variable must be set to include the current directory. This can be done by running:
export PYTHONPATH=$PYTHONPATH:$(pwd)In order to run the pipeline, a few external resources must be downloaded and configured. First, set up the PYTHONPATH environment variable as described above. Then, to set up the pipeline, run the following command:
python setup.py metasra_ref
Where metasra_ref is the name (of your choice) of the directory into which the resources will be downloaded. This script will download the latest ontology OBO files, the SPECIALIST Lexicon files, and configure the ontologies to work with the pipeline.
The pipeline can be run on a set of sample-specific key-value pairs using the run_pipeline.py script. This script is used as follows:
python run_pipeline.py -r metasra_ref <input key-value pairs JSON file>
The script accepts as input a JSON file storing a list of sets of key-value pairs. For example, the pipeline will accept a file with the following content:
[
{
"ID": "P352_141",
"age": "48",
"bmi": "24",
"gender": "female",
"source_name": "vastus lateralis muscle_female",
"tissue": "vastus lateralis muscle"
},
{
"ID": "P352_141",
"age": "29",
"bmi": "30",
"gender": "male",
"source_name": "vastus lateralis muscle_female",
"tissue": "vastus lateralis muscle"
}
]
For quick testing the above content can be found in the example.json file.