ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/bioseg/trunk/README.bioseg
(Generate patch)
# Line 20 | Line 20
20   INSTALLATION
21   ============
22  
23 < Change into the contrib directory in PostgreSQL and unpack the bioseg tar
24 < file:
23 > Change into the contrib directory in the PostgreSQL source and unpack the
24 > bioseg tar file:
25      gzip -d < bioseg-x.y.tar.gz | tar xf -
26  
27   (Or check-out from subversion with:
# Line 57 | Line 57
57   If you have a full installation of PostgreSQL, including the pg_config
58   program, bioseg can be unpacked anywhere and built like:
59  
60 +    make USE_PGXS=t clean
61      make USE_PGXS=t
62      make install USE_PGXS=t
63      (or: sudo make install USE_PGXS=t)
# Line 140 | Line 141
141          The segment [a, b] is contained in [c, d], that is,
142          a >= c and b <= d
143  
143 Although the mnemonics of the following operators is questionable, I
144 preserved them to maintain visual consistency with other geometric
145 data types defined in PostgreSQL.
146
144   Other operators:
145  
146   [a, b] < [c, d]         Less than
# Line 156 | Line 153
153          you want to use ORDER BY with this type
154  
155  
156 < NOTE: The performance of an R-tree index can largely depend on the
157 < order of input values. It may be very helpful to sort the input table
161 < on the BIOSEG column (see the script sort-segments.pl for an example)
156 > NOTE: The performance of an R-tree index can largely depend on the order of
157 > input values.  It may be helpful to sort the input table on the BIOSEG column.
158  
159  
160   INDEXES
# Line 170 | Line 166
166    CREATE TABLE tt (range bioseg, id integer);
167    CREATE INDEX tt_range_idx ON tt USING gist (range);
168  
169 + Or for an existing table a function index can be used.  For example on a
170 + feature table with fmin and fmax:
171 +
172 +  CREATE INDEX bioseg_index ON feature USING gist (bioseg_create(fmin, fmax));
173 +
174 + This query will then find features that overlap 2000..3000, using the index:
175 +
176 +  SELECT * FROM feature
177 +           WHERE '2000..3000'::bioseg && bioseg_create(fmin, fmax);
178 +
179  
180   INTERBASE COORDINATES
181   =====================
# Line 179 | Line 185
185   based" or "half-open intervals") run the build with INTERBASE_COORDS defined
186   in make, ie.:
187  
188 +    make clean
189      make INTERBASE_COORDS=t
190      make install INTERBASE_COORDS=t
191 +    (or: sudo make install INTERBASE_COORDS=t)
192  
193   This will compile and install the implementation for the "bioseg0" type.
194   The "0" in the name is a mnemonic for "0-based".
# Line 191 | Line 199
199  
200   The bioseg and bioseg0 types can be mixed in the same database.
201  
202 < Note
203 < ----
202 > Notes
203 > -----
204   In the interbase system '1..10'::bioseg0 and '10..20'::bioseg0 don't overlap,
205   whereas in the 1-based system '1..10'::bioseg and '10..20'::bioseg have a one
206   base overlap.  Also note that the length of '1..10'::bioseg0 is 9, whereas the
207   length of '1..10'::bioseg is 10.
208  
209 + Unlike the bioseg type the start and/or end of a bioseg0 can be negative, with
210 + the expected reults.
211 +  eg.   bioseg0_size('-10..10'::bioseg0) == 20
212 +
213   See:
214   http://www.gmod.org/wiki/index.php/Introduction_to_Chado#Interbase_Coordinates
215   for a longer discussion of the differences between the coordinate systems.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines