Skip to content

Commit

Permalink
Update overlaps.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
Julie Sullivan committed Jan 6, 2015
1 parent d9b1951 commit e0bacdb
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions docs/data-model/overlaps.rst
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
Querying over genomic ranges
================================

InterMine includes functionality for querying features with overlapping genome coordinates. We have a custom `BIOSEG` index for postgres that is created on the `Location` table. This is used by a 'virtual' `SequenceFeature.overlappingFeatures` collection that is a `view` in the postgres database using the `BIOSEG` index to find other features that overlap it.
.. note::

Starting with InterMine 1.4 Bioseg is no longer required if you are using Postgres version 9.2 or later.

In modMine (the InterMine for the modENCODE project] we also create `GeneFlankingRegion` features to represent specific distances upstream and downstream of genes to query for genes that are nearby other features.
InterMine includes functionality for querying features with overlapping genome coordinates. We have a custom `BIOSEG` index for postgres that is created on the `Location` table. This is used by a 'virtual' `SequenceFeature.overlappingFeatures` collection that is a `view` in the postgres database using the `BIOSEG` index to find other features that overlap it.

To use the overlapping queries in InterMine you need to:
In modMine (the InterMine for the modENCODE project) we also create `GeneFlankingRegion` features to represent specific distances upstream and downstream of genes to query for genes that are nearby other features.

Install BIOSEG
-------------------
Install BIOSEG (Postgres versions 9.1 and older only)
--------------------------------------------------------------------------------------------------

`BIOSEG` is a custom index type that you need to add to postgres. See :doc:`/system-requirements/software/postgres/bioseg` for details

Create the BIOSEG index
---------------------------
Create the index
--------------------------------------------------------------------------------------------------

You need to create the bioseg index on the location table in your production database. This is done simply by adding the `create-bioseg-location-index` post-process step to your `project.xml` file:
You need to create the index on the location table in your production database. This is done simply by adding the `create-location-range-index` post-process step to your `project.xml` file:

.. code-block:: xml
<post-process name="create-bioseg-location-index"/>
<post-process name="create-location-range-index"/>
If you are using an older version of Postgres, this will create a BIOSEG index. Otherwise it will use a native Postgres index.

Create the `overlappingFeatures` view
-------------------------------------------
--------------------------------------------------------------------------------------------------

Now create the view in the `SequenceFeature.overlappingFeatures` view in the database. This allows you to query for any features that overlap any other types of features in the web interface or query API. Just add the `create-overlap-view` post-process step, it needs to be after `create-bioseg-location-index`.
Now create the `SequenceFeature.overlappingFeatures` view in the database. This allows you to query for any features that overlap any other types of features in the web interface or query API. Just add the `create-overlap-view` post-process step, it needs to be after `create-location-range-index`.

.. code-block:: xml
<post-process name="create-overlap-view" />
See FlyMine's project.xml for an example of including these steps.


Now any queries on the `overlappingFeatures` collections will use this view and bioseg.

Now any queries on the `overlappingFeatures` collections will use this view and the new index.

.. index:: overlaps, region search, bioseg, genome coordinates, overlappingFeatures, create-overlap-view, create-bioseg-location-index

0 comments on commit e0bacdb

Please sign in to comment.