-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexandre Masselot
committed
Aug 1, 2014
1 parent
9116df5
commit 12c6192
Showing
23 changed files
with
2,459 additions
and
2,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
/* | ||
* Copyright (c) 2013, Genentech Inc. | ||
* Authors: Alexandre Masselot, Kiran Mukhyala, Bioinformatics & Computational Biology | ||
*/ | ||
define(['backbone', '../models/PositionedFeature'], function(bb, PositionedFeature) { | ||
return bb.Collection.extend({ | ||
model : PositionedFeature, | ||
group : function() { | ||
var self = this; | ||
return _.groupBy(self.models, function(ft) { | ||
return (ft.groupSet ? (ft.groupSet + '/:') : '') + ft.category; | ||
define( | ||
/** | ||
@exports FeatureLayerCollection | ||
@author Alexandre Masselot | ||
@author Kiran Mukhyala | ||
@copyright 2013, Bioinformatics & Computational Biology Department, Genentech Inc. | ||
*/ | ||
['backbone', '../models/FeatureLayer'], function (bb, FeatureLayer) { | ||
/** | ||
* a collection of FeatureLayer, follows backbone collection mechanisms | ||
* @constructor | ||
* @augments Backbone.Collection | ||
*/ | ||
var FeatureLayerCollection = bb.Collection.extend( | ||
/** | ||
* @lends module:FeatureLayerCollection~FeatureLayerCollection.prototype | ||
*/ | ||
{ | ||
model: FeatureLayer | ||
|
||
}) | ||
} | ||
}) | ||
|
||
}) | ||
}); | ||
return FeatureLayerCollection; | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,40 @@ | ||
/* | ||
* Copyright (c) 2013, Genentech Inc. | ||
* Authors: Alexandre Masselot, Kiran Mukhyala, Bioinformatics & Computational Biology | ||
*/ | ||
define(['underscore', 'backbone'], function(_, bb) { | ||
var FeatureLayer = bb.Model.extend({ | ||
defaults : { | ||
visible : true | ||
}, | ||
initialize : function(options) { | ||
}, | ||
type : function() { | ||
return this.get('type') || this.get('name'); | ||
} | ||
}); | ||
|
||
return FeatureLayer; | ||
}); | ||
define( | ||
/** | ||
@exports FeatureLayer | ||
@author Alexandre Masselot | ||
@author Kiran Mukhyala | ||
@copyright 2013, Bioinformatics & Computational Biology Department, Genentech Inc. | ||
*/ | ||
['underscore', 'backbone'], function (_, bb) { | ||
|
||
/** | ||
* FeatureLayer regroups all the PositionedFeature of a same type | ||
* @constructor | ||
* @augments Backbone.Model | ||
* | ||
* @param {Map} options | ||
* @param {String} options.type is only compulsory member | ||
* @param {boolean} options.visible is the layer to be shown. Default is true | ||
*/ | ||
var FeatureLayer = bb.Model.extend( | ||
/** | ||
* @lends module:FeatureLayer~FeatureLayer.prototype | ||
*/ | ||
{ | ||
defaults: { | ||
visible: true | ||
}, | ||
initialize: function (options) { | ||
}, | ||
/** | ||
* The object type, based on the type or name attribute | ||
* | ||
* @return {String} the type key | ||
*/ | ||
type: function () { | ||
return this.get('type') || this.get('name'); | ||
} | ||
}); | ||
return FeatureLayer; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
/* | ||
* Copyright (c) 2013, Genentech Inc. | ||
* Authors: Alexandre Masselot, Kiran Mukhyala, Bioinformatics & Computational Biology | ||
*/ | ||
define(['underscore'], function(_) { | ||
var PositionedFeature = function(options) { | ||
var self = this; | ||
_.each(['start', 'end', 'type', 'category', 'description', 'displayTrack', 'text', 'groupSet'], function(name) { | ||
self[name] = options[name] | ||
}) | ||
} | ||
|
||
return PositionedFeature; | ||
}); | ||
define( | ||
/** | ||
@exports PositionedFeature | ||
@author Alexandre Masselot | ||
@author Kiran Mukhyala | ||
@copyright 2013, Bioinformatics & Computational Biology Department, Genentech Inc. | ||
*/ | ||
['underscore'], function (_) { | ||
/** | ||
* @class PositionedFeature, corresponding to the basic component to be displayed. There is no limit among the feature member. However, a few a given by default | ||
* @constructor | ||
* @param {Map} options | ||
* @param {int} options.start [compulsory] the starting position, (first one is 0) | ||
* @param {int} options.end [compulsory] the ending position | ||
* @param {String} options.type [compulsory] will be used to define how to draw the feature | ||
* @param {String} options.category [compulsory] all the feature below the same category are regrouped together | ||
* @param {String} options.groupSet a super category | ||
* @param {String} options.text a description to be displayed by default | ||
* | ||
*/ | ||
var PositionedFeature = function (options) { | ||
var self = this; | ||
_.each(['start', 'end', 'type', 'category', 'description', 'displayTrack', 'text', 'groupSet'], function (name) { | ||
self[name] = options[name] | ||
}) | ||
} | ||
|
||
return PositionedFeature; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,77 @@ | ||
/* | ||
* Copyright (c) 2013, Genentech Inc. | ||
* Authors: Alexandre Masselot, Kiran Mukhyala, Bioinformatics & Computational Biology | ||
*/ | ||
define(['underscore', 'backbone'], function(_, Backbone) { | ||
var SeqEntry = Backbone.Model.extend({ | ||
defaults : { | ||
define( | ||
/** | ||
@exports SeqEntry | ||
@author Alexandre Masselot | ||
@author Kiran Mukhyala | ||
@copyright 2013, Bioinformatics & Computational Biology Department, Genentech Inc. | ||
*/ | ||
['underscore', 'backbone'], function (_, Backbone) { | ||
/** | ||
* A SeqEntry object holds the sequence and the list of PositionedFeature | ||
* @constructor | ||
* @augments Backbone.Model | ||
* | ||
* @param {Map} options | ||
* @param {String} options.sequence is the layer to be shown. Default is true | ||
* @param {Array} options.features an array of object (will be mapped into PositionedFeature) | ||
*/ | ||
var SeqEntry = Backbone.Model.extend( | ||
/** | ||
* @lends module:SeqEntry~SeqEntry.prototype | ||
*/ | ||
{ | ||
defaults: { | ||
|
||
}, | ||
initialize : function() { | ||
this.set('features', []); | ||
}, | ||
length : function() { | ||
var seq = this.get('sequence'); | ||
return (seq === undefined) ? 0 : seq.length | ||
}, | ||
addFeatures : function(feats, options) { | ||
var self = this; | ||
options = options || {}; | ||
}, | ||
initialize: function () { | ||
this.set('features', []); | ||
}, | ||
/** | ||
* | ||
* @return {integer} sequence length | ||
*/ | ||
length: function () { | ||
var seq = this.get('sequence'); | ||
return (seq === undefined) ? 0 : seq.length | ||
}, | ||
/** | ||
* Add san array or a single feature to the seq entry. A 'change' event will be triggered by default. The Backbone view will be binded to such changes | ||
* @param {Array|Object} feats | ||
* @param {Map} options | ||
* @param {boolean} options.triggerChange defines is a 'change' event is to be fired (default is true) | ||
* @return {SeqEntry} | ||
*/ | ||
addFeatures: function (feats, options) { | ||
var self = this; | ||
options = options || {}; | ||
|
||
var triggerChange = options.triggerChange || (options.triggerChange === undefined); | ||
var triggerChange = options.triggerChange || (options.triggerChange === undefined); | ||
|
||
if (_.isArray(feats)) { | ||
_.each(feats, function(ft) { | ||
ft.start = parseInt(ft.start); | ||
ft.end = parseInt(ft.end); | ||
self.get('features').push(ft); | ||
}) | ||
if (triggerChange) | ||
self.trigger('change'); | ||
return self; | ||
} | ||
self.get('features').push(feats); | ||
if (triggerChange) | ||
self.trigger('change'); | ||
return self; | ||
}, | ||
clear : function() { | ||
this.get('features').length = 0 | ||
this.trigger('change'); | ||
return this; | ||
if (_.isArray(feats)) { | ||
_.each(feats, function (ft) { | ||
ft.start = parseInt(ft.start); | ||
ft.end = parseInt(ft.end); | ||
self.get('features').push(ft); | ||
}) | ||
if (triggerChange) | ||
self.trigger('change'); | ||
return self; | ||
} | ||
self.get('features').push(feats); | ||
if (triggerChange) | ||
self.trigger('change'); | ||
return self; | ||
}, | ||
/** | ||
* Removes all the features (and fire a 'change' event | ||
* @return {SeqEntry} | ||
*/ | ||
clear: function () { | ||
this.get('features').length = 0 | ||
this.trigger('change'); | ||
return this; | ||
|
||
} | ||
//urlRoot:'das/json' | ||
}) | ||
return SeqEntry; | ||
}) | ||
} | ||
}); | ||
return SeqEntry; | ||
}); |
Oops, something went wrong.