Skip to content

Commit

Permalink
Linted
Browse files Browse the repository at this point in the history
  • Loading branch information
joshkh committed Apr 26, 2017
1 parent 231abc1 commit 0e25dc4
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
public/vendor
public/dist
.DS_Store
10 changes: 5 additions & 5 deletions dist/mi-model.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var watchify = require('watchify');
var uglify = require('gulp-uglify');
var pump = require('pump');

var browserSync = require('browser-sync').create()
var browserSync = require('browser-sync').create();

function compile(watch) {

Expand Down Expand Up @@ -38,7 +38,7 @@ function compile(watch) {

function watch() {
return compile(true);
};
}

gulp.task('build-watch', ['build'], function (done) {
browserSync.reload();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mi-model",
"version": "0.4.7",
"version": "0.4.8",
"description": "Model for representing Molecular Interaction data",
"main": "src/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MIData = require("./models/MIData");

module.exports = MIData
module.exports = MIData;
8 changes: 4 additions & 4 deletions src/models/Feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Feature = Backbone.Model.extend({
var sequenceDataCol = new Regions();


if (attrs.sequenceData != null) {
if (attrs.sequenceData !== null) {

var abc = _.map(attrs.sequenceData, function(s) {
s.feature = this
return s
s.feature = this;
return s;
}, this);

// console.log("abc", abc);
Expand Down Expand Up @@ -48,4 +48,4 @@ Features = Backbone.Collection.extend({

});

module.exports = {Feature: Feature, Features: Features}
module.exports = {Feature: Feature, Features: Features};
13 changes: 7 additions & 6 deletions src/models/Interaction.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
_ = require('underscore');
Backbone = require('backbone')
Backbone = require('backbone');

Participants = require('./Participant').Participants
Participants = require('./Participant').Participants;
Features = require('./Feature').Features;
Links = require('./Link').Links;

_ = require('underscore');


Interaction = Backbone.Model.extend({

defaults: {
Expand Down Expand Up @@ -44,18 +45,18 @@ Interaction = Backbone.Model.extend({
// Also, now that all features exist, link them to each other
this.get("features").each(function(feature) {
feature.set("linkedFeatures", new Features(_.map(feature.get("linkedFeatures"), function(id) {
return this.get("features").get(id)
return this.get("features").get(id);
}, this)));
}, this);


// Populate the features collection
// TODO: Avoid Duplicates
this.get("features").each(function(feature) {
var links = new Links()
var links = new Links();
feature.get("linkedFeatures").each(function(f) {
links.add(f);
})
});
links.add(feature);
this.get("links").add({features: links});
}, this);
Expand All @@ -70,4 +71,4 @@ Interactions = Backbone.Collection.extend({

});

module.exports = {Interaction: Interaction, Interactions: Interactions}
module.exports = {Interaction: Interaction, Interactions: Interactions};
6 changes: 3 additions & 3 deletions src/models/Interactor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Backbone = require('backbone')
Backbone = require('backbone');

Participants = require("./Participant").Participants
Participants = require("./Participant").Participants;

Interactor = Backbone.Model.extend({

Expand All @@ -16,4 +16,4 @@ Interactors = Backbone.Collection.extend({

});

module.exports = {Interactor: Interactor, Interactors: Interactors}
module.exports = {Interactor: Interactor, Interactors: Interactors};
4 changes: 2 additions & 2 deletions src/models/Link.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Backbone = require('backbone')
Backbone = require('backbone');

Link = Backbone.Model.extend({

Expand All @@ -12,4 +12,4 @@ Links = Backbone.Collection.extend({

});

module.exports = {Link: Link, Links: Links}
module.exports = {Link: Link, Links: Links};
10 changes: 5 additions & 5 deletions src/models/MIData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_ = require('underscore');
Backbone = require('backbone')
Backbone = require('backbone');
parse = require('../utils/parse.js');
Interactions = require('./Interaction').Interactions;
Interactors = require('./Interactor').Interactors;
Expand Down Expand Up @@ -34,16 +34,16 @@ Data = Backbone.Model.extend({
var that = this;

var reflect = function reflect(promise) {
return promise.then(function(v){ return {v:v, status: "resolved" }}, function(e){ return {e:e, status: "rejected" }});
}
return promise.then(function(v){ return {v:v, status: "resolved" };}, function(e){ return {e:e, status: "rejected" };});
};


// Fetch the lengths of our participants
var requests = this.get("interactors").map(function(i){

return $.get(this.uniprotUrl + i.get("identifier").id,
function(data) {
i.set("length", parseInt(data[0]["length"]))
i.set("length", parseInt(data[0].length));
});

}, this);
Expand Down Expand Up @@ -76,4 +76,4 @@ Data = Backbone.Model.extend({
});


module.exports = Data
module.exports = Data;
10 changes: 5 additions & 5 deletions src/models/Participant.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
_ = require('underscore');
Backbone = require('backbone')
Backbone = require('backbone');

Features = require('./Feature').Features
Feature = require('./Feature').Feature
Features = require('./Feature').Features;
Feature = require('./Feature').Feature;

Participant = Backbone.Model.extend({

Expand All @@ -13,7 +13,7 @@ Participant = Backbone.Model.extend({
this.get("interaction")
.get("midata")
.get("interactors")
.get(this.get("interactorRef")))
.get(this.get("interactorRef")));
} catch (e) {
console.log("Error creating iner");

Expand Down Expand Up @@ -61,4 +61,4 @@ Participants = Backbone.Collection.extend({

});

module.exports = {Participant: Participant, Participants: Participants}
module.exports = {Participant: Participant, Participants: Participants};
17 changes: 13 additions & 4 deletions src/models/Region.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Backbone = require('backbone')
Backbone = require('backbone');

var Region = Backbone.Model.extend({

Expand All @@ -10,8 +10,17 @@ var Region = Backbone.Model.extend({
var start = s[0];
var end = s[1];

isNaN(parseInt(start)) ? this.set("start", null) : this.set("start", parseInt(start));
isNaN(parseInt(end)) ? this.set("end", null) : this.set("end", parseInt(end));
if (isNaN(parseInt(start))) {
this.set("start", null);
} else {
this.set("start", parseInt(start));
}

if (isNaN(parseInt(end))) {
this.set("end", null);
} else {
this.set("end", parseInt(end));
}

} catch (e) {
// No region data
Expand All @@ -27,4 +36,4 @@ var Regions = Backbone.Collection.extend({

});

module.exports = {Region: Region, Regions: Regions}
module.exports = {Region: Region, Regions: Regions};
2 changes: 1 addition & 1 deletion src/utils/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ interactors = function(json) {
});
};

module.exports = {participants: participants, interactions: interactions, interactors: interactors}
module.exports = {participants: participants, interactions: interactions, interactors: interactors};

0 comments on commit 0e25dc4

Please sign in to comment.