Skip to content

Commit

Permalink
Merge branch 'jbrowse_1.7' into add_files
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Nov 17, 2012
2 parents 336faeb + 8231dc2 commit 9c134c9
Show file tree
Hide file tree
Showing 16 changed files with 197 additions and 115 deletions.
2 changes: 1 addition & 1 deletion plugins/WebApollo/css/main.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import url("../jslib/jqueryui/themes/base/jquery.ui.all.css");
@import url("genome.css");
@import url("webapollo_track_styles.css");
@import url("add_sequence_alteration.css");
@import url("edit_dbxrefs.css");
@import url("edit_comments.css");
@import url("get_sequence.css");
@import url("search_sequence.css");
@import url("../jslib/jqueryui/themes/base/jquery.ui.all.css");
5 changes: 4 additions & 1 deletion plugins/WebApollo/css/webapollo_track_styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,7 @@ div.generic_parent-hist {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
background-color: transparent;
}

.ogsv3-CDS,
Expand Down Expand Up @@ -2343,6 +2344,7 @@ div.generic_parent-hist {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
background-color: transparent;
/* not needed? residues overlay is on .annot, so that's where text selection needs to be disabled
-moz-user-select: none;
-khtml-user-select: none;
Expand Down Expand Up @@ -2420,7 +2422,8 @@ div.generic_parent-hist {
position: absolute;
height: 16px;
z-index: 100;
background-image: url('img/exclamation_circle_orange.png');
background-image: url('../img/exclamation_circle_orange.png');
/* background-image: url('img/exclamation_circle_orange.png'); */
/* background-image: url('img/warning_exclamation_small.png'); */
/* background-image: url('img/warning_exclamation.png'); */
/* background-image: url('img/marker_rounded_red.png'); */
Expand Down
2 changes: 1 addition & 1 deletion plugins/WebApollo/js/FeatureEdgeMatchManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var FeatureEdgeMatchManager = declare( null,
SHOW_EDGE_MATCHES: true,

setBrowser: function( browser ) {
browser.subscribe('/jbrowse/v1/v/redraw', dojo.hitch( this, function() {
browser.subscribe('/jbrowse/v1/n/redraw', dojo.hitch( this, function() {
var selected = this.featSelectionManager;
var annot_selected = this.annotSelectionManager;
this.selectionCleared();
Expand Down
10 changes: 8 additions & 2 deletions plugins/WebApollo/js/Store/SeqFeature/ScratchPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ return declare( SeqFeatureStore,
this._calculateStats();
},

/*
delete: function( feature ) {
delete this.features[ feature.id() ];
this.deleteFeatureById[ feature.id() ];
},
*/

deleteFeatureById: function( id ) {
delete this.features[ id ];
this._calculateStats();
},

/* if feature with given id is present in store, return it. Otherwise return null */
contains: function( id ) {
getFeatureById: function( id ) {
return this.features[ id ];
},

Expand Down
68 changes: 21 additions & 47 deletions plugins/WebApollo/js/View/Track/AnnotTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define( [
'jquery',
'jqueryui/draggable',
'jqueryui/droppable',
'jqueryui/resizable',
'dijit/Menu',
'dijit/MenuItem',
'dijit/Dialog',
Expand All @@ -14,7 +15,7 @@ define( [
'JBrowse/Model/SimpleFeature',
'JBrowse/Util'
],
function( declare, $, draggable, droppable, dijitMenu, dijitMenuItem, dijitDialog, DraggableFeatureTrack, FeatureSelectionManager, JSONUtils, BioFeatureUtils, Permission, SimpleFeature, Util ) {
function( declare, $, draggable, droppable, resizable, dijitMenu, dijitMenuItem, dijitDialog, DraggableFeatureTrack, FeatureSelectionManager, JSONUtils, BioFeatureUtils, Permission, SimpleFeature, Util ) {

var listeners = [];

Expand Down Expand Up @@ -100,8 +101,6 @@ var AnnotTrack = declare( DraggableFeatureTrack,
this.verbose_mouseleave = false;
this.verbose_render = false;

// this.inherited( arguments );

var track = this;
// for AnnotTrack, features currently MUST be an NCList
// var features = this.features;
Expand Down Expand Up @@ -193,8 +192,6 @@ var AnnotTrack = declare( DraggableFeatureTrack,

createAnnotationChangeListener: function() {
var track = this;
var features = this.features;

if (listeners[track.getUniqueTrackName()]) {
if (listeners[track.getUniqueTrackName()].fired == -1) {
listeners[track.getUniqueTrackName()].cancel();
Expand Down Expand Up @@ -293,11 +290,9 @@ var AnnotTrack = declare( DraggableFeatureTrack,

addFeatures: function(responseFeatures) {
for (var i = 0; i < responseFeatures.length; ++i) {
// var featureArray = JSONUtils.createJBrowseFeature(responseFeatures[i], this.fields, this.subFields);
var feat = JSONUtils.createJBrowseFeature( responseFeatures[i] );
var id = responseFeatures[i].uniquename;
// if (this.features.featIdMap[id] == null) {
if (! this.store.contains(id)) {
if (! this.store.getFeatureById(id)) {
// note that proper handling of subfeatures requires annotation trackData.json resource to
// set sublistIndex one past last feature array index used by other fields
// (currently Annotations always have 6 fields (0-5), so sublistIndex = 6
Expand All @@ -309,7 +304,7 @@ var AnnotTrack = declare( DraggableFeatureTrack,
deleteFeatures: function(responseFeatures) {
for (var i = 0; i < responseFeatures.length; ++i) {
var id_to_delete = responseFeatures[i].uniquename;
this.store.delete(id_to_delete);
this.store.deleteFeatureById(id_to_delete);
}
},

Expand Down Expand Up @@ -436,7 +431,10 @@ var AnnotTrack = declare( DraggableFeatureTrack,
if (verbose_resize || track.verbose_mousedown) { console.log("AnnotTrack.onAnnotMouseDown called"); }
event = event || window.event;
var elem = (event.currentTarget || event.srcElement);
var featdiv = DraggableFeatureTrack.prototype.getLowestFeatureDiv(elem);
// need to redo getLowestFeatureDiv
// var featdiv = DraggableFeatureTrack.prototype.getLowestFeatureDiv(elem);
var featdiv = track.getLowestFeatureDiv(elem);

if (featdiv && (featdiv != null)) {
if (dojo.hasClass(featdiv, "ui-resizable")) {
if (verbose_resize) {
Expand All @@ -450,9 +448,14 @@ var AnnotTrack = declare( DraggableFeatureTrack,
console.log(featdiv);
}
var scale = track.gview.bpToPx(1);

var gridvals = false;
// if zoomed int to showing sequence residues, then make edge-dragging snap to interbase pixels
if (scale === track.browserParams.charWidth) { var gridvals = [track.browserParams.charWidth, 1]; }
else { var gridvals = false; }

// GAH TODO JBrowse1.7 merge -- restore grid snap when resolve charWidth
// if (scale === track.browserParams.charWidth) { var gridvals = [track.browserParams.charWidth, 1]; }
// else { var gridvals = false; }

$(featdiv).resizable( {
handles: "e, w",
helper: "ui-resizable-helper",
Expand Down Expand Up @@ -534,13 +537,15 @@ var AnnotTrack = declare( DraggableFeatureTrack,
// event.stopPropagation();
},

addToAnnotation: function(annot, feats_to_add) {
/* feature_records ==> { feature: the_feature, track: track_feature_is_from } */
addToAnnotation: function(annot, feature_records) {
var target_track = this;

var subfeats = new Array();
var allSameStrand = 1;
for (var i = 0; i < feats_to_add.length; ++i) {
var feat = feats_to_add[i];
for (var i = 0; i < feature_records.length; ++i) {
var feature_record = feature_records[i];
var feat = feature_record.feature;
var isSubfeature = !! feat.parent(); // !! is shorthand for returning true if value is defined and non-null
var annotStrand = annot.get('strand');
if (isSubfeature) {
Expand All @@ -555,7 +560,7 @@ var AnnotTrack = declare( DraggableFeatureTrack,
subfeats.push(featToAdd);
}
else {
var source_track = feat.track;
var source_track = feature_record.track;
// if (source_track.fields["subfeatures"]) {
if ( feat.get('subfeatures') ) {
// var subs = feat[source_track.fields["subfeatures"]];
Expand Down Expand Up @@ -677,7 +682,6 @@ var AnnotTrack = declare( DraggableFeatureTrack,

createAnnotations: function(selection_records) {
var target_track = this;
var features_nclist = target_track.features;
var featuresToAdd = new Array();
var parentFeatures = new Object();
for (var i in selection_records) {
Expand Down Expand Up @@ -730,33 +734,6 @@ var AnnotTrack = declare( DraggableFeatureTrack,
}
}

/*
{
var source_track = dragfeat.track;
if (this.verbose_create) {
console.log("creating annotation based on feature: ");
console.log(dragfeat);
}
var dragdiv = source_track.getFeatDiv(dragfeat);
var newfeat = JSONUtils.convertToTrack(dragfeat, source_track, target_track);
var source_fields = source_track.fields;
var source_subFields = source_track.subFields;
var target_fields = target_track.fields;
var target_subFields = target_track.subFields;
if (this.verbose_create) {
console.log("local feat conversion: " );
console.log(newfeat);
}
var afeat = JSONUtils.createApolloFeature(source_track.attrs, dragfeat, "transcript");
featuresToAdd.push(afeat);
}
*/

dojo.xhrPost( {
postData: '{ "track": "' + target_track.getUniqueTrackName() + '", "features": ' + JSON.stringify(featuresToAdd) + ', "operation": "add_transcript" }',
url: context_path + "/AnnotationEditorService",
Expand Down Expand Up @@ -861,7 +838,6 @@ var AnnotTrack = declare( DraggableFeatureTrack,

deleteAnnotations: function(selection_records) {
var track = this;
// var features_nclist = track.features;
var features = '"features": [';
var uniqueNames = [];
for (var i in selection_records) {
Expand Down Expand Up @@ -1683,7 +1659,6 @@ var AnnotTrack = declare( DraggableFeatureTrack,

undoSelectedFeatures: function(annots) {
var track = this;
var features_nclist = track.features;
var features = '"features": [';
for (var i in annots) {
var annot = AnnotTrack.getTopLevelAnnotation(annots[i]);
Expand Down Expand Up @@ -1744,7 +1719,6 @@ var AnnotTrack = declare( DraggableFeatureTrack,

redoSelectedFeatures: function(annots) {
var track = this;
var features_nclist = track.features;
var features = '"features": [';
for (var i in annots) {
var annot = AnnotTrack.getTopLevelAnnotation(annots[i]);
Expand Down
2 changes: 2 additions & 0 deletions plugins/WebApollo/js/View/Track/DraggableHTMLFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ var draggableTrack = declare( HTMLFeatureTrack,
}
}

/*
// try to make a wholeCDS if we don't have one
if( ! wholeCDS ) {
wholeCDS = (function() {
Expand All @@ -361,6 +362,7 @@ var draggableTrack = declare( HTMLFeatureTrack,
}
}).call(this);
}
*/

if (wholeCDS) {
var cdsStart = wholeCDS.get('start');
Expand Down
35 changes: 35 additions & 0 deletions plugins/WebApollo/tests/selenium_tests/lib/WebApolloTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
import sys
import time
sys.path.append( 'tests/selenium_tests' ) # relative to JBrowse root

from jbrowse_selenium import JBrowseTest

class WebApolloTest (JBrowseTest):

wa_url = None

def setUp( self ):
super( WebApolloTest, self ).setUp()
self.login( os.environ['WA_USER'], os.environ['WA_PASS'] )
self.browser.get( self.baseURL() )

def baseURL( self ):
return self.waURL()+'/jbrowse/index.html'

def waURL( self ):
if not self.wa_url:
self.wa_url = os.environ['WA_URL']
return self.wa_url

def login( self, username, password ):
self.browser.get( self.waURL() + '/Login' );
username_input = self.assert_element('//input[@id="username"]')
password_input = self.assert_element('//input[@id="password"]')
username_input.send_keys(username)
password_input.send_keys(password)
login_button = self.assert_element('//button[@id="login_button"]')
login_button.click()
time.sleep( 0.4 )
pass

2 changes: 2 additions & 0 deletions plugins/WebApollo/tests/selenium_tests/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from WebApolloTest import WebApolloTest

29 changes: 29 additions & 0 deletions plugins/WebApollo/tests/selenium_tests/pythium_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import unittest
from lib import WebApolloTest;

class PythiumTest(WebApolloTest, unittest.TestCase):

data_dir = 'sample_data/json/volvox'

def setUp( self ):
# call( "rm -rf sample_data/json/volvox/", shell=True )
# call( "bin/prepare-refseqs.pl --fasta docs/tutorial/data_files/volvox.fa --out sample_data/json/volvox/", shell=True )
# call( "bin/biodb-to-json.pl --conf docs/tutorial/conf_files/volvox.json --out sample_data/json/volvox/", shell=True )
# call( "bin/wig-to-json.pl --out sample_data/json/volvox/ --wig docs/tutorial/data_files/volvox_microarray.wig", shell=True )
# call( "bin/add-track-json.pl sample_data/raw/volvox/volvox_microarray.bw.conf sample_data/json/volvox/trackList.json", shell=True )
# call( "bin/add-track-json.pl sample_data/raw/volvox/volvox-sorted.bam.conf sample_data/json/volvox/trackList.json", shell=True )
# call( "bin/add-track-json.pl sample_data/raw/volvox/volvox-sorted.bam.coverage.conf sample_data/json/volvox/trackList.json", shell=True )
# call( "bin/generate-names.pl --dir sample_data/json/volvox/", shell=True )
super( PythiumTest, self ).setUp()


def test_pythium( self ):
test_ref = 'scf1117875582023';
# select "ctgA from the dropdown
self.select_refseq( test_ref )

# check a good browser title
assert test_ref in self.browser.title, "browser title is actually %s" % self.browser.title

self.browser.close()

5 changes: 3 additions & 2 deletions src/JBrowse/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ Browser.prototype.initView = function() {

// hook up GenomeView
this.view = this.viewElem.view =
new GenomeView(this, this.viewElem, 250, this.refSeq, 1/200,
this.config.browserRoot);
new GenomeView(this, this.viewElem, 250, this.refSeq, 1/200 );

dojo.connect( this.view, "onFineMove", this, "onFineMove" );
dojo.connect( this.view, "onCoarseMove", this, "onCoarseMove" );

Expand Down Expand Up @@ -625,6 +625,7 @@ Browser.prototype._calculateClientStats = function() {
'+'
),
'tracks-count': this.config.tracks.length,
'plugins': dojof.keys( this.plugins ).sort().join(','),

// screen geometry
'scn-h': scn ? scn.height : null,
Expand Down
11 changes: 5 additions & 6 deletions src/JBrowse/GenomeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var locationThumbMover = declare( dndMove.constrainedMoveable, {
* @class
* @constructor
*/
var GenomeView = function( browser, elem, stripeWidth, refseq, zoomLevel, browserRoot) {
var GenomeView = function( browser, elem, stripeWidth, refseq, zoomLevel ) {

// keep a reference to the main browser object
this.browser = browser;
Expand All @@ -60,8 +60,7 @@ var GenomeView = function( browser, elem, stripeWidth, refseq, zoomLevel, browse
this.ref = refseq;
//current scale, in pixels per bp
this.pxPerBp = zoomLevel;
//path prefix for static assets (e.g., cursors)
this.browserRoot = browserRoot ? browserRoot : "";

//width, in pixels, of the vertical stripes
this.stripeWidth = stripeWidth;
//the page element that the GenomeView lives in
Expand Down Expand Up @@ -1100,7 +1099,7 @@ GenomeView.prototype.scaleMouseOut = function( evt ) {
* Draws the red line across the work area, or updates it if it already exists.
*/
GenomeView.prototype.drawVerticalPositionLine = function( parent, evt){
var numX = evt.pageX;
var numX = evt.pageX + 2;

if( ! this.verticalPositionLine ){
// if line does not exist, create it
Expand All @@ -1111,7 +1110,7 @@ GenomeView.prototype.drawVerticalPositionLine = function( parent, evt){

var line = this.verticalPositionLine;
line.style.display = 'block'; //make line visible
line.style.left = numX+2+'px'; //set location on screen
line.style.left = numX+'px'; //set location on screen

this.drawBasePairLabel({ name: 'single', offset: 0, x: numX, parent: parent });
};
Expand Down Expand Up @@ -1690,7 +1689,7 @@ GenomeView.prototype.showVisibleBlocks = function(updateHeight, pos, startX, end
containerStart, containerEnd);
});

this.browser.publish( '/jbrowse/v1/v/redraw' );
this.browser.publish( '/jbrowse/v1/n/redraw' );
};

/**
Expand Down

0 comments on commit 9c134c9

Please sign in to comment.