Skip to content

Commit

Permalink
adding aliasedEnzymesByName and defaultEnzymesByName; removing old en…
Browse files Browse the repository at this point in the history
…zymeList
  • Loading branch information
tnrich committed Oct 9, 2020
1 parent 3e4d343 commit a9fa562
Show file tree
Hide file tree
Showing 11 changed files with 15,056 additions and 7,316 deletions.
7,319 changes: 7,319 additions & 0 deletions scratch/enzymeList.js

Large diffs are not rendered by default.

151 changes: 151 additions & 0 deletions scratch/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
const { uniq, filter } = require("lodash");
const aliasedEnzymes = require("./aliasedEnzymes.json");
const enzymesKeyedByName = {};
aliasedEnzymes.forEach((enz) => {
enz.name.forEach((name) => {
enzymesKeyedByName[name.toLowerCase()] = enz;
});
});

const defaultEnzymes = [
"aatii",
"acci",
"accii",
"acciii",
"afai",
"aflii",
"alui",
"aor13hi",
"aor51hi",
"apai",
"apali",
"asci",
"asisi",
"avrii",
"bali",
"bamhi",
"banii",
"bcni",
"bgli",
"bglii",
"blni",
"bmet110i",
"bmgt120i",
"bpu1102i",
"bsai",
"bsgi",
"bsmbi",
"bsp1286i",
"bsp1407i",
"bspt104i",
"bspt107i",
"bsshii",
"bst1107i",
"bstpi",
"bstxi",
"cfr10i",
"clai",
"cpoi",
"ddei",
"dpni",
"drai",
"eaei",
"eagi",
"eam1105i",
"eco52i",
"eco81i",
"ecoo109i",
"ecoo65i",
"ecori",
"ecorv",
"ecot14i",
"ecot22i",
"fbai",
"foki",
"fsei",
"haeii",
"haeiii",
"hapii",
"hhai",
"hin1i",
"hincii",
"hindiii",
"hinfi",
"hpai",
"kpni",
"mboi",
"mboii",
"mfli",
"mlui",
"msei",
"mspi",
"muni",
"naei",
"ncoi",
"ndei",
"nhei",
"noti",
"nrui",
"nsbi",
"paci",
"pmaci",
"pmei",
"pshai",
"pshbi",
"psp1406i",
"psti",
"pvui",
"pvuii",
"saci",
"sacii",
"sali",
"sapi",
"sau3ai",
"sbfi",
"scai",
"sfii",
"smai",
"smii",
"snabi",
"spei",
"sphi",
"srfi",
"sse8387i",
"sspi",
"stui",
"swai",
"taqi",
"tth111i",
"van91i",
"vpak11bi",
"xbai",
"xhoi",
"xmai",
"xspi",
];

const defaultEnzymesByHash = {}
const defaultEnzymesFull = [];
defaultEnzymes.forEach((name, index) => {
const fullEnz = enzymesKeyedByName[name]
fullEnz["canonicalName" + index] = name
const hash = getEnzymeHash(fullEnz)
const existing = defaultEnzymesByHash[hash] || []
defaultEnzymesByHash[hash] = [fullEnz].concat(existing);

defaultEnzymesFull.push(fullEnz);
});

// console.log(`defaultEnzymesFull.length:`, defaultEnzymesFull.length);
// console.log(
// `uniq(defaultEnzymesFull).length:`,
// uniq(defaultEnzymesFull).length
// );
const dups = filter(defaultEnzymesByHash, (z) => z.length > 1)
console.log(`dups.length:`,dups.length)
console.log(`dups:`,dups)


function getEnzymeHash(z) {
return `${z.site}-${z.topSnipOffset}-${z.bottomSnipOffset}-${z.cutType}-${z.usForward}-${z.usReverse}`;
}
Loading

0 comments on commit a9fa562

Please sign in to comment.