Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGVF-1883 Add sample summary to analysis-set displays #614

Merged
merged 3 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/file-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const filesColumns = [
title: "Content Type",
sorter: (item) => item.content_type.toLowerCase(),
},
{
id: "summary",
title: "Summary",
},
{
id: "lab",
title: "Lab",
Expand Down
9 changes: 3 additions & 6 deletions components/search/__tests__/list-renderer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1429,13 +1429,13 @@ describe("Test the AnalysisSet component", () => {
expect(uniqueId).toHaveTextContent(/IGVFDS3099XPLN$/);

const title = screen.getByTestId("search-list-item-title");
expect(title).toHaveTextContent(/^primary analysis$/);
expect(title).toHaveTextContent(/^primary analysis of data$/);

const meta = screen.queryByTestId("search-list-item-meta");
expect(meta).toHaveTextContent("J. Michael Cherry, Stanford");

const supplement = screen.getByTestId("search-list-item-supplement");
expect(supplement).toHaveTextContent("primary analysis of data");
expect(supplement).toHaveTextContent("Alternate Accessions");

const status = screen.getByTestId("search-list-item-quality");
expect(status).toHaveTextContent("released");
Expand Down Expand Up @@ -1469,14 +1469,11 @@ describe("Test the AnalysisSet component", () => {
expect(uniqueId).toHaveTextContent(/IGVFDS0390NOLS$/);

const title = screen.getByTestId("search-list-item-title");
expect(title).toHaveTextContent(/^primary analysis$/);
expect(title).toHaveTextContent(/^primary analysis of data$/);

const meta = screen.queryByTestId("search-list-item-meta");
expect(meta).toHaveTextContent(/^J. Michael Cherry, Stanford/);

const supplement = screen.queryByTestId("search-list-item-supplement");
expect(supplement).toHaveTextContent("primary analysis of data");

const status = screen.getByTestId("search-list-item-quality");
expect(status).toHaveTextContent("released");
});
Expand Down
28 changes: 22 additions & 6 deletions components/search/list-renderer/analysis-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,44 @@ import {
SearchListItemQuality,
SearchListItemSupplement,
SearchListItemSupplementAlternateAccessions,
SearchListItemSupplementSummary,
SearchListItemSupplementContent,
SearchListItemSupplementLabel,
SearchListItemSupplementSection,
SearchListItemTitle,
SearchListItemType,
SearchListItemUniqueId,
} from "./search-list-item";

export default function AnalysisSet({ item: analysisSet }) {
const isSupplementsVisible =
analysisSet.alternate_accessions?.length > 0 || analysisSet.sample_summary;

return (
<SearchListItemContent>
<SearchListItemMain>
<SearchListItemUniqueId>
<SearchListItemType item={analysisSet} />
{analysisSet.accession}
</SearchListItemUniqueId>
<SearchListItemTitle>{analysisSet.file_set_type}</SearchListItemTitle>
<SearchListItemTitle>{analysisSet.summary}</SearchListItemTitle>
<SearchListItemMeta>
<span key="lab">{analysisSet.lab.title}</span>
</SearchListItemMeta>
<SearchListItemSupplement>
<SearchListItemSupplementAlternateAccessions item={analysisSet} />
<SearchListItemSupplementSummary item={analysisSet} />
</SearchListItemSupplement>
{isSupplementsVisible && (
<SearchListItemSupplement>
<SearchListItemSupplementAlternateAccessions item={analysisSet} />
{analysisSet.sample_summary && (
<SearchListItemSupplementSection>
<SearchListItemSupplementLabel>
Samples
</SearchListItemSupplementLabel>
<SearchListItemSupplementContent>
{analysisSet.sample_summary}
</SearchListItemSupplementContent>
</SearchListItemSupplementSection>
)}
</SearchListItemSupplement>
)}
</SearchListItemMain>
<SearchListItemQuality item={analysisSet} />
</SearchListItemContent>
Expand Down
2 changes: 1 addition & 1 deletion lib/__tests__/common-requests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ describe("Test all the common requests", () => {
request
);
expect(mockFunction).toBeCalledWith(
"/search/?field=@type&field=accession&field=content_type&field=creation_timestamp&field=file_format&field=file_size&field=file_set&field=flowcell_id&field=href&field=illumina_read_type&field=index&field=lab.title&field=lane&field=seqspecs&field=sequencing_platform&field=sequencing_run&field=status&field=upload_status&@id=/sequence-files/IGVFFI4067OVRO/&@id=/sequence-files/IGVFFI1165AJSO/&limit=2",
"/search/?field=@type&field=accession&field=content_type&field=creation_timestamp&field=file_format&field=file_size&field=file_set&field=flowcell_id&field=href&field=illumina_read_type&field=index&field=lab.title&field=lane&field=seqspecs&field=sequencing_platform&field=sequencing_run&field=status&field=summary&field=upload_status&@id=/sequence-files/IGVFFI4067OVRO/&@id=/sequence-files/IGVFFI1165AJSO/&limit=2",
expect.anything()
);
expect(result).toHaveLength(2);
Expand Down
1 change: 1 addition & 0 deletions lib/common-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export async function requestFiles(
"sequencing_platform",
"sequencing_run",
"status",
"summary",
"upload_status",
])
).unwrap_or([]);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.6.5",
"pretty-format": "^29.5.0",
"tailwindcss": "^3.1.8"
"tailwindcss": "^3.4.10"
}
}
31 changes: 27 additions & 4 deletions pages/analysis-sets/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,36 @@ export default function AnalysisSet({
</DataItemList>
</>
)}
{analysisSet.sample_summary && (
<>
<DataItemLabel>Samples</DataItemLabel>
<DataItemValue>{analysisSet.sample_summary}</DataItemValue>
</>
)}
{analysisSet.protocols?.length > 0 && (
<>
<DataItemLabel>Protocols</DataItemLabel>
<DataItemList isCollapsible isUrlList>
{analysisSet.protocols.map((protocol) => (
<a
href={protocol}
key={protocol}
target="_blank"
rel="noopener noreferrer"
>
{protocol}
</a>
))}
</DataItemList>
</>
)}
</DataArea>
</DataPanel>

{files.length > 0 && (
<FileTable files={files} fileSet={analysisSet} isDownloadable />
)}

{analysisSet.samples?.length > 0 && (
<SampleTable
samples={analysisSet.samples}
Expand Down Expand Up @@ -174,10 +201,6 @@ export default function AnalysisSet({
/>
)}

{files.length > 0 && (
<FileTable files={files} fileSet={analysisSet} isDownloadable />
)}

{documents.length > 0 && <DocumentTable documents={documents} />}
<Attribution attribution={attribution} />
</JsonDisplay>
Expand Down
Loading