-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from UCSC-MedBook/develop
ExpressionVariance filters -> prod
- Loading branch information
Showing
14 changed files
with
193 additions
and
41 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 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,4 +1,4 @@ | ||
export MONGO_URL="mongodb://localhost:27017/MedBook" | ||
export MEDBOOK_FILESTORE=/tmp/filestore | ||
|
||
meteor --port 3003 --settings ../config/ekephart/settings.json | ||
meteor --port 3003 --settings ../config/etk/settings.json |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"sh": "/bin/sh", | ||
"rscript": "Rscript", | ||
"limma_path": "/Users/Shared/external-tools/limma/limma_ng.R", | ||
"outlier_analysis": "/Users/Shared/external-tools/OutlierAnalysis/outlier-analysis.sh", | ||
"calculate_outlier_genes": "/Users/Shared/external-tools/OutlierAnalysis/calculate_outlier_genes.R", | ||
"genomic_expression_export": "/Users/Shared/external-tools/exporters/genomic_expression_export.py", | ||
"gene_set_collection_export": "/Users/Shared/external-tools/exporters/gene_set_collection_export.py", | ||
"limma_phenotype_export": "/Users/Shared/external-tools/exporters/limma_phenotype_export.py", | ||
"gsea_path": "/Users/Shared/external-tools/gsea/rgGSEA.py", | ||
"gsea_jar_path": "/Users/Shared/external-tools/gsea/gsea2-2.2.2.jar", | ||
"python": "python", | ||
"expression_level_gene_filter": "/Users/Shared/external-tools/ExpressionAndVarianceFilters/filter_out_genes_unexpressed_in_most_samples.py", | ||
"variance_gene_filter": "/Users/Shared/external-tools/ExpressionAndVarianceFilters/filter_out_lowest_varying_genes.py" | ||
} |
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
Submodule external-tools
updated
969 files
This file was deleted.
Oops, something went wrong.
Submodule primary-collections
updated
5 files
+10 −7 | README.md | |
+2 −1 | collections/DataSets.js | |
+10 −1 | collections/Jobs.js | |
+14 −2 | collections/SampleGroups.js | |
+7 −0 | utility.js |
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
|
||
function ApplyExprAndVarianceFilters (job_id) { | ||
Job.call(this, job_id); | ||
} | ||
|
||
ApplyExprAndVarianceFilters.prototype = Object.create(Job.prototype); | ||
ApplyExprAndVarianceFilters.prototype.constructor = ApplyExprAndVarianceFilters; | ||
|
||
ApplyExprAndVarianceFilters.prototype.run = function () { | ||
|
||
var workDir = ntemp.mkdirSync("ApplyExprAndVarianceFilters"); | ||
console.log("workDir: ", workDir); | ||
|
||
var self = this; | ||
var sample_group_id = self.job.args.sample_group_id; | ||
|
||
var exportScript = getSetting("genomic_expression_export"); | ||
var python = getSetting("python"); | ||
var exprFilterScript = getSetting("expression_level_gene_filter"); | ||
var varianceFilterScript = getSetting("variance_gene_filter"); | ||
|
||
var deferred = Q.defer(); | ||
|
||
// exportCommand is a promise for exporting the | ||
// sample group data | ||
var exportCommand = spawnCommand(exportScript, [ | ||
"--sample_group_id", sample_group_id, | ||
], workDir) | ||
|
||
// Export the data | ||
exportCommand.then(function(exportResults){ | ||
if(exportResults.exitCode !== 0){ | ||
throw new Error("Writing file failed (exit code not 0)"); | ||
} | ||
// input & output paths for expression level filter | ||
self.sampleGroupPath = exportResults.stdoutPath; | ||
self.filteredByExpressionPath = path.join(workDir, "sampleGroup_with_expr_filter_applied.tsv"); | ||
|
||
return spawnCommand(python, | ||
[ | ||
exprFilterScript, | ||
"--in_file", self.sampleGroupPath, | ||
"--proportion_unexpressed", "0.8", | ||
"--out_file", self.filteredByExpressionPath, | ||
], | ||
workDir); | ||
|
||
}).then(function(exprFilterResults){ | ||
console.log("expression level filter ran with results", exprFilterResults); | ||
if(exprFilterResults.exitCode !== 0){ | ||
throw new Error("Failed to apply expression-level filter (exit code not 0)"); | ||
} | ||
// set up variance filter | ||
|
||
// End users will see custom path that's set in patientCare when downloading | ||
// but internally this path is used. | ||
self.fullyFilteredPath = path.join(workDir, "sampleGroup_filteredByExprAndVar.tsv"); | ||
|
||
return spawnCommand(python, | ||
[ | ||
varianceFilterScript, | ||
"--in_file", self.filteredByExpressionPath, | ||
"--filter_level", "0.2", | ||
"--out_file", self.fullyFilteredPath, | ||
], | ||
workDir); | ||
|
||
}).then(Meteor.bindEnvironment(function(varianceFilterResults){ | ||
if(varianceFilterResults.exitCode !== 0){ | ||
throw new Error("Failed to apply variance filter (exit code not 0)"); | ||
} | ||
|
||
// Filters were applied; create the output Blob2 | ||
|
||
var associated_samplegroup = { | ||
collection_name: "SampleGroups", | ||
mongo_id: sample_group_id, | ||
}; | ||
|
||
var createBlob2Sync = Meteor.wrapAsync(Blobs2.create); | ||
// Errors from this will be thrown to the catch below | ||
var metadata = {"type" : "ExprAndVarFilteredSampleGroupData"} | ||
var blob = createBlob2Sync(self.fullyFilteredPath, associated_samplegroup, metadata); | ||
var output = {"filtered_samples_blob_id" : blob._id}; | ||
|
||
// Everything worked; resolve the promise | ||
deferred.resolve(output); | ||
},function(err){ | ||
deferred.reject(err); | ||
})).catch(function(error){ | ||
// If we got an error anywhere along the chain, | ||
// fail the job | ||
deferred.reject(error); | ||
}); | ||
// Will wait for the async code to run and either resolve or reject | ||
// before completing the job | ||
return deferred.promise; | ||
}; | ||
|
||
JobClasses.ApplyExprAndVarianceFilters = ApplyExprAndVarianceFilters ; |
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