Skip to content

Commit

Permalink
IGVF-1955 Update sequence-file UI for newly embedded sequencing_platf…
Browse files Browse the repository at this point in the history
…orm (#622)

* 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.
  • Loading branch information
forresttanaka authored Sep 27, 2024
1 parent aa940ff commit 335b020
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 88 deletions.
5 changes: 0 additions & 5 deletions components/file-set-files-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -55,7 +54,6 @@ export default function FileSetFilesTables({
isIlluminaReadType
itemPath={fileSet["@id"]}
seqspecFiles={seqspecFiles}
sequencingPlatforms={sequencingPlatforms}
hasReadType
/>
)}
Expand All @@ -66,7 +64,6 @@ export default function FileSetFilesTables({
isIlluminaReadType={false}
itemPath={fileSet["@id"]}
seqspecFiles={seqspecFiles}
sequencingPlatforms={sequencingPlatforms}
/>
)}
{children}
Expand All @@ -84,6 +81,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,
};
21 changes: 7 additions & 14 deletions components/sequencing-file-table.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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 (
<Link href={source.sequencing_platform["@id"]}>
{source.sequencing_platform.term_name}
</Link>
);
return matchingPlatform?.term_name || "";
},
sorter: (item) => item.sequencing_platform.term_name.toLowerCase(),
},
{
id: "flowcell_id",
Expand Down Expand Up @@ -125,7 +122,6 @@ export default function SequencingFileTable({
itemPath = "",
itemPathProp = "file_set.@id",
isIlluminaReadType = undefined,
sequencingPlatforms,
seqspecFiles = [],
hasReadType = false,
isSeqspecHidden = false,
Expand Down Expand Up @@ -164,7 +160,6 @@ export default function SequencingFileTable({
pager={{}}
meta={{
seqspecFiles,
sequencingPlatforms,
hasReadType,
isSeqspecHidden,
}}
Expand All @@ -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
Expand Down
15 changes: 0 additions & 15 deletions pages/auxiliary-sets/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
requestDocuments,
requestFiles,
requestFileSets,
requestOntologyTerms,
requestPublications,
requestSeqspecFiles,
} from "../../lib/common-requests";
Expand All @@ -38,7 +37,6 @@ export default function AuxiliarySet({
files,
relatedDatasets,
seqspecFiles,
sequencingPlatforms,
inputFileSetFor,
controlFor,
attribution = null,
Expand Down Expand Up @@ -72,7 +70,6 @@ export default function AuxiliarySet({
files={groupedFiles.other}
fileSet={auxiliarySet}
seqspecFiles={seqspecFiles}
sequencingPlatforms={sequencingPlatforms}
>
{groupedFiles.tabular?.length > 0 && (
<FileTable
Expand Down Expand Up @@ -134,8 +131,6 @@ AuxiliarySet.propTypes = {
relatedDatasets: PropTypes.arrayOf(PropTypes.object).isRequired,
// seqspec files associated with `files`
seqspecFiles: PropTypes.arrayOf(PropTypes.object).isRequired,
// Sequencing platform objects associated with `files`
sequencingPlatforms: PropTypes.arrayOf(PropTypes.object).isRequired,
// File sets that this file set is input for
inputFileSetFor: PropTypes.arrayOf(PropTypes.object).isRequired,
// File sets controlled by this file set
Expand Down Expand Up @@ -174,15 +169,6 @@ export async function getServerSideProps({ params, req, query }) {
relatedDatasets = await requestFileSets(datasetPaths, 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)
: [];

const seqspecFiles =
files.length > 0 ? await requestSeqspecFiles(files, request) : [];

Expand Down Expand Up @@ -219,7 +205,6 @@ export async function getServerSideProps({ params, req, query }) {
files,
relatedDatasets,
seqspecFiles,
sequencingPlatforms,
inputFileSetFor,
controlFor,
pageContext: { title: auxiliarySet.accession },
Expand Down
14 changes: 0 additions & 14 deletions pages/configuration-files/[...id].js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
requestDocuments,
requestFileSets,
requestFiles,
requestOntologyTerms,
} from "../../lib/common-requests";
import { errorObjectToProps } from "../../lib/errors";
import FetchRequest from "../../lib/fetch-request";
Expand All @@ -35,7 +34,6 @@ export default function ConfigurationFile({
attribution,
configurationFile,
seqspecOf,
sequencingPlatforms,
documents,
derivedFrom,
derivedFromFileSets,
Expand Down Expand Up @@ -65,7 +63,6 @@ export default function ConfigurationFile({
<SequencingFileTable
files={seqspecOf}
title="seqspec File Of"
sequencingPlatforms={sequencingPlatforms}
itemPath={configurationFile["@id"]}
itemPathProp="seqspecs"
isSeqspecHidden
Expand Down Expand Up @@ -107,8 +104,6 @@ ConfigurationFile.propTypes = {
configurationFile: PropTypes.object.isRequired,
// The file is a seqspec of
seqspecOf: PropTypes.array.isRequired,
// Sequencing platform objects associated with the files it is a seqspec of
sequencingPlatforms: PropTypes.arrayOf(PropTypes.object).isRequired,
// Documents set associate with this file
documents: PropTypes.array.isRequired,
// The file is derived from
Expand Down Expand Up @@ -171,14 +166,6 @@ export async function getServerSideProps({ params, req, query, resolvedUrl }) {
request
)
: [];
const sequencingPlatformPaths = seqspecOf
.map((file) => 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,
Expand All @@ -188,7 +175,6 @@ export async function getServerSideProps({ params, req, query, resolvedUrl }) {
props: {
configurationFile,
seqspecOf,
sequencingPlatforms,
documents,
derivedFrom,
derivedFromFileSets,
Expand Down
14 changes: 0 additions & 14 deletions pages/construct-library-sets/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import buildAttribution from "../../lib/attribution";
import {
requestDocuments,
requestFiles,
requestOntologyTerms,
requestFileSets,
requestPublications,
requestSeqspecFiles,
Expand Down Expand Up @@ -255,7 +254,6 @@ export default function ConstructLibrarySet({
files,
seqspecFiles,
integratedContentFiles,
sequencingPlatforms,
attribution = null,
isJson,
}) {
Expand Down Expand Up @@ -312,7 +310,6 @@ export default function ConstructLibrarySet({
files={files}
fileSet={constructLibrarySet}
seqspecFiles={seqspecFiles}
sequencingPlatforms={sequencingPlatforms}
/>
{integratedContentFiles.length > 0 && (
<FileTable
Expand Down Expand Up @@ -371,8 +368,6 @@ ConstructLibrarySet.propTypes = {
documents: PropTypes.arrayOf(PropTypes.object).isRequired,
// Publications associated with this construct library
publications: PropTypes.arrayOf(PropTypes.object).isRequired,
// File sequencing platform objects
sequencingPlatforms: PropTypes.arrayOf(PropTypes.object).isRequired,
// Attribution for this analysis set
attribution: PropTypes.object,
// Is the format JSON?
Expand Down Expand Up @@ -407,14 +402,6 @@ export async function getServerSideProps({ params, req, query }) {
const filePaths = constructLibrarySet.files.map((file) => 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) {
Expand Down Expand Up @@ -448,7 +435,6 @@ export async function getServerSideProps({ params, req, query }) {
files,
seqspecFiles,
integratedContentFiles,
sequencingPlatforms,
publications,
pageContext: { title: constructLibrarySet.accession },
attribution,
Expand Down
16 changes: 0 additions & 16 deletions pages/measurement-sets/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
requestDocuments,
requestFiles,
requestFileSets,
requestOntologyTerms,
requestPublications,
requestSamples,
requestSeqspecFiles,
Expand Down Expand Up @@ -113,7 +112,6 @@ export default function MeasurementSet({
controlFor,
samples,
seqspecFiles,
sequencingPlatforms,
attribution = null,
isJson,
}) {
Expand Down Expand Up @@ -265,7 +263,6 @@ export default function MeasurementSet({
files={groupedFiles.other}
fileSet={measurementSet}
seqspecFiles={seqspecFiles}
sequencingPlatforms={sequencingPlatforms}
>
{groupedFiles.image?.length > 0 && (
<FileTable
Expand Down Expand Up @@ -363,8 +360,6 @@ MeasurementSet.propTypes = {
samples: PropTypes.arrayOf(PropTypes.object).isRequired,
// seqspec files associated with `files`
seqspecFiles: PropTypes.arrayOf(PropTypes.object).isRequired,
// Sequencing platform objects associated with `files`
sequencingPlatforms: PropTypes.arrayOf(PropTypes.object).isRequired,
// Documents associated with this measurement set
documents: PropTypes.arrayOf(PropTypes.object).isRequired,
// Publications associated with this measurement set
Expand Down Expand Up @@ -452,16 +447,6 @@ export async function getServerSideProps({ params, req, query }) {
const seqspecFiles =
files.length > 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(
Expand All @@ -488,7 +473,6 @@ export async function getServerSideProps({ params, req, query }) {
controlFor,
samples,
seqspecFiles,
sequencingPlatforms,
pageContext: { title: measurementSet.accession },
attribution,
isJson,
Expand Down
13 changes: 3 additions & 10 deletions pages/sequence-files/[...id].js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default function SequenceFile({
attribution = null,
isJson,
seqspecs,
sequencingPlatform = null,
}) {
return (
<>
Expand All @@ -71,12 +70,12 @@ export default function SequenceFile({
<DataAreaTitle>Sequencing Details</DataAreaTitle>
<DataPanel>
<DataArea>
{sequencingPlatform && (
{sequenceFile.sequencing_platform && (
<>
<DataItemLabel>Sequencing Platform</DataItemLabel>
<DataItemValue>
<Link href={sequencingPlatform["@id"]}>
{sequencingPlatform.term_name}
<Link href={sequenceFile.sequencing_platform["@id"]}>
{sequenceFile.sequencing_platform.term_name}
</Link>
</DataItemValue>
</>
Expand Down Expand Up @@ -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 }) {
Expand Down Expand Up @@ -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
Expand All @@ -259,7 +253,6 @@ export async function getServerSideProps({ params, req, query, resolvedUrl }) {
attribution,
isJson,
seqspecs,
sequencingPlatform,
},
};
}
Expand Down

0 comments on commit 335b020

Please sign in to comment.