Created
October 6, 2018 12:42
-
-
Save tryshchenko/a472fd28faf06e510b21629ab547a315 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In order to reduce json file size with such an amount of entities I used short key names: | |
// gt = alleles group | |
// rs = Rs[XXXXXX] string | |
module.exports = (snps, data) => | |
snps.reduce((prev, next) => { | |
if (!next || !next.rs) { | |
return prev; | |
} | |
const rs = next.rs.toLowerCase(); | |
const gt = next.gt; | |
if (next.gt !== null) { | |
if (Array.isArray(data[rs]) && data[rs].indexOf(gt) > -1) { | |
prev.push(next); | |
} | |
return prev; | |
} | |
if (Array.isArray(data[rs])) { | |
prev.push(next); | |
} | |
return prev; | |
}, []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment