From 7919693ca7f765bc5b07125d993a25726e23dad3 Mon Sep 17 00:00:00 2001 From: forresttanaka Date: Wed, 25 Sep 2024 17:33:33 -0700 Subject: [PATCH] IGVF-1955-sequencing-platform-embed * Display the embedded platform on sequence files. * Update the sequencing file tables to get the sequencing platform newly embedded in the objects themselves. * Correct the sorting on the sequencing file table sequencing platform column. --- components/file-set-files-tables.js | 5 ----- components/sequencing-file-table.js | 21 +++++++-------------- pages/auxiliary-sets/[id].js | 15 --------------- pages/configuration-files/[...id].js | 14 -------------- pages/construct-library-sets/[id].js | 14 -------------- pages/measurement-sets/[id].js | 16 ---------------- pages/sequence-files/[...id].js | 13 +++---------- 7 files changed, 10 insertions(+), 88 deletions(-) diff --git a/components/file-set-files-tables.js b/components/file-set-files-tables.js index 6a45a3ecc..e3b653c67 100644 --- a/components/file-set-files-tables.js +++ b/components/file-set-files-tables.js @@ -13,7 +13,6 @@ export default function FileSetFilesTables({ files = [], fileSet, seqspecFiles, - sequencingPlatforms, children, }) { // Extract sequencing files from `files` and group them by characteristics to determine which @@ -55,7 +54,6 @@ export default function FileSetFilesTables({ isIlluminaReadType itemPath={fileSet["@id"]} seqspecFiles={seqspecFiles} - sequencingPlatforms={sequencingPlatforms} hasReadType /> )} @@ -65,7 +63,6 @@ export default function FileSetFilesTables({ title="Sequencing Results" itemPath={fileSet["@id"]} seqspecFiles={seqspecFiles} - sequencingPlatforms={sequencingPlatforms} /> )} {children} @@ -87,6 +84,4 @@ FileSetFilesTables.propTypes = { fileSet: PropTypes.object.isRequired, // seqspec files associated with the files seqspecFiles: PropTypes.arrayOf(PropTypes.object).isRequired, - // Sequencing platform objects associated with `files` - sequencingPlatforms: PropTypes.arrayOf(PropTypes.object).isRequired, }; diff --git a/components/sequencing-file-table.js b/components/sequencing-file-table.js index 32311596a..7a2c59131 100644 --- a/components/sequencing-file-table.js +++ b/components/sequencing-file-table.js @@ -1,6 +1,7 @@ // node_modules import { TableCellsIcon } from "@heroicons/react/20/solid"; import _ from "lodash"; +import Link from "next/link"; import PropTypes from "prop-types"; // components import { DataAreaTitle, DataAreaTitleLink } from "./data-area"; @@ -72,18 +73,14 @@ const filesColumns = [ { id: "sequencing_platform", title: "Sequencing Platform", - display: ({ source, meta }) => { - const matchingPlatform = meta.sequencingPlatforms.find( - (platform) => platform["@id"] === source.sequencing_platform - ); - return matchingPlatform?.term_name || null; - }, - sorter: (item, meta) => { - const matchingPlatform = meta.sequencingPlatforms.find( - (platform) => platform["@id"] === item.sequencing_platform + display: ({ source }) => { + return ( + + {source.sequencing_platform.term_name} + ); - return matchingPlatform?.term_name || ""; }, + sorter: (item) => item.sequencing_platform.term_name.toLowerCase(), }, { id: "flowcell_id", @@ -125,7 +122,6 @@ export default function SequencingFileTable({ itemPath = "", itemPathProp = "file_set.@id", isIlluminaReadType = undefined, - sequencingPlatforms, seqspecFiles = [], hasReadType = false, isSeqspecHidden = false, @@ -164,7 +160,6 @@ export default function SequencingFileTable({ pager={{}} meta={{ seqspecFiles, - sequencingPlatforms, hasReadType, isSeqspecHidden, }} @@ -185,8 +180,6 @@ SequencingFileTable.propTypes = { itemPathProp: PropTypes.string, // True to show only files with illumina_read_type, false to show only files without isIlluminaReadType: PropTypes.bool, - // Sequencing platform objects associated with `files` - sequencingPlatforms: PropTypes.arrayOf(PropTypes.object).isRequired, // seqspec files associated with `files` seqspecFiles: PropTypes.arrayOf(PropTypes.object), // True if files have illumina_read_type diff --git a/pages/auxiliary-sets/[id].js b/pages/auxiliary-sets/[id].js index bee47baf2..2a9a5a2fd 100644 --- a/pages/auxiliary-sets/[id].js +++ b/pages/auxiliary-sets/[id].js @@ -23,7 +23,6 @@ import { requestDocuments, requestFiles, requestFileSets, - requestOntologyTerms, requestPublications, requestSeqspecFiles, } from "../../lib/common-requests"; @@ -38,7 +37,6 @@ export default function AuxiliarySet({ files, relatedDatasets, seqspecFiles, - sequencingPlatforms, inputFileSetFor, controlFor, attribution = null, @@ -72,7 +70,6 @@ export default function AuxiliarySet({ files={groupedFiles.other} fileSet={auxiliarySet} seqspecFiles={seqspecFiles} - sequencingPlatforms={sequencingPlatforms} > {groupedFiles.tabular?.length > 0 && ( file.sequencing_platform) - .filter((sequencingPlatform) => sequencingPlatform); - const uniqueSequencingPlatformPaths = [...new Set(sequencingPlatformPaths)]; - const sequencingPlatforms = - uniqueSequencingPlatformPaths.length > 0 - ? await requestOntologyTerms(uniqueSequencingPlatformPaths, request) - : []; - const seqspecFiles = files.length > 0 ? await requestSeqspecFiles(files, request) : []; @@ -219,7 +205,6 @@ export async function getServerSideProps({ params, req, query }) { files, relatedDatasets, seqspecFiles, - sequencingPlatforms, inputFileSetFor, controlFor, pageContext: { title: auxiliarySet.accession }, diff --git a/pages/configuration-files/[...id].js b/pages/configuration-files/[...id].js index 4b8943bb8..335c36b23 100644 --- a/pages/configuration-files/[...id].js +++ b/pages/configuration-files/[...id].js @@ -21,7 +21,6 @@ import { requestDocuments, requestFileSets, requestFiles, - requestOntologyTerms, } from "../../lib/common-requests"; import { errorObjectToProps } from "../../lib/errors"; import FetchRequest from "../../lib/fetch-request"; @@ -35,7 +34,6 @@ export default function ConfigurationFile({ attribution, configurationFile, seqspecOf, - sequencingPlatforms, documents, derivedFrom, derivedFromFileSets, @@ -65,7 +63,6 @@ export default function ConfigurationFile({ file.sequencing_platform) - .filter((sequencingPlatform) => sequencingPlatform); - const uniqueSequencingPlatformPaths = [...new Set(sequencingPlatformPaths)]; - const sequencingPlatforms = - uniqueSequencingPlatformPaths.length > 0 - ? await requestOntologyTerms(uniqueSequencingPlatformPaths, request) - : []; const attribution = await buildAttribution( configurationFile, @@ -188,7 +175,6 @@ export async function getServerSideProps({ params, req, query, resolvedUrl }) { props: { configurationFile, seqspecOf, - sequencingPlatforms, documents, derivedFrom, derivedFromFileSets, diff --git a/pages/construct-library-sets/[id].js b/pages/construct-library-sets/[id].js index 6272be65f..8d492abef 100644 --- a/pages/construct-library-sets/[id].js +++ b/pages/construct-library-sets/[id].js @@ -29,7 +29,6 @@ import buildAttribution from "../../lib/attribution"; import { requestDocuments, requestFiles, - requestOntologyTerms, requestFileSets, requestPublications, requestSeqspecFiles, @@ -255,7 +254,6 @@ export default function ConstructLibrarySet({ files, seqspecFiles, integratedContentFiles, - sequencingPlatforms, attribution = null, isJson, }) { @@ -312,7 +310,6 @@ export default function ConstructLibrarySet({ files={files} fileSet={constructLibrarySet} seqspecFiles={seqspecFiles} - sequencingPlatforms={sequencingPlatforms} /> {integratedContentFiles.length > 0 && ( file["@id"]); const files = filePaths.length > 0 ? await requestFiles(filePaths, request) : []; - const sequencingPlatformPaths = files - .map((file) => file.sequencing_platform) - .filter((sequencingPlatform) => sequencingPlatform); - const uniqueSequencingPlatformPaths = [...new Set(sequencingPlatformPaths)]; - const sequencingPlatforms = - uniqueSequencingPlatformPaths.length > 0 - ? await requestOntologyTerms(uniqueSequencingPlatformPaths, request) - : []; let integratedContentFiles = []; if (constructLibrarySet.integrated_content_files?.length > 0) { @@ -448,7 +435,6 @@ export async function getServerSideProps({ params, req, query }) { files, seqspecFiles, integratedContentFiles, - sequencingPlatforms, publications, pageContext: { title: constructLibrarySet.accession }, attribution, diff --git a/pages/measurement-sets/[id].js b/pages/measurement-sets/[id].js index adfdc6c06..e6a9364f1 100644 --- a/pages/measurement-sets/[id].js +++ b/pages/measurement-sets/[id].js @@ -34,7 +34,6 @@ import { requestDocuments, requestFiles, requestFileSets, - requestOntologyTerms, requestPublications, requestSamples, requestSeqspecFiles, @@ -113,7 +112,6 @@ export default function MeasurementSet({ controlFor, samples, seqspecFiles, - sequencingPlatforms, attribution = null, isJson, }) { @@ -265,7 +263,6 @@ export default function MeasurementSet({ files={groupedFiles.other} fileSet={measurementSet} seqspecFiles={seqspecFiles} - sequencingPlatforms={sequencingPlatforms} > {groupedFiles.image?.length > 0 && ( 0 ? await requestSeqspecFiles(files, request) : []; - // Use the files to retrieve all the sequencing platform objects they link to. - const sequencingPlatformPaths = files - .map((file) => file.sequencing_platform) - .filter((sequencingPlatform) => sequencingPlatform); - const uniqueSequencingPlatformPaths = [...new Set(sequencingPlatformPaths)]; - const sequencingPlatforms = - uniqueSequencingPlatformPaths.length > 0 - ? await requestOntologyTerms(uniqueSequencingPlatformPaths, request) - : []; - let publications = []; if (measurementSet.publications?.length > 0) { const publicationPaths = measurementSet.publications.map( @@ -488,7 +473,6 @@ export async function getServerSideProps({ params, req, query }) { controlFor, samples, seqspecFiles, - sequencingPlatforms, pageContext: { title: measurementSet.accession }, attribution, isJson, diff --git a/pages/sequence-files/[...id].js b/pages/sequence-files/[...id].js index 47db8df79..08a3e75db 100644 --- a/pages/sequence-files/[...id].js +++ b/pages/sequence-files/[...id].js @@ -48,7 +48,6 @@ export default function SequenceFile({ attribution = null, isJson, seqspecs, - sequencingPlatform = null, }) { return ( <> @@ -71,12 +70,12 @@ export default function SequenceFile({ Sequencing Details - {sequencingPlatform && ( + {sequenceFile.sequencing_platform && ( <> Sequencing Platform - - {sequencingPlatform.term_name} + + {sequenceFile.sequencing_platform.term_name} @@ -194,8 +193,6 @@ SequenceFile.propTypes = { isJson: PropTypes.bool.isRequired, // Linked seqspec configuration files seqspecs: PropTypes.arrayOf(PropTypes.object).isRequired, - // Sequencing platform ontology term object - sequencingPlatform: PropTypes.object, }; export async function getServerSideProps({ params, req, query, resolvedUrl }) { @@ -240,9 +237,6 @@ export async function getServerSideProps({ params, req, query, resolvedUrl }) { sequenceFile.seqspecs?.length > 0 ? await requestSeqspecFiles([sequenceFile], request) : []; - const sequencingPlatform = sequenceFile.sequencing_platform - ? (await request.getObject(sequenceFile.sequencing_platform)).optional() - : null; const attribution = await buildAttribution( sequenceFile, req.headers.cookie @@ -259,7 +253,6 @@ export async function getServerSideProps({ params, req, query, resolvedUrl }) { attribution, isJson, seqspecs, - sequencingPlatform, }, }; }