Skip to content

Commit

Permalink
v1.0.6: cBioPortal works
Browse files Browse the repository at this point in the history
  • Loading branch information
mokolodi1 committed Jul 27, 2016
2 parents 9fda00a + 4eb6d8e commit bea23b0
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
[submodule "webapp/packages/blobs"]
path = webapp/packages/blobs
url = https://github.com/UCSC-MedBook/blobs
[submodule "webapp/packages/collaborations"]
path = webapp/packages/collaborations
url = https://github.com/UCSC-MedBook/collaborations
9 changes: 4 additions & 5 deletions config/rb/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
if [ -z "$1" ]; then
MONGO_URL="mongodb://localhost:27017/MedBook" meteor --port 3003 --settings settings.json
else
MONGO_URL="mongodb://localhost:27017/MedBook" meteor $1 --port 3003 --settings settings.json
fi
export MONGO_URL="mongodb://localhost:27017/MedBook"
export MEDBOOK_FILESTORE=/tmp/filestore

meteor --port 3003 --settings ../config/rb/settings.json
30 changes: 18 additions & 12 deletions config/rb/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"rscript": "Rscript",
"python": "python",
"limma_path": "/data/MedBook/External-Tools/limma/limma_ng.R",
"apply_signature_path" : "/data/MedBook/External-Tools/signature/apply_signature.py",
"viper_supervised_path": "/data/MedBook/UCSC_VIPER/bin/run-viper-supervised.R",
"viper_unsupervised_path": "/data/MedBook/UCSC_VIPER/bin/run-viper-unsupervised.R",
"viper_path": "/data/MedBook/UCSC_VIPER/bin/run-viper.R",
"marina_path": "/data/MedBook/UCSC_VIPER/bin/run-marina.R",
"gsea_path": "/data/MedBook/External-Tools/gsea/rgGSEA.py",
"boxplot_new_path": "/data/MedBook/Tools/MedBook-Adapters/boxplot//boxplot.new.R",
"boxplot_path": "/data/MedBook/Tools/MedBook-Adapters/boxplot//boxplot.R",
"violinplot_path": "/data/MedBook/Tools/MedBook-Adapters/boxplot//violinplot.R",
"sh": "/bin/sh",
"rscript": "Rscript",
"python": "python",
"limma_path": "/data/MedBook/MedBook-JobRunner/external-tools/limma/limma_ng.R",
"outlier_analysis": "/data/MedBook/MedBook-JobRunner/external-tools/OutlierAnalysis/outlier-analysis.sh",
"calculate_outlier_genes": "/data/MedBook/MedBook-JobRunner/external-tools/OutlierAnalysis/calculate_outlier_genes.R",
"genomic_expression_export": "/data/MedBook/MedBook-JobRunner/external-tools/exporters/genomic_expression_export.py",
"gene_set_collection_export": "/data/MedBook/MedBook-JobRunner/external-tools/exporters/gene_set_collection_export.py",
"limma_phenotype_export": "/data/MedBook/MedBook-JobRunner/external-tools/exporters/limma_phenotype_export.py",
"apply_signature_path" : "/data/MedBook/External-Tools/signature/apply_signature.py",
"viper_supervised_path": "/data/MedBook/UCSC_VIPER/bin/run-viper-supervised.R",
"viper_unsupervised_path": "/data/MedBook/UCSC_VIPER/bin/run-viper-unsupervised.R",
"viper_path": "/data/MedBook/UCSC_VIPER/bin/run-viper.R",
"marina_path": "/data/MedBook/UCSC_VIPER/bin/run-marina.R",
"gsea_path": "/data/MedBook/External-Tools/gsea/rgGSEA.py",
"boxplot_new_path": "/data/MedBook/Tools/MedBook-Adapters/boxplot//boxplot.new.R",
"boxplot_path": "/data/MedBook/Tools/MedBook-Adapters/boxplot//boxplot.R",
"violinplot_path": "/data/MedBook/Tools/MedBook-Adapters/boxplot//violinplot.R"
}
16 changes: 8 additions & 8 deletions config/teo/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"sh": "/bin/sh",
"rscript": "Rscript",
"limma_path": "/Users/mokolodi1/work/medbook/next/MedBook-JobRunner/external-tools/limma/limma_ng.R",
"outlier_analysis": "/Users/mokolodi1/work/medbook/next/MedBook-JobRunner/external-tools/OutlierAnalysis/outlier-analysis.sh",
"calculate_outlier_genes": "/Users/mokolodi1/work/medbook/next/MedBook-JobRunner/external-tools/OutlierAnalysis/calculate_outlier_genes.R",
"genomic_expression_export": "/Users/mokolodi1/work/medbook/next/MedBook-JobRunner/external-tools/exporters/genomic_expression_export.py",
"gene_set_collection_export": "/Users/mokolodi1/work/medbook/next/MedBook-JobRunner/external-tools/exporters/gene_set_collection_export.py",
"limma_phenotype_export": "/Users/mokolodi1/work/medbook/next/MedBook-JobRunner/external-tools/exporters/limma_phenotype_export.py",
"gsea_path": "/Users/mokolodi1/work/medbook/next/MedBook-JobRunner/external-tools/gsea/rgGSEA.py",
"gsea_jar_path": "/Users/mokolodi1/work/medbook/next/MedBook-JobRunner/external-tools/gsea/gsea2-2.2.2.jar"
"limma_path": "/Users/mokolodi1/work/medbook/medbook/MedBook-JobRunner/external-tools/limma/limma_ng.R",
"outlier_analysis": "/Users/mokolodi1/work/medbook/medbook/MedBook-JobRunner/external-tools/OutlierAnalysis/outlier-analysis.sh",
"calculate_outlier_genes": "/Users/mokolodi1/work/medbook/medbook/MedBook-JobRunner/external-tools/OutlierAnalysis/calculate_outlier_genes.R",
"genomic_expression_export": "/Users/mokolodi1/work/medbook/medbook/MedBook-JobRunner/external-tools/exporters/genomic_expression_export.py",
"gene_set_collection_export": "/Users/mokolodi1/work/medbook/medbook/MedBook-JobRunner/external-tools/exporters/gene_set_collection_export.py",
"limma_phenotype_export": "/Users/mokolodi1/work/medbook/medbook/MedBook-JobRunner/external-tools/exporters/limma_phenotype_export.py",
"gsea_path": "/Users/mokolodi1/work/medbook/medbook/MedBook-JobRunner/external-tools/gsea/rgGSEA.py",
"gsea_jar_path": "/Users/mokolodi1/work/medbook/medbook/MedBook-JobRunner/external-tools/gsea/gsea2-2.2.2.jar"
}
1 change: 1 addition & 0 deletions webapp/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ mokolodi1:[email protected]
medbook:adapters
medbook:namespace
medbook:blobs
medbook:collaborations
2 changes: 2 additions & 0 deletions webapp/.meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
erasaur:[email protected]
[email protected]
[email protected]
[email protected]
Expand All @@ -47,6 +48,7 @@ [email protected]
matb33:[email protected]
medbook:[email protected]
medbook:[email protected]
medbook:[email protected]
medbook:[email protected]
medbook:[email protected]
medbook:[email protected]
Expand Down
3 changes: 2 additions & 1 deletion webapp/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"q": "1.4.1",
"xlsx": "0.8.0",
"mime": "1.2.11",
"docker-run": "2.4.0"
"docker-run": "2.4.0",
"mysql": "2.11.1"
}
1 change: 1 addition & 0 deletions webapp/packages/collaborations
Submodule collaborations added at a12fa8
28 changes: 28 additions & 0 deletions webapp/packages/npm-container/.npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/packages/primary-collections
144 changes: 144 additions & 0 deletions webapp/server/classes/UpdateCbioSecurity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
function UpdateCbioSecurity (job_id) {
Job.call(this, job_id);
}
UpdateCbioSecurity.prototype = Object.create(Job.prototype);
UpdateCbioSecurity.prototype.constructor = UpdateCbioSecurity;

var mysql = Meteor.npmRequire('mysql');

UpdateCbioSecurity.prototype.run = function () {
var connection = mysql.createConnection({
host : "mysql",
user : "cbio",
password : "P@ssword1",
database : "cbioportal"
});

connection.connect();

// Collect this information out here so that it runs in the Meteor
// environment, which we'll lose in the promise code below
var allNamesAndEmails = _.map(this.job.args.collab_names, function (name) {
var collab = Collaborations.findOne({ name: name });

if (!collab) {
throw new Error("collaboration name invalid: " + name);
}

return {
name: name,
emails: collab.getUserEmails(),
};
});

var self = this;
var jobDeferred = Q.defer();

// This 5 was chosen arbitrarily because I don't know how to start with a
// .then. I like it better when all the logic code is in .thens because
// I find it easier to read.
Q.when(5)
// NOTE: Q.nfcall doesn't work here for some reason
.then(function () {
var deferred = Q.defer();

connection.query("DELETE FROM users", function (error, result) {
if (error) { deferred.reject(error); }
else { deferred.resolve(result); }
});

return deferred.promise;
})
.then(function () {
var deferred = Q.defer();

connection.query("DELETE FROM authorities", function (error, result) {
if (error) { deferred.reject(error); }
else { deferred.resolve(result); }
});

return deferred.promise;
})
.then(function () {
var deferred = Q.defer();
var allPromises = [];

// For each email insert into the users table and the authorities
// table. Wait until every command is done running before continuing.
_.each(allNamesAndEmails, function (nameAndEmails) {
_.each(nameAndEmails.emails, function (email) {
// insert into the users table
var usersDeferred = Q.defer();
connection.query('INSERT INTO users SET ?', {
name: email,
email: email,
enabled: 1
}, function (err, result) {
if (err) { usersDeferred.reject(err); }
else { usersDeferred.resolve(result); }
});
allPromises.push(usersDeferred.promise);

// insert into the authorities table
var authoritiesDeferred = Q.defer();
connection.query('INSERT INTO authorities SET ?', {
email: email,

// TODO: change to `cbioportal:${nameAndEmails.name}`
authority: 'cbioportal:ALL',
}, function (err, result) {
if (err) { authoritiesDeferred.reject(err); }
else { authoritiesDeferred.resolve(result); }
});
allPromises.push(authoritiesDeferred.promise);
});

console.log("added " + nameAndEmails.emails.length + " users to " +
"cbioportal:ALL");
});

// wait for all the promises to resolve and then continue
Q.all(allPromises)
.then(deferred.resolve)
.catch(deferred.reject);

return deferred.promise;
})
.then(function () {
connection.end();

jobDeferred.resolve();
})
.catch(function (error) {
jobDeferred.reject(error);
});

return jobDeferred.promise;
}

Meteor.startup(function () {
var newJobBlueprint = {
name: "UpdateCbioSecurity",
user_id: "admin",
args: {
collab_names: [ "WCDT" ]
}
};

// set up a cron job to execute every so often
SyncedCron.add({
name: "update-cbio-security",
schedule: function(parser) {
// parser is a later.parse object
return parser.text('every 12 hours');
},
job: function () {
Jobs.insert(newJobBlueprint);
},
});

// also execute immediately
Jobs.insert(newJobBlueprint);
});

JobClasses.UpdateCbioSecurity = UpdateCbioSecurity;

0 comments on commit bea23b0

Please sign in to comment.