Difference between revisions of "Bioscape Development"
PaulBoddie (talk | contribs) (→Adding New Search Result Types: Add policy class note.) |
PaulBoddie (talk | contribs) m (Moved note to a separate page.) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | {{:Bioscape Status}} | |
− | |||
− | |||
− | |||
− | |||
== Bioscape Development == | == Bioscape Development == | ||
Line 38: | Line 34: | ||
<li>Add convenience functions to the <tt>bsindex.search</tt> package.</li> | <li>Add convenience functions to the <tt>bsindex.search</tt> package.</li> | ||
<li>Modify the <tt>bsindex_quickstart.py</tt> script (in <tt>bsindex</tt>) to configure the export of an appropriate search cache for the new result type, or to create a new search cache for the new type.</li> | <li>Modify the <tt>bsindex_quickstart.py</tt> script (in <tt>bsindex</tt>) to configure the export of an appropriate search cache for the new result type, or to create a new search cache for the new type.</li> | ||
+ | <li>The database import template should not normally need modifying but can be found in the <tt>bioscape/sql/search</tt> directory (in the <tt>bsadmin</tt> distribution).</li> | ||
+ | <li>Add a translation for the constant in the <tt>bsweb/Resources/translations.xml</tt> file (in the <tt>bsweb</tt> distribution).</li> | ||
</ol> | </ol> | ||
Line 80: | Line 78: | ||
<li>Add functions to the <tt>scripts/bioscape_quickstart.py</tt> script to support the new data type.</li> | <li>Add functions to the <tt>scripts/bioscape_quickstart.py</tt> script to support the new data type.</li> | ||
</ol> | </ol> | ||
+ | |||
+ | See the [[Bioscape Data Sources]] document for more information about the structure of data sources. | ||
=== Adding New Word Lists for Searching === | === Adding New Word Lists for Searching === |
Latest revision as of 13:48, 14 July 2010
Note | Please note that this documentation covers an unreleased product and is for internal use only. |
Contents
Bioscape Development
This document describes a selection of different development tasks undertaken when improving Bioscape.
Adding New Scoring Methods
The following steps should be sufficient to define and make available a new scoring method.
- Add a new entry to the bioscape/sources/score/Resources/methods.txt file in the bsadmin distribution.
- Add new templates for scoring to the appropriate subdirectory of the bioscape/sql directory. For example, for a result score, add importdb-N.sql.in to the bioscape/sql/resultscore directory for a method called N.
- Create a new record in the text_method table. In PostgreSQL this can be done using a COPY command together with a file containing new lines from the methods.txt file.
Adding New Search Result Types
Defining new kinds of search results involves a number of modifications:
- Add a constant in bioscape.constants (found in bsadmin) for the new search result type if appropriate. For example...
text_termtype_gene_ontology_term = 13
...for predefined search result types, or...
text_termid_chromosome = -3
...for speculative search result types. - Add infrastructure to acquire and to emit the results, such as classes in modules within the bsindex.search package (found in bsindex). Such classes may include a phrase class in bsindex.search.phrases and a policy class in bsindex.search.policies, if the data of interest is found in an unconventional way.
- Add convenience functions to the bsindex.search package.
- Modify the bsindex_quickstart.py script (in bsindex) to configure the export of an appropriate search cache for the new result type, or to create a new search cache for the new type.
- The database import template should not normally need modifying but can be found in the bioscape/sql/search directory (in the bsadmin distribution).
- Add a translation for the constant in the bsweb/Resources/translations.xml file (in the bsweb distribution).
Adding New Data Sources and Types
Defining new kinds of data types involves a number of modifications:
- Add a new data source module. For example, for a "pure data" source (in bsadmin) involving only the database:
bioscape.sources.chebi
For a "data plus indexed text" source (in bsindex):
bsindex.sources.pmcweb
This involves the usual creation of a Python package at the appropriate place in the directory hierarchy and with an __init__.py file to indicate that a package (or subpackage) is present. - Define a module which retrieves data from the actual source:
bioscape.sources.chebi.download
- Define a module which parses the downloaded data:
bioscape.sources.chebi.parse
- Add templates to implement the database schema for the data type, along with templates which support the import and update of such data. For example, within the bioscape/sql/chebi directory:
init.sql.in drop.sql.in init-constraints.sql.in drop-constraints.sql.in import.sql.in
- Define configuration settings for the locations and details used in the above modules. For example...
chebi_ftp_address chebi_data_directory
- Add functions to the scripts/bioscape_quickstart.py script to support the new data type.
See the Bioscape Data Sources document for more information about the structure of data sources.
Adding New Word Lists for Searching
New lists of words which shall be searched as part of finding contextual information can be added as follows:
- Define a list of words in the Resources subdirectory of the bioscape.sources.bioentities package.
- Write a database template to import the data into the appropriate tables. For example, in the bioscape/sql/bioentities directory:
import-adjectives-pgsql.sql.in
This will make the new search terms available. - The search result type can then be added as described above.
Database Constants
Some constant values stored in the database are referenced explicitly in various parts of the software. For such values, it is most convenient to define them in the bioscape.constants module and to reference them in the database templates used to initialise and populate the database.
Other kinds of values may not be referenced in the source code in this way, and may also belong to data sets which may change over time (thus being only the initial values in a data set, rather than true constants). Such values should instead be defined in files which are used to import data into the database.