Created
January 9, 2017 14:51
-
-
Save j-coll/747d3e9f73267f49ca19d3c8f0b58c58 to your computer and use it in GitHub Desktop.
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
// mongo opencga_user_project | |
/* | |
var studyId = ??; | |
var fileIds = [??]; | |
var sampleIds = [??]; | |
*/ | |
function dropFiles(studyId, fileIds, sampleIds) { | |
db.variants.update( | |
{ | |
"studies" : { | |
$elemMatch: { | |
"sid" : studyId, | |
"files.fid" : { $in : fileIds } | |
} | |
} | |
}, { | |
$pull:{ | |
"studies.$.files":{fid:{$in:fileIds}}, | |
"studies.$.gt.?/?" : {$in:sampleIds}, | |
"studies.$.gt.0/1" : {$in:sampleIds}, | |
"studies.$.gt.1/1" : {$in:sampleIds} // Add other genotypes | |
} | |
} , {multi:true}) | |
db.studies.update({"_id":studyId},{$pull:{"indexedFiles":{$in:fileIds}}}) | |
db.files.drop({"fileId":{$in:fileIds}}) | |
// Remove from stage collection | |
} | |
// mongo opencga_catalog | |
db.file.update({"_id":{$in:fileIds}}, {$set:{"index.status":"NONE"}}, {multi:true}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment