The formatExperiments method is currently used within the useDatasetManager hook to format dataset.experiments array field for the UI. We want to remove this method from the hook and have the data presentation components handle formatting directly using dataset.experiments.
e.g., ) The experiments field:
experiments: [
{
title: "Drug-induced change in g…agents for 2, 6 and 24h",
accession_code: "GSE116436",
organism_names: […],
sample_metadata: […],
technology: "MICROARRAY"
}
]
The formatExperiments function:
// formats the sample and experiment arrays from the API response
// to objects with experiment accession codes as their keys for UI
const formatExperiments = (experiments = []) => {
if (!experiments.length) return {}
return experiments.reduce(
(acc, experiment) => ({
...acc,
[experiment.accession_code]: experiment
}),
{}
)
}
Problem or idea
We should remove formatExperiments from the codebase and adjust the formatting logic in the data presentation components to use dataset.experiments.
Additionally, we'll rename all variables that use the term species to organism (e.g., samplesBySpecies to samplesByOrganism) in the SpeciesView component as part of this process.
Solution or next step
Remove the formatExperiments method from useDatasetManager
Update the data presentation components to format dataset.experiments
Rename variables that use the term species to organism in SpeciesView
Context
Epic: #358
The
formatExperiments
method is currently used within theuseDatasetManager
hook to formatdataset.experiments
array field for the UI. We want to remove this method from the hook and have the data presentation components handle formatting directly usingdataset.experiments
.e.g., ) The
experiments
field:The
formatExperiments
function:Problem or idea
We should remove
formatExperiments
from the codebase and adjust the formatting logic in the data presentation components to usedataset.experiments
.Additionally, we'll rename all variables that use the term
species
toorganism
(e.g.,samplesBySpecies
tosamplesByOrganism
) in theSpeciesView
component as part of this process.Solution or next step
formatExperiments
method fromuseDatasetManager
dataset.experiments
species
toorganism
inSpeciesView