Esempio n. 1
0
 saveAsImg: function(that,name) {
     // TODO: this is very ugly
     var canvas = that.getView('stage').getView('body').getView('seqblock').el;
     if ((typeof canvas !== "undefined" && canvas !== null)) {
       var url = canvas.toDataURL('image/png');
       return saveAs(blobURL(url), name, "image/png");
     }
 }
Esempio n. 2
0
 saveAnnots: function(that,name) {
   var features = that.seqs.map(function(el) {
     features = el.get("features");
     if (features.length === 0) { return; }
     var seqname = el.get("name");
     features.each(function(s) {
       return s.set("seqname", seqname);
     });
     return features.toJSON();
   });
   features = flatten(compact(features));
   console.log(features);
   var text = GFF.exportLines(features);
   var blob = new Blob([text], {type : 'text/plain'});
   return saveAs(blob, name);
 },
Esempio n. 3
0
/**
 * @param {string} output
 * @param {string} fileName
 * @return {Promise<Blob>}
 */
function saveFile(output, fileName) {
    let blob;
    try {
        blob = new Blob(
            [output,],
            {
                type: 'text/html;charset=utf-8',
            }
        );

        saveAs(blob, fileName);
    } catch (e) {
        return Promise.reject(e);
    }

    return Promise.resolve(blob);
}
Esempio n. 4
0
 saveSelection: function(that,name) {
   let selection = that.g.selcol.pluck("seqId");
   console.log(selection);
   if (selection.length > 0) {
     // filter those seqids
     selection = that.seqs.filter((el) => selection.indexOf(el.get("id")) >= 0);
     var end = selection.length - 1;
     for (let i = 0; 0 < end ? i <= end : i >= end; 0 < end ? i++ : i--) {
       selection[i] = selection[i].toJSON();
     }
   } else {
     selection = that.seqs.toJSON();
     console.warn("no selection found");
   }
   var text = Fasta.write(selection);
   var blob = new Blob([text], {type : 'text/plain'});
   return saveAs(blob, name);
 },
Esempio n. 5
0
 saveAsFile: function(that,name) {
   // limit at about 256k
   const text = Fasta.write(that.seqs.toJSON());
   const blob = new Blob([text], {type : 'text/plain'});
   return saveAs(blob, name);
 },