Skip to content

Commit

Permalink
Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsolo1 committed Oct 31, 2023
1 parent 190e815 commit 415490e
Show file tree
Hide file tree
Showing 50 changed files with 754 additions and 707 deletions.
4 changes: 2 additions & 2 deletions browser/src/ClinvarVariantsTrack/ClinvarVariantTrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const ClinvarVariantTrack = ({ referenceGenome, transcripts, variants }: Props)
// @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
includedConsequenceCategories[getCategoryFromConsequence(v.major_consequence)] &&
(!showOnlyGnomad || v.in_gnomad) &&
(v.gold_stars >= starFilter)
v.gold_stars >= starFilter
)

return (
Expand Down Expand Up @@ -229,7 +229,7 @@ const ClinvarVariantTrack = ({ referenceGenome, transcripts, variants }: Props)
<label htmlFor="star-filtering">
Filter by{' '}
{/* @ts-expect-error TS(2786) FIXME: 'ExternalLink' cannot be used as a JSX component. */}
<ExternalLink href='https://www.ncbi.nlm.nih.gov/clinvar/docs/review_status/'>
<ExternalLink href="https://www.ncbi.nlm.nih.gov/clinvar/docs/review_status/">
review status
</ExternalLink>
: &nbsp;
Expand Down
4 changes: 2 additions & 2 deletions browser/src/ConstraintTable/ConstraintTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const transcriptDetails = (
transcriptId = geneOrTranscript.canonical_transcript_id
const canonicalTranscript = transcriptId
? geneOrTranscript.transcripts.find(
(transcript) => transcript.transcript_id === transcriptId
)
(transcript) => transcript.transcript_id === transcriptId
)
: null
transcriptVersion = canonicalTranscript ? canonicalTranscript.transcript_version : null
transcriptDescription = 'Ensembl canonical'
Expand Down
30 changes: 22 additions & 8 deletions browser/src/ConstraintTable/GnomadConstraintTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ Graph.defaultProps = {
color: undefined,
}

const renderOEMetrics = (constraint: GnomadConstraint, category: ConstraintFieldWithOEMetrics, highlightColor: string | null) => {
const renderOEMetrics = (
constraint: GnomadConstraint,
category: ConstraintFieldWithOEMetrics,
highlightColor: string | null
) => {
const value = constraint[`oe_${category}` as OEMetricField]
const lower = constraint[`oe_${category}_lower` as OEMetricField]
const upper = constraint[`oe_${category}_upper` as OEMetricField]
Expand Down Expand Up @@ -150,7 +154,10 @@ export type GnomadConstraint = {
}

type ConstraintFieldWithOEMetrics = 'lof' | 'mis' | 'syn'
type OEMetricField = `oe_${ConstraintFieldWithOEMetrics}` | `oe_${ConstraintFieldWithOEMetrics}_lower` | `oe_${ConstraintFieldWithOEMetrics}_upper`
type OEMetricField =
| `oe_${ConstraintFieldWithOEMetrics}`
| `oe_${ConstraintFieldWithOEMetrics}_lower`
| `oe_${ConstraintFieldWithOEMetrics}_upper`

type GnomadConstraintTableProps = {
constraint: GnomadConstraint
Expand Down Expand Up @@ -249,15 +256,22 @@ const GnomadConstraintTable = ({ constraint }: GnomadConstraintTableProps) => {
{constraintFlags.map((flag) => {
let flagDescription
if (flag in CONSTRAINT_FLAG_DESCRIPTIONS) {
{/* @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message */ }
{
/* @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message */
}
flagDescription = CONSTRAINT_FLAG_DESCRIPTIONS[flag]
} else {
flagDescription = <span>Gene constraint flag: <code>{flag}</code></span>
flagDescription = (
<span>
Gene constraint flag: <code>{flag}</code>
</span>
)
}
return <p key={flag} style={{ maxWidth: '460px' }}>
<Badge level="info">Note</Badge> {flagDescription}
</p>

return (
<p key={flag} style={{ maxWidth: '460px' }}>
<Badge level="info">Note</Badge> {flagDescription}
</p>
)
})}
<p>
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ type Props = {
const CopyNumberVariantFilterControls = ({ onChange, colorKey, value }: Props) => (
<SettingsWrapper>
<CategoryFiltersWrapper>
<CategoryFilterLabel>
Classes
</CategoryFilterLabel>
<CategoryFilterLabel>Classes</CategoryFilterLabel>
<CategoryFilterControl
categories={cnvTypes.map((type) => ({
id: type,
Expand Down
43 changes: 21 additions & 22 deletions browser/src/CopyNumberVariantList/CopyNumberVariantPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ const CopyNumberVariantPlot = ({
// If one endpoint is undefined, which should only happen if the SV extends outside the visible region,
// offset the start/stop coordinate to make room for the arrow marker at the end of the bar.

if (!startIsDefined) {
startX += arrowWidth
}
if (!stopIsDefined) {
stopX -= arrowWidth
}

if (!startIsDefined) {
startX += arrowWidth
}
if (!stopIsDefined) {
stopX -= arrowWidth
}

return (
<svg height={trackHeight} width={width} style={{ overflow: 'visible' }}>
Expand All @@ -76,21 +75,21 @@ const CopyNumberVariantPlot = ({
strokeWidth={1}
/>
(
<React.Fragment>
{!startIsDefined && (
<path
d={`M ${startX} ${barY} l -${arrowWidth} ${halfBarHeight} l ${arrowWidth} ${halfBarHeight} z`}
fill={color}
/>
)}
<rect x={startX} y={barY} width={stopX - startX} height={barHeight} fill={color} />
{!stopIsDefined && (
<path
d={`M ${stopX} ${barY} l ${arrowWidth} ${halfBarHeight} l -${arrowWidth} ${halfBarHeight} z`}
fill={color}
/>
)}
</React.Fragment>
<React.Fragment>
{!startIsDefined && (
<path
d={`M ${startX} ${barY} l -${arrowWidth} ${halfBarHeight} l ${arrowWidth} ${halfBarHeight} z`}
fill={color}
/>
)}
<rect x={startX} y={barY} width={stopX - startX} height={barHeight} fill={color} />
{!stopIsDefined && (
<path
d={`M ${stopX} ${barY} l ${arrowWidth} ${halfBarHeight} l -${arrowWidth} ${halfBarHeight} z`}
fill={color}
/>
)}
</React.Fragment>
)
</svg>
)
Expand Down
10 changes: 5 additions & 5 deletions browser/src/CopyNumberVariantList/CopyNumberVariantPropType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ type CopyNumberVariantPropType = {
}

const PopulationPropType = PropTypes.shape({
id: PropTypes.string.isRequired,
sc: PropTypes.number.isRequired,
sn: PropTypes.number.isRequired,
sf: PropTypes.number.isRequired,
})
id: PropTypes.string.isRequired,
sc: PropTypes.number.isRequired,
sn: PropTypes.number.isRequired,
sf: PropTypes.number.isRequired,
})

// @ts-expect-error TS(2322) FIXME: Type 'Requireable<InferProps<{ ac: Validator<numbe... Remove this comment to see the full error message
const CopyNumberVariantPropType: PropTypes.Requireable<CopyNumberVariantPropType> = PropTypes.shape(
Expand Down
20 changes: 6 additions & 14 deletions browser/src/CopyNumberVariantList/CopyNumberVariants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,9 @@ const Wrapper = styled.div`
margin-bottom: 1em;
`


const HUMAN_CHROMOSOMES = [...Array.from(new Array(22), (x: any, i: any) => `${i + 1}`), 'X', 'Y']


const DEFAULT_COLUMNS = [
'source',
'class',
'pos',
'length',
'sc',
'sn',
'sf',
]
const DEFAULT_COLUMNS = ['source', 'class', 'pos', 'length', 'sc', 'sn', 'sf']

const sortVariants = (variants: any, { sortKey, sortOrder }: any) => {
const sortColumn = copyNumberVariantTableColumns.find((column: any) => column.key === sortKey)
Expand Down Expand Up @@ -158,7 +148,7 @@ const CopyNumberVariants = ({ context, exportFileName, variants }: CopyNumberVar
}
}, [])

// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [colorKey, setColorKey] = useState('type')
const trackColor = useCallback(
// @ts-expect-error TS(7006) FIXME: Parameter 'variant' implicitly has an 'any' type.
Expand Down Expand Up @@ -196,7 +186,6 @@ const CopyNumberVariants = ({ context, exportFileName, variants }: CopyNumberVar
return copy
})


return (
<div>
<Wrapper>
Expand Down Expand Up @@ -251,7 +240,10 @@ const CopyNumberVariants = ({ context, exportFileName, variants }: CopyNumberVar
// @ts-expect-error TS(2322) FIXME: Type '{ ref: MutableRefObject<null>; cellData: { c... Remove this comment to see the full error message
cellData={{
colorKey,
highlightWords: filter.searchText.split(',').map((s) => s.trim()).filter((term) => term !== ''),
highlightWords: filter.searchText
.split(',')
.map((s) => s.trim())
.filter((term) => term !== ''),
}}
columns={renderedTableColumns}
numRowsRendered={numRowsRendered}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const copyNumberVariantTableColumns = [
if (variantType === 'DEL') {
return 'deletion'
}
return 'duplication'
return 'duplication'
},
render: renderType,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const CopyNumberVariantAttributeList = ({ variant }: CopyNumberVariantAttributeL
{/* @ts-expect-error TS(2604) FIXME: JSX element type 'AttributeList.Item' does not hav... Remove this comment to see the full error message */}
<AttributeList.Item label="Class">
{/* @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message */}
{cnvTypeLabels[variant.type]}
{cnvTypeLabels[variant.type]}
</AttributeList.Item>
</AttributeList>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@ import { populationName } from '@gnomad/dataset-metadata/gnomadPopulations'
import { CNVPopulationsTable } from './CNVPopulationsTable'

type CopyNumberVariantPopulation = {
id: string,
sc: number,
sn: number,
sf: number,
name: string
id: string
sc: number
sn: number
sf: number
name: string
}

type Subpopulations = {
[key: string]: CopyNumberVariantPopulation[];
[key: string]: CopyNumberVariantPopulation[]
}


const nestPopulations = (populations: CopyNumberVariantPopulation[]) => {
const popIndices = []
const subpopulations: Subpopulations = {}


for (let i = 0; i < populations.length; i += 1) {
const pop = populations[i]
Expand Down Expand Up @@ -74,12 +72,7 @@ const CopyNumberVariantPopulationsTable = ({ variant }: CopyNumberVariantPopulat
sf: 'Site Frequency',
}

return (
<CNVPopulationsTable
columnLabels={columnLabels}
populations={populations}
/>
)
return <CNVPopulationsTable columnLabels={columnLabels} populations={populations} />
}

export default CopyNumberVariantPopulationsTable
28 changes: 14 additions & 14 deletions browser/src/CoverageTrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ type OwnCoverageTrackProps = {
filenameForExport?: (...args: any[]) => any
height?: number
maxCoverage?: number
datasetId: DatasetId,
datasetId: DatasetId
}

type CoverageTrackState = any
Expand All @@ -107,7 +107,7 @@ class CoverageTrack extends Component<CoverageTrackProps, CoverageTrackState> {
plotElement: any

state = {
selectedMetric: isV4(this.props.datasetId) ? "over_30" : "mean",
selectedMetric: isV4(this.props.datasetId) ? 'over_30' : 'mean',
}

plotRef = (el: any) => {
Expand Down Expand Up @@ -203,19 +203,19 @@ class CoverageTrack extends Component<CoverageTrackProps, CoverageTrackState> {
)
return totalBases < 100
? this.renderBars({
isPositionDefined,
scaleCoverageMetric,
scalePosition,
totalBases,
width,
})
isPositionDefined,
scaleCoverageMetric,
scalePosition,
totalBases,
width,
})
: this.renderArea({
isPositionDefined,
scaleCoverageMetric,
scalePosition,
totalBases,
width,
})
isPositionDefined,
scaleCoverageMetric,
scalePosition,
totalBases,
width,
})
}

render() {
Expand Down
10 changes: 5 additions & 5 deletions browser/src/DatasetSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ const DatasetSelector = withRouter(({ datasetOptions, history, selectedDataset }
})

const topLevelShortVariantDataset = shortVariantDatasetId(selectedDataset)

let datasets: any = []

if (includeShortVariants) {
Expand Down Expand Up @@ -601,9 +601,9 @@ const DatasetSelector = withRouter(({ datasetOptions, history, selectedDataset }
? selectedDataset
: 'gnomad_cnv_r4'

const currentDataset = hasStructuralVariants(selectedDataset)
? topLevelStructuralVariantDataset
: topLevelCopyNumberVariantDataset
const currentDataset = hasStructuralVariants(selectedDataset)
? topLevelStructuralVariantDataset
: topLevelCopyNumberVariantDataset

datasets.push(
{
Expand Down Expand Up @@ -653,7 +653,7 @@ const DatasetSelector = withRouter(({ datasetOptions, history, selectedDataset }
childReferenceGenome: referenceGenome('gnomad_cnv_r4'),
},
],
},
}
)
}

Expand Down
6 changes: 3 additions & 3 deletions browser/src/DownloadsPage/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ const DownloadsPageTableOfContents = () => {
}

type ContentItem = {
link: string,
indent: string,
text: string,
link: string
indent: string
text: string
}

return (
Expand Down
8 changes: 5 additions & 3 deletions browser/src/GenePage/GenePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import GnomadPageHeading from '../GnomadPageHeading'
import InfoButton from '../help/InfoButton'
import Link from '../Link'
import RegionalConstraintTrack from '../RegionalConstraintTrack'
import RegionalMissenseConstraintTrack, { RegionalMissenseConstraint} from '../RegionalMissenseConstraintTrack'
import RegionalMissenseConstraintTrack, {
RegionalMissenseConstraint,
} from '../RegionalMissenseConstraintTrack'
import RegionCoverageTrack from '../RegionPage/RegionCoverageTrack'
import RegionViewer from '../RegionViewer/ZoomableRegionViewer'
import { TrackPage, TrackPageSection } from '../TrackPage'
Expand Down Expand Up @@ -592,8 +594,8 @@ const GenePage = ({ datasetId, gene, geneId }: Props) => {
{/* eslint-disable-next-line no-nested-ternary */}
{hasStructuralVariants(datasetId) ? (
<StructuralVariantsInGene datasetId={datasetId} gene={gene} zoomRegion={zoomRegion} />
// eslint-disable-next-line no-nested-ternary
) : hasCopyNumberVariants(datasetId) ? (
) : // eslint-disable-next-line no-nested-ternary
hasCopyNumberVariants(datasetId) ? (
<CopyNumberVariantsInGene datasetId={datasetId} gene={gene} zoomRegion={zoomRegion} />
) : gene.chrom === 'M' ? (
<MitochondrialVariantsInGene datasetId={datasetId} gene={gene} zoomRegion={zoomRegion} />
Expand Down
Loading

0 comments on commit 415490e

Please sign in to comment.