Giter Club home page Giter Club logo

solr-pubmed's Introduction

An Apache Solr based tool for fetching, indexing and searching PubMed/MEDLINE records.

Requirements

Anaconda is an easy to install Python distribution that doesn’t require root or local admin privileges.

If you use the default Python, make sure you have the python-dev package installed. It contains headers needed for building some of the Python packages.

virtualenv is recommended for create isolated Python development environments.

Get the code

This repo contains submodules, so use the following command to clone the repository and it's dependencies:

git clone --recursive https://github.com/Jlazo29/solr-pubmed.git

If you've already cloned the repository and you need to initialize the submodules you can run:

git submodule init
git submodule update

Installation

To install the project, go to the scripts folder and run install.sh

cd solr-pubmed
cd scripts
bash install.sh

Alternatively, you can install them by running maven and pip independently: 1)

	cd solr-pubmed
	mvn install

and then: 2)

cd solr-pubmed/solr-frontend
virtualenv .
source bin/activate
pip install -r requirements.txt

The build artifacts will be installed to your local maven repository (typically ~/.m2 on Unix systems or C:\Documents and Settings\{your-username}\.m2 on Windows). This is a one time installation only.

Starting the Solr Server and Frontend

To run the configured Solr instance on a local Jetty server, use the start.sh script. It accepts one argument only, either "run" or "stop":

bash start.sh run

Note that the Jetty server will keep running in the background, to terminate it you need to use the sript or run mvn jetty:stop in the solr-config folder.

Alternatively, the independant commands to run the solr server are: 1)

cd solr-pubmed/solr-config
mvn jetty:run-war

While the commands to run the frontend: 2)\

cd solr-pubmed/solr-frontend
python app.py

The Solr instance will run on http://localhost:8983/core0/ by default. The Flask server will run on http://localhost:5000 by default.

Downloading Pubmed and PMC records

To download the Pubmed/PMC files, you can use wget to download them directly from the ftp server:

The script download.sh will facilitate this; running bash download.sh pmc will download the whole pubmed open access subset through wget into the "files" folder. After it finishes, running bash download.sh medline will download the medline subset with the same configuration. You then need to extract them. Both of these bulk downloads are greater than 5GB so the time taken will depend on the download speed. You can also use wget to manually download smaller subsets, opening this script is a good example to start with.

Indexing the files

The indexing is done through the main class of ingestion.SolrUtils, inside the entrez-parsing folder. To compile and run it, simply run bash index.sh, this script takes 1 mandatory first argument and a optional second argument. The first one is the absolute path to the directory in which the XML files are located (if downloaded through the script they will be located in solr-pubmed/files). The second possible argument is "del" and it tells Solr to delete all the files previous to indexing.

Note that the Solr instance needs to be running in order for the indexing to take place, and SolrUtils will only work with XML files, all other files and compressed folders cannot be in the same folder.

If you're on Windows using the Anaconda python distribution, you may run into issues installing the MarkupSafe package. If so, you can solve this issue by modifying cygwinccompiler.py as desribed here: http://bugs.python.org/issue21821

The Flask server will run on http://localhost:5000 by default.

solr-pubmed's People

Contributors

jorgeluislazo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.