Commit eae010f2 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

js/clone.js, js/model.js: light refactor, .csv export, lists instead of strings

parent ffbf8812
......@@ -1201,21 +1201,31 @@ Clone.prototype = {
},
toCSVheader: function (m) {
var csv = "name,id,system,tag,v,d,j,sequence"
for (var i=0; i<m.samples.order.length; i++) csv += ",reads_"+i
for (var i=0; i<m.samples.order.length; i++) csv += ",ratio_"+i
for (var i=0; i<m.samples.order.length; i++) csv += ",ratios_"+i
var csv = [
"name", "id",
"system", "tag",
"v", "d", "j",
"sequence"
]
for (var i=0; i<m.samples.order.length; i++) csv.push("reads_"+i)
for (var i=0; i<m.samples.order.length; i++) csv.push(",ratio_"+i)
for (var i=0; i<m.samples.order.length; i++) csv.push(",ratios_"+i)
return csv
},
toCSV: function () {
var csv = this.getName() + "," + this.id + "," + this.get('germline') + "," + this.getTagName() + ","
+ this.getGene("5") + "," + this.getGene("4") + "," + this.getGene("3") + "," + 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])
for (var i=0; i<this.m.samples.order.length; i++) csv += "," + this.getPrintableSize(this.m.samples.order[i]).replace(/,/g, ';')
var csv = [
this.getName(), this.id,
this.get('germline'), this.getTagName(),
this.getGene("5"), this.getGene("4"), this.getGene("3"),
this.getSequence()
]
for (var i=0; i<this.m.samples.order.length; i++) csv.push(this.getReads(this.m.samples.order[i]))
for (var i=0; i<this.m.samples.order.length; i++) csv.push(this.getSize(this.m.samples.order[i]))
for (var i=0; i<this.m.samples.order.length; i++) csv.push(this.getPrintableSize(this.m.samples.order[i]).replace(/,/g, ';'))
return csv
},
......
......@@ -1915,13 +1915,13 @@ changeCloneNotation: function(cloneNotationType) {
* */
toCSV: function () {
//header
var csv = Clone.prototype.toCSVheader(this)
var csv = Clone.prototype.toCSVheader(this).join(',')
csv += "\n"
//only non-empty active clones and virtual clones
for (var i=0; i<this.clusters.length; i++){
if ( (this.clusters[i].length != 0 && this.clone(i).isActive()) || this.clone(i).isVirtual() ){
csv += this.clone(i).toCSV()
csv += this.clone(i).toCSV().join(',')
csv += "\n"
}
}
......
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