Published
Edited
May 5, 2022
Insert cell
Insert cell
Insert cell
Insert cell
genes = {
let url = `https://phagesdb.org/api/genesbyphage/${selectedPhage}/`;
let response = await await fetch(url);
let result = await response.json();
let genes = result.results;
// Your code goes here. It should iterate over the genes array to make the appropriate corrections (problems 1-7 above) and return the corrected array from the code block
genes.forEach((obj) => {
// parts 1,2
obj["Phamily"] = obj["phams"];
obj["Translation"] = obj["translation"];
delete obj["phams"];
delete obj["translation"];

//part 4
delete obj["PhageID"];
delete obj["GeneID"];

// part 5
var curString = obj["Notes"];
curString = curString.replace("b'", "");
curString = curString.replace("'", "");
obj["Notes"] = curString;

//part 6
curString = obj["Orientation"];
curString = curString.replace("F", "Forward");
curString = curString.replace("R", "Reverse");
obj["Orientation"] = curString;

// part 7
});

return genes;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more