Skip to content

Commit

Permalink
Add more variant information to right hand panel (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyothishnt authored Jan 31, 2024
1 parent afd4908 commit c7b956e
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export const variantDefaultQuery = gql`
start
end
}
strand {
code
}
}
allele_sequence
reference_sequence
Expand Down Expand Up @@ -126,6 +129,7 @@ type VariantDetailsAllelePredictionResult = Pick<
export type VariantDetails = Pick<Variant, 'name'> &
Pick3<Variant, 'slice', 'location', 'start' | 'end' | 'length'> &
Pick3<Variant, 'slice', 'region', 'name'> &
Pick3<Variant, 'slice', 'strand', 'code'> &
Pick2<Variant, 'allele_type', 'value'> &
Pick2<Variant, 'primary_source', 'url'> &
Pick3<Variant, 'primary_source', 'source', 'name' | 'release'> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ import {
AccordionItemPanel,
AccordionItemButton
} from 'src/shared/components/accordion';
import VariantVCF from 'src/shared/components/variant-vcf/VariantVCF';
import ViewInApp from 'src/shared/components/view-in-app/ViewInApp';

import VariantLocation from 'src/content/app/genome-browser/components/drawer/drawer-views/variant-summary/variant-location/VariantLocation';

import { buildFocusIdForUrl } from 'src/shared/helpers/focusObjectHelpers';
import { getReferenceAndAltAlleles } from 'src/shared/helpers/variantHelpers';
import { getStrandDisplayName } from 'src/shared/helpers/formatters/strandFormatter';

import type { VariantDetails } from 'src/content/app/entity-viewer/state/api/queries/variantDefaultQuery';
import { Strand } from 'src/shared/types/core-api/strand';

import styles from './VariantOverview.module.css';

Expand All @@ -43,6 +50,15 @@ type Props = {

const MainAccordion = (props: Props) => {
const { genomeId, variantId, variant, activeAlleleId } = props;

const gbVariantUrl = urlFor.browser({
genomeId: genomeId,
focus: buildFocusIdForUrl({
type: 'variant',
objectId: variantId
})
});

const disabledAccordionButtonClass = classNames(
styles.entityViewerAccordionButton,
{
Expand All @@ -55,7 +71,7 @@ const MainAccordion = (props: Props) => {
<Accordion
className={styles.entityViewerAccordion}
allowMultipleExpanded={true}
preExpanded={['alleles']}
preExpanded={['alleles', 'in_this_region']}
>
<AccordionItem
className={styles.entityViewerAccordionItem}
Expand All @@ -78,22 +94,44 @@ const MainAccordion = (props: Props) => {
</AccordionItemPanel>
</AccordionItem>

<section>
<div className={styles.sectionHead}>Location</div>
<div className={styles.sectionContent}>
<div>
<VariantLocation variant={variant} />
<span className={styles.featureDetails}>
{getStrandDisplayName(Strand.FORWARD)}
</span>
</div>

<div className={styles.labelValueWrapper}>
<div className={styles.label}>VCF</div>
<VariantVCF variant={variant} withCopy={true} />
</div>
</div>
</section>

<AccordionItem
className={styles.entityViewerAccordionItem}
uuid={'in_this_region'}
>
<AccordionItemHeading className={styles.entityViewerAccordionHeader}>
<AccordionItemButton
className={disabledAccordionButtonClass}
disabled={true}
>
<AccordionItemButton className={styles.entityViewerAccordionButton}>
In this region
</AccordionItemButton>
</AccordionItemHeading>
<AccordionItemPanel
className={styles.entityViewerAccordionItemContent}
>
<div>No data available</div>
<section>
<div>
See other variants, structural variants, genes and regulatory
features in their genomic context
</div>
<div className={styles.newRowGroup}>
<ViewInApp links={{ genomeBrowser: { url: gbVariantUrl } }} />
</div>
</section>
</AccordionItemPanel>
</AccordionItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
font-size: 13px;
}

.defaultContent {
margin: 15px;
}

.row {
display: flex;
align-items: baseline;
Expand All @@ -16,13 +12,15 @@
}

.label {
line-height: 1.2;
font-weight: var(--font-weight-light);
text-align: right;
font-size: 12px;
margin-right: 10px;
}

.labelValueWrapper {
display: flex;
margin-top: 10px;
}
.externalLink {
padding-top: 8px;
}
Expand All @@ -49,6 +47,24 @@
flex-direction: column;
}

.sectionHead {
font-size: 12px;
font-weight: var(--font-weight-light);
border-bottom: 1px solid var(--color-grey);
margin-bottom: 15px;
margin-top: 20px;
}

.sectionContent {
margin-left: 15px;
margin-bottom: 15px;
}

.featureDetails {
font-size: 11px;
font-weight: var(--font-weight-light);
margin-left: 12px;
}

/* NOTE: the styles below require the extra specificity in order to overwrite Accordion styles
We should update the Accordion to use CSS variables.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const VariantOverview = () => {

return (
<div className={styles.overviewContainer}>
<section className={styles.defaultContent}>
<section className={styles.sectionContent}>
<div>
<span className={styles.labelTextStrong}>{variant.name}</span>
<span className={styles.variantType}>
Expand Down
1 change: 0 additions & 1 deletion src/shared/components/variant-vcf/VariantVCF.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type Props = {

const VariantVCF = (props: Props) => {
const vcfSequenceParts = getVCFStringParts(props.variant);

const componentClasses = classNames(styles.container, props.className);

return (
Expand Down

0 comments on commit c7b956e

Please sign in to comment.