longData = {
let long_data = [];
byIndividual.forEach(row => {
Object.keys(row).forEach(function(colname) {
if (colname == "#OTU ID" || colname == "taxonomy") {
return;
}
let heir = row["taxonomy"].split(";");
long_data.push({
Indv: row["#OTU ID"],
Value: row[colname],
Sample: colname,
kingdom: heir[0].replace(' ', ''),
phylum: heir[1].replace(' ', ''),
class: heir[2].replace(' ', ''),
order: heir[3].replace(' ', ''),
family: heir[4].replace(' ', ''),
genus: heir[5].replace(' ', ''),
species: heir[6].replace(' ', ''),
taxonomy: row["taxonomy"]
});
});
});
return long_data;
}