1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
IMPORT reverse_complement(TEXT) FROM sequtil;
IMPORT get_feature_relationship_type_id(TEXT) sequence-cv-helper;
-----------------------------------
-- basic subsequencing functions --
-----------------------------------
DECLARE FUNCTION subsequence(
srcfeature_id INT REFERENCES feature(feature_id),
fmin INT,
fmax INT,
strand INT
)
RETURNS TEXT;
COMMENT ON FUNCTION subsequence(INT,INT,INT,INT) IS
'extracts a subsequence, reverse complementing if range <1';
DECLARE FUNCTION subsequence_by_feature (
feature_id INT REFERENCES feature(feature_id)
)
RETURNS TEXT;
COMMENT ON FUNCTION subsequence_by_feature(INT) IS
'extracts a subsequence for a feature, using featureloc (rank,group=0). The subsequence will be extracted from the featureloc.srcfeature from fmin to fmax, revcomping if required';
DECLARE FUNCTION subsequence_by_feature (
feature_id INT REFERENCES feature(feature_id),
rank INT,
locgroup INT
)
RETURNS TEXT;
COMMENT ON FUNCTION subsequence_by_feature(INT) IS
'extracts a subsequence for a feature, using featureloc (rank,group=0)';
-------------------------------------------------------
-- subsequences based on discontiguous featurelocs ---
-------------------------------------------------------
-- a feature can contain subfeatures (eg transcripts
-- containing exons and polypeptides)
-- these functions automatically extract the concatenated
-- sequence of the multiple featurelocs defined by the
-- subfeatures of any containing feature
-- ** typed relations **
-- here subfeatures are constrained by the type of the relationship
-- between subfeature and container feature
DECLARE FUNCTION subsequence_by_subfeatures(
feature_id INT REFERENCES feature(feature_id),
type_id INT REFERENCES cvterm(cvterm_id)
)
RETURNS TEXT;
COMMENT ON FUNCTION subsequence_by_subfeatures(INT,INT) IS 'extracts a
subsequence for a featureset. a featureset contains subfeatures, as
defined by feature_relationship (the set is the object of the
relation, the subfeature is the subject). the subfeatures are
constrained by the type_id of the feature_relationship (this allows
you to get the subsequence of a feature based on part_of featurelocs
only). The rank and locgroup are set to 0';
DECLARE FUNCTION subsequence_by_subfeatures(
feature_id INT REFERENCES feature(feature_id)
)
RETURNS TEXT;
COMMENT ON FUNCTION subsequence_set_by_subfeatures(INT,INT,INT,INT) IS
'See the 2-arg version of this function; the feature_relationship type
is set to part_of';
DECLARE FUNCTION subsequence_set_by_subfeatures(
feature_id INT REFERENCES feature(feature_id),
type_id INT REFERENCES cvterm(cvterm_id),
rank INT,
locgroup INT
)
RETURNS TEXT;
COMMENT ON FUNCTION subsequence_set_by_subfeatures(INT,INT,INT,INT) IS
'See the 2-arg version of this function; this allows the featurelocs
to be constrained by rank and locgroup';
-- ** typed subfeatures **
-- here subfeatures are constrained by their type; eg exon
DECLARE FUNCTION subsequence_by_typed_subfeatures(
feature_id INT REFERENCES feature(feature_id),
type_id INT REFERENCES cvterm(cvterm_id)
)
RETURNS TEXT;
COMMENT ON FUNCTION subsequence_set_by_typed_subfeatures(INT,INT) IS
'extracts a subsequence for a featureset. a featureset contains
subfeatures, as defined by feature_relationship (the set is the object
of the relation, the subfeature is the subject). the subfeatures are
constrained by a type_id (this allows you to get the subsequence of a
transcript based on exon featurelocs only). The rank and locgroup are
set to 0';
DECLARE FUNCTION subsequence_by_typed_subfeatures(
feature_id INT REFERENCES feature(feature_id),
type_id INT REFERENCES cvterm(cvterm_id),
rank INT,
locgroup INT
)
RETURNS TEXT;
COMMENT ON FUNCTION subsequence_by_typed_subfeatures(INT,INT,INT,INT) IS
'See the 2-arg version of this function; this allows the featurelocs
to be constrained by rank and locgroup';
|