Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Commit

Permalink
fix coloring and ES6 exports
Browse files Browse the repository at this point in the history
  • Loading branch information
wilzbach committed Jun 2, 2016
1 parent 2e34840 commit e2a61f2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export * as model from "./model";

// extra plugins, extensions
export * as menu from "./menu";
export {default as utils} from "./utils";
export * as utils from "./utils";

// probably needed more often
export {default as selection} from "./g/selection/Selection";
Expand Down
2 changes: 1 addition & 1 deletion src/menu/views/ExportMenu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MenuBuilder from "../menubuilder";
import Exporter from "../../utils/export";
import Exporter from "../../utils/exporter";

const FastaExporter = require("biojs-io-fasta").writer;

Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports.bmath = require("./bmath");
module.exports.proxy = require("./proxy");
module.exports.seqgen = require("./seqgen");
module.exports.file = require("./file");
module.exports.export = require("./export");
export bmath from "./bmath";
export proxy from "./proxy";
export seqgen from "./seqgen";
export file from "./file";
export exporter from "./exporter";
51 changes: 26 additions & 25 deletions src/utils/seqgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const Sequence = require("biojs-model").seq;
import BMath from "./bmath";
const Stat = require("stat.seqs");

const SeqGen =
{_generateSequence: function(len) {
var text = "";
var end = len - 1;
for (var i = 0; 0 < end ? i <= end : i >= end; 0 < end ? i++ : i--) {
text += seqgen.getRandomChar();
const SeqGen = {
_generateSequence: (len) => {
let text = "";
const end = len - 1;
for (let i = 0; 0 < end ? i <= end : i >= end; 0 < end ? i++ : i--) {
text += SeqGen.getRandomChar();
}
return text;
},
Expand All @@ -16,50 +16,51 @@ const SeqGen =
// @param len [int] number of generated sequences
// @param seqLen [int] length of the generated sequences
getDummySequences: function(len, seqLen) {
var seqs = [];
const seqs = [];
if (!(typeof len !== "undefined" && len !== null)) { len = BMath.getRandomInt(3,5); }
if (!(typeof seqLen !== "undefined" && seqLen !== null)) { seqLen = BMath.getRandomInt(50,200); }

for (var i = 1; 1 < len ? i <= len : i >= len; 1 < len ? i++ : i--) {
seqs.push(new Sequence(seqgen._generateSequence(seqLen), "seq" + i,"r" + i));
seqs.push(new Sequence(SeqGen._generateSequence(seqLen), "seq" + i,"r" + i));
}
return seqs;
},

getRandomChar: function(dict) {
var possible = dict || "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
getRandomChar: (dict) => {
const possible = dict || "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
return possible.charAt(Math.floor(Math.random() * possible.length));
},

// generates a dummy sequences
// @param len [int] number of generated sequences
// @param seqLen [int] length of the generated sequences
genConservedSequences: function(len, seqLen, dict) {
var seqs = [];
genConservedSequences: (len, seqLen, dict) => {
const seqs = [];
if (!(typeof len !== "undefined" && len !== null)) { len = BMath.getRandomInt(3,5); }
if (!(typeof seqLen !== "undefined" && seqLen !== null)) { seqLen = BMath.getRandomInt(50,200); }

dict = dict || "ACDEFGHIKLMNPQRSTVWY---";

for (var i = 1; 1 < len ? i <= len : i >= len; 1 < len ? i++ : i--) {
for (let i = 1; 1 < len ? i <= len : i >= len; 1 < len ? i++ : i--) {
seqs[i-1] = "";
}

var tolerance = 0.2;
const tolerance = 0.2;

var conservAim = 1;
var end = seqLen - 1;
for (var i = 0; 0 < end ? i <= end : i >= end; 0 < end ? i++ : i--) {
let conservAim = 1;
const end = seqLen - 1;
for (let i = 0; 0 < end ? i <= end : i >= end; 0 < end ? i++ : i--) {
if (i % 3 === 0) {
conservAim = (BMath.getRandomInt(50,100)) / 100;
}
var observed = [];
var end1 = len - 1;
for (var j = 0; 0 < end1 ? j <= end1 : j >= end1; 0 < end1 ? j++ : j--) {
var counter = 0;
const observed = [];
const end1 = len - 1;
for (let j = 0; 0 < end1 ? j <= end1 : j >= end1; 0 < end1 ? j++ : j--) {
let counter = 0;
let c;
while (counter < 100) {
var c = seqgen.getRandomChar(dict);
var cConserv = Stat(observed);
c = SeqGen.getRandomChar(dict);
const cConserv = Stat(observed);
cConserv.addSeq(c);
counter++;
if (Math.abs(conservAim - cConserv.scale(cConserv.conservation())[0]) < tolerance) {
Expand All @@ -71,12 +72,12 @@ const SeqGen =
}
}

var pseqs = [];
const pseqs = [];
for (var i = 1; 1 < len ? i <= len : i >= len; 1 < len ? i++ : i--) {
pseqs.push(new Sequence(seqs[i-1], "seq" + i, "r" + i));
}

return pseqs;
}
};
};
export default SeqGen;

0 comments on commit e2a61f2

Please sign in to comment.