Commit 5decb6e9 authored by sauloal's avatar sauloal
Browse files

added jbrowse

parent bf5f108d
......@@ -2,3 +2,4 @@
*.sizes
*.bb
*_static*
node_modules/
Uses github.com:sauloal/kentjs.git
Express from:
http://expressjs.com/en/starter/generator.html
http://cwbuecheler.com/web/tutorials/2013/node-express-mongo/
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', routes);
app.use('/users', users);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: err
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: {}
});
});
module.exports = app;
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('data:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
......@@ -21,4 +21,4 @@ SIZES=${FA}.sizes
#./bedToBigBed_static -tab ${BED} ${SIZES} ${BIGBED}
ENVIRONMENT=NONE node bedToBigBed_static.js -tab ${BED} ${SIZES} ${BIGBED}
node bedToBigBed_static.js -tab ${BED} ${SIZES} ${BIGBED}
npm install express-generator
node_modules/.bin/express .
npm install
cd public
bash jbrowse.sh
//var exports = module.exports = {};
var fs = require('fs');
var readline = require('readline');
function gen_size(filename, cb) {
console.log("filename", filename);
var lineReader = readline.createInterface({
terminal: false,
input: fs.createReadStream(filename)
});
var stats = [];
lineReader.on('line', function (line) {
//console.log('Line from file:', line);
if (line.length >0){
if (line[0] == ">") {
console.log("HEADER", line);
var names = line.split(/[ ,\|]/g);
var name = names[0].substr(1);
//console.log("NAMES ", names);
console.log("NAME '"+name +"'");
stats.push([name, 0]);
//console.log(stats);
} else {
//console.log("SEQ ", line);
stats[stats.length-1][1] += line.length;
}
}
});
lineReader.on('close', function() { cb(stats); });
}
//node -e 'var gs = require("./gen_sizes.js"); gs("../data/S_lycopersicum_chromosomes.2.50.fa",function(stats){console.log("stats",stats);});'
module.exports = gen_size;
{
"name": "bionanoconverter",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0"
}
}
#!/bin/bash
set -xeu
TAG=1.12.1-release
#URL=https://github.com/GMOD/jbrowse/archive/${TAG}.tar.gz
#mkdir jbrowse || true
#wget ${URL} -O - | tar xzvf - --strip-components=1 -C jbrowse
git clone https://github.com/GMOD/jbrowse.git
cd jbrowse
git checkout tags/${TAG}
git submodule update --init --recursive --force
./setup.sh
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
a {
color: #00B7FF;
}
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
/* GET Hello World page. */
router.get('/helloworld', function(req, res) {
res.render('helloworld', { title: 'Hello, World!' });
});
module.exports = router;
var express = require('express');
var router = express.Router();
/* GET users listing. */
router.get('/', function(req, res, next) {
res.send('respond with a resource');
});
module.exports = router;
DEBUG=bionanoconverter:* npm start
extends layout
block content
h1= message
h2= error.status
pre #{error.stack}
extends layout
block content
h1= title
p Welcome to #{title}
extends layout
block content
h1= title
p Welcome to #{title}
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
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