-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Fran McDade <[email protected]>
- Loading branch information
Showing
16 changed files
with
248 additions
and
159 deletions.
There are no files selected for viewing
80 changes: 72 additions & 8 deletions
80
app/components/Entity/components/AnalysisMethod/analysisMethod.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,77 @@ | ||
import { ButtonPrimary } from "@databiosphere/findable-ui/lib/components/common/Button/components/ButtonPrimary/buttonPrimary"; | ||
import { CardContent } from "@databiosphere/findable-ui/lib/components/common/Card/card.styles"; | ||
import { GridPaperSection } from "@databiosphere/findable-ui/lib/components/common/Section/section.styles"; | ||
import { | ||
inkLight, | ||
smokeDark, | ||
smokeLightest, | ||
} from "@databiosphere/findable-ui/lib/styles/common/mixins/colors"; | ||
import { | ||
textBody4002Lines, | ||
textBody500, | ||
} from "@databiosphere/findable-ui/lib/styles/common/mixins/fonts"; | ||
import { css } from "@emotion/react"; | ||
import styled from "@emotion/styled"; | ||
|
||
export const StyledCardContent = styled(CardContent)` | ||
gap: 4px; | ||
interface Props { | ||
isPreview: boolean; | ||
} | ||
|
||
export const StyledSection = styled(GridPaperSection, { | ||
shouldForwardProp: (props) => props !== "isPreview", | ||
})<Props>` | ||
flex-direction: row; | ||
gap: 16px; | ||
.MuiChip-root, | ||
.MuiSvgIcon-root { | ||
align-self: center; | ||
} | ||
.MuiSvgIcon-root { | ||
transform: rotate(180deg); | ||
transition: transform 300ms; | ||
} | ||
&:hover { | ||
.MuiSvgIcon-root { | ||
transform: rotate(180deg) translateX(-2px); | ||
} | ||
} | ||
${(props) => | ||
props.isPreview && | ||
css` | ||
cursor: pointer; | ||
`} | ||
${(props) => | ||
!props.isPreview && | ||
css` | ||
background-color: ${smokeLightest(props)}; | ||
pointer-events: none; | ||
.MuiChip-root { | ||
.MuiChip-label { | ||
color: ${inkLight(props)}; | ||
} | ||
} | ||
.MuiSvgIcon-root { | ||
color: ${smokeDark(props)}; | ||
} | ||
`} | ||
`; | ||
|
||
export const StyledButtonPrimary = styled(ButtonPrimary)` | ||
justify-self: flex-start; | ||
padding-bottom: 8px; | ||
padding-top: 8px; | ||
export const SectionContent = styled.div` | ||
flex: 1; | ||
h3 { | ||
${textBody500}; | ||
margin: 0 0 4px; | ||
} | ||
p { | ||
${textBody4002Lines}; | ||
color: ${inkLight}; | ||
margin: 0; | ||
} | ||
`; |
94 changes: 43 additions & 51 deletions
94
app/components/Entity/components/AnalysisMethod/analysisMethod.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,60 @@ | ||
import { CardProps } from "@databiosphere/findable-ui/lib/components/common/Card/card"; | ||
import { CardSection } from "@databiosphere/findable-ui/lib/components/common/Card/card.styles"; | ||
import { CardText } from "@databiosphere/findable-ui/lib/components/common/Card/components/CardText/cardText"; | ||
import { CardTitle } from "@databiosphere/findable-ui/lib/components/common/Card/components/CardTitle/cardTitle"; | ||
import { FluidPaper } from "@databiosphere/findable-ui/lib/components/common/Paper/paper.styles"; | ||
import { SouthIcon } from "@databiosphere/findable-ui/lib/components/common/CustomIcon/components/SouthIcon/southIcon"; | ||
import { | ||
ANCHOR_TARGET, | ||
REL_ATTRIBUTE, | ||
} from "@databiosphere/findable-ui/lib/components/Links/common/entities"; | ||
import { | ||
Loading, | ||
LOADING_PANEL_STYLE, | ||
} from "@databiosphere/findable-ui/lib/components/Loading/loading"; | ||
import { useAsync } from "@databiosphere/findable-ui/src/hooks/useAsync"; | ||
import { Card } from "@mui/material"; | ||
import { Chip } from "@mui/material"; | ||
import { WORKFLOW_IDS_BY_ANALYSIS_METHOD } from "app/apis/catalog/brc-analytics-catalog/common/constants"; | ||
import { getWorkflowLandingUrl } from "app/utils/galaxy-api"; | ||
import { ANALYSIS_METHOD } from "../../../../apis/catalog/brc-analytics-catalog/common/entities"; | ||
import { | ||
StyledButtonPrimary, | ||
StyledCardContent, | ||
} from "./analysisMethod.styles"; | ||
|
||
export interface AnalysisMethodProps extends CardProps { | ||
analysisMethod: ANALYSIS_METHOD; | ||
geneModelUrl: string; | ||
genomeVersionAssemblyId: string; | ||
} | ||
import { SectionContent, StyledSection } from "./analysisMethod.styles"; | ||
import { CHIP_PROPS, ICON_PROPS } from "./constants"; | ||
import { Props } from "./types"; | ||
import { getChipColor, getChipLabel } from "./utils"; | ||
|
||
export const AnalysisMethod = ({ | ||
analysisMethod, | ||
content, | ||
geneModelUrl, | ||
genomeVersionAssemblyId, | ||
Paper = FluidPaper, | ||
text, | ||
title, | ||
}: AnalysisMethodProps): JSX.Element => { | ||
}: Props): JSX.Element => { | ||
const workflowId = WORKFLOW_IDS_BY_ANALYSIS_METHOD[analysisMethod]; | ||
const isPreview = Boolean(workflowId); | ||
const { data: landingUrl, isLoading, run } = useAsync<string>(); | ||
return ( | ||
<Card component={Paper}> | ||
<CardSection> | ||
<StyledCardContent> | ||
<CardTitle>{title}</CardTitle> | ||
<CardText>{text}</CardText> | ||
</StyledCardContent> | ||
<StyledButtonPrimary | ||
disabled={!workflowId || isLoading} | ||
onClick={async (): Promise<void> => { | ||
if (!workflowId) return; | ||
const url = | ||
landingUrl ?? | ||
(await run( | ||
getWorkflowLandingUrl( | ||
workflowId, | ||
genomeVersionAssemblyId, | ||
geneModelUrl | ||
) | ||
)); | ||
window.open( | ||
url, | ||
ANCHOR_TARGET.BLANK, | ||
REL_ATTRIBUTE.NO_OPENER_NO_REFERRER | ||
); | ||
}} | ||
> | ||
{isLoading ? "Loading..." : "Analyze"} | ||
</StyledButtonPrimary> | ||
</CardSection> | ||
</Card> | ||
<StyledSection | ||
isPreview={isPreview} | ||
onClick={async (): Promise<void> => { | ||
if (!workflowId) return; | ||
const url = | ||
landingUrl ?? | ||
(await run( | ||
getWorkflowLandingUrl( | ||
workflowId, | ||
genomeVersionAssemblyId, | ||
geneModelUrl | ||
) | ||
)); | ||
window.open( | ||
url, | ||
ANCHOR_TARGET.BLANK, | ||
REL_ATTRIBUTE.NO_OPENER_NO_REFERRER | ||
); | ||
}} | ||
role="button" | ||
> | ||
<Loading loading={isLoading} panelStyle={LOADING_PANEL_STYLE.INHERIT} /> | ||
<SectionContent>{content}</SectionContent> | ||
<Chip | ||
{...CHIP_PROPS} | ||
color={getChipColor(isPreview)} | ||
label={getChipLabel(isPreview)} | ||
/> | ||
<SouthIcon {...ICON_PROPS} /> | ||
</StyledSection> | ||
); | ||
}; |
10 changes: 10 additions & 0 deletions
10
app/components/Entity/components/AnalysisMethod/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ChipProps, SvgIconProps } from "@mui/material"; | ||
|
||
export const CHIP_PROPS: Partial<ChipProps> = { | ||
variant: "status", | ||
}; | ||
|
||
export const ICON_PROPS: Partial<SvgIconProps> = { | ||
color: "inkLight", | ||
fontSize: "small", | ||
}; |
2 changes: 2 additions & 0 deletions
2
app/components/Entity/components/AnalysisMethod/content/assembly.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
### Assembly | ||
|
||
Best practices for assembly of prokaryotic and eukaryotic genomes sequenced with a variety of technologies. |
2 changes: 2 additions & 0 deletions
2
app/components/Entity/components/AnalysisMethod/content/genomeComparisons.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
### Genome comparisons | ||
|
||
Workflows for creation of pairwise and multiple genome alignments. |
2 changes: 2 additions & 0 deletions
2
app/components/Entity/components/AnalysisMethod/content/proteinFolding.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
### Protein folding | ||
|
||
Analysis of protein folding using the ColabFold framework. |
2 changes: 2 additions & 0 deletions
2
app/components/Entity/components/AnalysisMethod/content/regulation.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
### Regulation | ||
|
||
Workflows for the analysis of ChIP-seq, ATAC-Seq and beyond. |
2 changes: 2 additions & 0 deletions
2
app/components/Entity/components/AnalysisMethod/content/transcriptomics.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
### Transcriptomics | ||
|
||
Analyze bulk or single-cell RNA seq data using a variety of approaches. |
2 changes: 2 additions & 0 deletions
2
app/components/Entity/components/AnalysisMethod/content/variantCalling.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
### Variant calling | ||
|
||
Identify nucleotide polymorphisms and short indels from Illumina and Element data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ReactNode } from "react"; | ||
import { ANALYSIS_METHOD } from "../../../../apis/catalog/brc-analytics-catalog/common/entities"; | ||
|
||
export interface Props { | ||
analysisMethod: ANALYSIS_METHOD; | ||
content: ReactNode; | ||
geneModelUrl: string; | ||
genomeVersionAssemblyId: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { STATUS_BADGE_COLOR } from "@databiosphere/findable-ui/lib/components/common/StatusBadge/statusBadge"; | ||
|
||
/** | ||
* Returns chip color. | ||
* @param canPreview - Analysis method can be previewed. | ||
* @returns Chip color. | ||
*/ | ||
export function getChipColor(canPreview: boolean): STATUS_BADGE_COLOR { | ||
return canPreview ? STATUS_BADGE_COLOR.INFO : STATUS_BADGE_COLOR.DEFAULT; | ||
} | ||
|
||
/** | ||
* Returns chip label. | ||
* @param canPreview - Analysis method can be previewed. | ||
* @returns Chip label. | ||
*/ | ||
export function getChipLabel(canPreview: boolean): string { | ||
return canPreview ? "Preview" : "Coming Soon"; | ||
} |
17 changes: 17 additions & 0 deletions
17
app/components/Entity/components/AnalysisMethods/analysisMethods.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { | ||
FluidPaper, | ||
GridPaper, | ||
} from "@databiosphere/findable-ui/lib/components/common/Paper/paper.styles"; | ||
import { GridPaperSection } from "@databiosphere/findable-ui/lib/components/common/Section/section.styles"; | ||
import { Props } from "./types"; | ||
|
||
export const AnalysisMethods = ({ children }: Props): JSX.Element => { | ||
return ( | ||
<FluidPaper> | ||
<GridPaper> | ||
<GridPaperSection>Choose Analysis Method</GridPaperSection> | ||
{children} | ||
</GridPaper> | ||
</FluidPaper> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { ReactNode } from "react"; | ||
|
||
export interface Props { | ||
children: ReactNode | ReactNode[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.