Skip to content

Commit

Permalink
cleanup & simplify tree
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaudis committed Nov 22, 2024
1 parent f74e346 commit b0cbef2
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 503 deletions.
36 changes: 13 additions & 23 deletions src/components/SubsetsHierarchyLoader.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,35 @@
import { useCollationsByType, useCollationsById } from "../hooks/api"
// import { useCollationsByType, useCollationsById } from "../hooks/api"
import { useCollationsByType } from "../hooks/api"
import { WithData } from "./Loader"
import React from "react"
import { keyBy, merge } from "lodash"
import { keyBy } from "lodash"
import { buildTree, TreePanel } from "./classificationTree/TreePanel"

export default function SubsetsHierarchyLoader({ collationTypes, datasetIds, defaultTreeDepth }) {
const bioSubsetsHierarchiesReply = useCollationsByType({
const collationsHierarchyReply = useCollationsByType({
datasetIds,
deliveryKeys: "",
collationTypes
})

const allBioSubsetsReply = useCollationsById({datasetIds})

return (
<WithData
apiReply={bioSubsetsHierarchiesReply}
apiReply={collationsHierarchyReply}
background
render={(bioSubsetsHierarchiesResponse) => (
<WithData
apiReply={allBioSubsetsReply}
background
render={(allBioSubsetsResponse) => (
<SubsetsResponse
bioSubsetsHierarchies={bioSubsetsHierarchiesResponse.response.results}
allBioSubsets={allBioSubsetsResponse.response.results}
datasetIds={datasetIds}
defaultTreeDepth={defaultTreeDepth}
/>
)}
render={(collationsHierarchyReply) => (
<SubsetsResponse
collationsHierarchies={collationsHierarchyReply.response.results}
datasetIds={datasetIds}
defaultTreeDepth={defaultTreeDepth}
/>
)}
/>
)
}

function SubsetsResponse({ bioSubsetsHierarchies, allBioSubsets, datasetIds, defaultTreeDepth }) {
// We merge both subsets from hierarchies and subsets from allSubsets.
// This is because some children in the bioSubsetsHierarchies don't have labels or sample count information.
const subsetById = merge(keyBy(bioSubsetsHierarchies, "id"), allBioSubsets)
const { tree, size } = buildTree(bioSubsetsHierarchies, subsetById)
function SubsetsResponse({ collationsHierarchies, datasetIds, defaultTreeDepth }) {
const subsetById = keyBy(collationsHierarchies, "id")
const { tree, size } = buildTree(collationsHierarchies, subsetById)

return (
<TreePanel
Expand Down
50 changes: 0 additions & 50 deletions remnants/DownloadButton.js

This file was deleted.

51 changes: 0 additions & 51 deletions remnants/TCGA_dataPage.js

This file was deleted.

53 changes: 0 additions & 53 deletions remnants/cytomapper.js

This file was deleted.

16 changes: 0 additions & 16 deletions remnants/files.js

This file was deleted.

11 changes: 0 additions & 11 deletions remnants/gao-2021-signatures.js

This file was deleted.

104 changes: 0 additions & 104 deletions remnants/gao2021signatures_dataPage.js

This file was deleted.

31 changes: 0 additions & 31 deletions remnants/gao2021signatures_searchExamples.yaml

This file was deleted.

Loading

0 comments on commit b0cbef2

Please sign in to comment.