-
Notifications
You must be signed in to change notification settings - Fork 44
Genoverse.Track.Model functions
The following are functions that exist in the Genoverse.Track.Model
object. Any of these can have before/after hooks added to them unless otherwise specified, or be overwritten by supplying them as properties in configuration.
Sets initial properties of the instance. Does not have before/after hooks.
Returns an RTree of features for the given chromosome
Argument Type Description chr String The name of the chromosome to return features for
Returns an RTree of features for the given chromosome
Argument Type Description chr String The name of the chromosome to return data ranges for
Returns a URL string with placeholders for chromosome, start, end and assembly replaced. Chromosome, start and end placeholders are replaced from input arguments, while the assembly placeholder (if it exists) is replaced with the value of
genoverse.assembly
.
Argument Type Description chr String The name of the chromosome to use in the URL start Integer The start position to use in the URL end Integer The end position to use in the URL url String or undefined
The URL to parse. Defaults to the url
property
Makes jQuery.ajax GET request(s) to get data for the given genomic region (multiple requests may be made if
dataRequestLimit
is set.Returns a jQuery deferred object which is resolved when all of the jQuery.ajax requests are complete.
Argument Type Description chr String The name of the chromosome to get data for start Integer The start of the region to get data for end Integer The end of the region to get data for done Function or undefined
A callback to be executed on completion of each jQuery.ajax request performed
Called on successful completion of each successful attempt to get data made by
model.getData
. Callsmodel.setDataRange
andmodel.parseData
to process the data returned by the request.
Argument Type Description data Anything The data returned by the request in model.getData
chr String The name of the chromosome used in the request start Integer The start of the region used in the request end Integer The end of the region used in the request
Converts the data provided into features that Genoverse can use. Calls
model.insertFeature
for each feature produced from the data. By default,data
is expected to be an array of feature objects (the assumption is that the contents of theurl
is a JSON array). If that is not the case for a particular track, this function will need to be overwritten to handle the data structure being used.See
model.receiveData
for argument descriptions.
Inserts the given feature into the
features
RTree for the feature'schr
property
Argument Type Description feature Object The feature to be inserted
Inserts the given start and end into the
dataRanges
RTree for the givenchr
.dataRanges
are used to check whether data has already been received for a given region, in order to avoid making multiple requests for the same data (seemodel.checkDataRange
).
Argument Type Description chr String The name of the chromosome that data has been received for start Integer The start of the region that data has been received for end Integer The end of the region that data has been received for
Returns
true
if the track already has data for the whole of the given genomic region, else returnsfalse
.
Argument Type Description chr String The name of the chromosome to check start Integer The start of the region to check end Integer The end of the region to check
Returns an array of sorted features stored in the
features
RTree for the givenchr
. If the track has anyfeatureFilters
, the returned array will only contain those features which pass all of the filters.
Argument Type Description chr String The name of the chromosome to find features in start Integer The start of the region to find features in end Integer The end of the region to find features in
Sorts an array of features based on their
sort
property, lowest first. By default the value ofsort
is the feature'sstart
+ the index of the feature in the data array received bymodel.parseData
. This means that features are sorted by lowest start, with tie-breaking based on the original data source's ordering.This function can be overwritten to sort on different criteria.
Argument Type Description features Array An array of features to sort
If the track is using the
data
property, this function allows that data to be updated. The givendata
argument will completely overwrite the old value of the property, after which the track will bereset
.
Aborts all incomplete jQuery.ajax requests currently being made by the model instance