Commit de79ac2a authored by Marc Duez's avatar Marc Duez

model.js/clone.js : csv export

parent a890fa10
......@@ -434,6 +434,16 @@ Clone.prototype = {
return html
},
toCSV: function () {
var csv = this.getName() + "," + this.id + "," + this.getSystem() + ","
+ this.getV() + "," + this.getD() + "," + this.getJ() + "," + this.getSequence()
for (var i=0; i<this.m.samples.order.length; i++) csv += "," + this.getReads(this.m.samples.order[i])
for (var i=0; i<this.m.samples.order.length; i++) csv += "," + this.getSize(this.m.samples.order[i])
return csv
},
enable: function (top) {
if (this.top <= top && tagDisplay[this.tag] == 1 && this.id != "other") {
this.active = true;
......
......@@ -1553,7 +1553,35 @@ Model.prototype = {
this.update();
},
//convert clones to csv with the current clustering/filtering
toCSV: function () {
//header
var csv = "name,id,system,v,d,j,sequence"
for (var i=0; i<this.samples.order.length; i++) csv += ",reads_"+i
for (var i=0; i<this.samples.order.length; i++) csv += ",size_"+i
csv += "\n"
//only non-empty active clones and "other"
for (var i=0; i<this.clusters.length; i++){
if ( (this.clusters[i].length != 0 && this.clone(i).isActive()) || this.clone(i).getName()=="other" ){
csv += this.clone(i).toCSV()
csv += "\n"
}
}
return csv
},
exportCSV: function () {
var textToWrite = this.toCSV()
var textFileAsBlob = new Blob([textToWrite], {
type: 'text'
});
var filename = this.getPrintableAnalysisName().replace(/[ \/\\:]/,'_')
saveAs(textFileAsBlob, filename + ".csv");
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment