Commit 7df8b089 authored by sauloal's avatar sauloal
Browse files

bed and wig working

parent 6438e800
var fs = require('fs');
var FileAPI = require('file-api')
, File = FileAPI.File
, FileList = FileAPI.FileList
, FileReader = FileAPI.FileReader
;
// ES5 does not have endsWith
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(searchString, position) {
var subjectString = this.toString();
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
}
// add libraries
eval(fs.readFileSync('../public/converter/bionano_parser.js')+'');
//eval(fs.readFileSync('../public/converter/tools.js')+'');
function create_file(filename, ext, text) {
var of = filename+'.'+ext;
fs.writeFile(of, text, function(err) {
console.log("Saving", of);
if(err) {
return console.log(err);
}
return;
});
}
//parse
var parse = new bionano_parser();
//console.log('parse', parse);
console.log('abc'.endsWith('c'));
var files = [
"exp/exp_refineFinal1_merged_q.cmap",
"exp/exp_refineFinal1_merged_r.cmap",
"exp/exp_refineFinal1_merged.smap",
"exp/exp_refineFinal1_merged.xmap",
"exp/s_lycopersicum_chromosomes.2.50_knicked_key.txt"
];
for (var f=0; f<files.length; f++) {
files[f] = new File({path: files[f], name: files[f]});
}
//var files = new FileList("exp_refineFinal1_merged.xmap");
console.log('files',files);
for ( var filenum = 0, file; file = files[filenum]; filenum++ ) {
//if ( filenum == files.length ) { break };
file.name = String(file.name) + '';
console.log('file' , filenum , file);
console.log('lastModified' , file.lastModified );
console.log('lastModifiedDate' , file.lastModifiedDate );
console.log('name' , file.name );
console.log('size' , file.size );
console.log('type' , file.type );
console.log('webkitRelativePath', file.webkitRelativePath );
console.log(file.name);
console.log(typeof(file.name));
console.log(file.name.endsWith('txt'));
parse.add_file(file);
}
var clbk = function() {
/*
var clbk2 = function (filename, text) {
create_file(filename, text);
}
parse.report(parse, clbk2);
*/
parse.report(parse, create_file);
}
parse.parse(clbk);
#!/bin/bash
set -xeu
DIR=/PWD/
#${PWD}
#DIR=http://localhost:8000
FA=${DIR}S_lycopersicum_chromosomes.2.50.fa
BED=${DIR}exp_refineFinal1_merged_r.cmap.bed
BIGBED=${BED/.bed/.bb}
SIZES=${FA}.sizes
#if [[ ! -f "${SIZES}" ]]; then
# ./gen_sizes.py ${FA}
#fi
#./bedToBigBed_static -tab ${BED} ${SIZES} ${BIGBED}
node bedToBigBed_static.js -tab ${BED} ${SIZES} ${BIGBED}
This diff is collapsed.
<html>
<head>
<script src="tools.js"></script>
<script src="bionano_parser.js"></script>
<script src="index.js"></script>
<style>
......
......@@ -9,65 +9,6 @@ var dndSupported = function () {
};
function create_file(filename, ext, text) {
var file = new File([text], filename +'.'+ext, {type: "text/plain", lastModified: Date()});
var fr = new FileReader();
fr.onload = function(evt){
console.log(file.name );
console.log(file.type );
console.log(file.lastModifiedDate);
//document.body.innerHTML = evt.target.result + "<br><a href="+URL.createObjectURL(file)+" download=" + file.name + ">Download " + file.name + "</a><br>type: "+file.type+"<br>last modified: "+ file.lastModifiedDate
//document.body.appendChild( document.createElement("br") );
var span = document.getElementById(filename);
if (! span) {
var br = document.createElement("br");
span = document.createElement("span");
span.id = filename;
span.innerHTML += filename + " : ";
document.body.appendChild( br );
document.body.appendChild( span );
}
span.innerHTML += " <a href="+URL.createObjectURL(file)+" download=" + file.name + ">" + ext + "</a>";
}
fr.readAsText(file);
}
function parse_files(files) {
var parse = new bionano_parser();
for ( var filenum = 0, file; file = files[filenum]; filenum++ ) {
//if ( filenum == files.length ) { break };
console.log('file' , filenum , file);
console.log('lastModified' , file.lastModified );
console.log('lastModifiedDate' , file.lastModifiedDate );
console.log('name' , file.name );
console.log('size' , file.size );
console.log('type' , file.type );
console.log('webkitRelativePath', file.webkitRelativePath );
parse.add_file(file);
}
var clbk = function() {
/*
var clbk2 = function (filename, text) {
create_file(filename, text);
}
parse.report(parse, clbk2);
*/
parse.report(parse, create_file);
}
parse.parse(clbk);
}
document.addEventListener("DOMContentLoaded", function(event) {
......
function create_file(filename, ext, text) {
var file = new File([text], filename +'.'+ext, {type: "text/plain", lastModified: Date()});
var fr = new FileReader();
fr.onload = function(evt){
console.log(file.name );
console.log(file.type );
console.log(file.lastModifiedDate);
//document.body.innerHTML = evt.target.result + "<br><a href="+URL.createObjectURL(file)+" download=" + file.name + ">Download " + file.name + "</a><br>type: "+file.type+"<br>last modified: "+ file.lastModifiedDate
//document.body.appendChild( document.createElement("br") );
var span = document.getElementById(filename);
if (! span) {
var br = document.createElement("br");
span = document.createElement("span");
span.id = filename;
span.innerHTML += filename + " : ";
document.body.appendChild( br );
document.body.appendChild( span );
}
span.innerHTML += " <a href="+URL.createObjectURL(file)+" download=" + file.name + ">" + ext + "</a>";
}
fr.readAsText(file);
}
function parse_files(files) {
var parse = new bionano_parser();
for ( var filenum = 0, file; file = files[filenum]; filenum++ ) {
//if ( filenum == files.length ) { break };
console.log('file' , filenum , file);
console.log('lastModified' , file.lastModified );
console.log('lastModifiedDate' , file.lastModifiedDate );
console.log('name' , file.name );
console.log('size' , file.size );
console.log('type' , file.type );
console.log('webkitRelativePath', file.webkitRelativePath );
parse.add_file(file);
}
var clbk = function() {
/*
var clbk2 = function (filename, text) {
create_file(filename, text);
}
parse.report(parse, clbk2);
*/
parse.report(parse, create_file);
}
parse.parse(clbk);
}
Supports Markdown
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