Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-salazar committed Aug 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent aa7d93e commit e282f44
Showing 14 changed files with 41 additions and 35 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
storybook-static/
storybook-static/
.nx/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"lint": "yarn lint:lit-analyzer && yarn lint:eslint",
"lint:eslint": "eslint 'packages/**/*.ts'",
"lint:lit-analyzer": "lit-analyzer packages/*/src/**/*.{js,ts}",
"format": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --ignore-path ./.eslintignore --write",
"format": "prettier \"**/*.{cjs,html,js,md,ts}\" --ignore-path ./.eslintignore --write",
"analyze": "cem analyze --litelement --globs \"src/**/*.ts\"",
"analyze:watch": "cem analyze --litelement --globs \"src/**/*.ts\" --watch",
"serve": "wds --node-resolve --watch",
10 changes: 5 additions & 5 deletions packages/nightingale-msa/src/nightingale-msa.ts
Original file line number Diff line number Diff line change
@@ -21,8 +21,8 @@ const DEAFULT_COLOR_SCHEME = "clustal2";
@customElement("nightingale-msa")
class NightingaleMSA extends withManager(
withResizable(
withHighlight(withMargin(withDimensions(withPosition(NightingaleElement))))
)
withHighlight(withMargin(withDimensions(withPosition(NightingaleElement)))),
),
) {
@property({
attribute: "color-scheme",
@@ -55,7 +55,7 @@ class NightingaleMSA extends withManager(
overlayConservtion?: boolean = false;

worker = new Worker(
window.URL.createObjectURL(new Blob([conservationInlineWorkerString]))
window.URL.createObjectURL(new Blob([conservationInlineWorkerString])),
);

private sequenceViewer?: SequenceViewerComponent | null;
@@ -68,7 +68,7 @@ class NightingaleMSA extends withManager(
new CustomEvent("conservationProgress", {
bubbles: true,
detail: e.data,
})
}),
);
if (e.data.progress === 1) {
const conservation = {
@@ -174,7 +174,7 @@ class NightingaleMSA extends withManager(
},
fillColor: this["highlight-color"],
borderColor: this["highlight-color"],
}) as Region
}) as Region,
);
}
protected firstUpdated() {
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ declare const self: Worker & { previous: unknown };
export const calculateConservation = (
sequences: SequencesMSA,
sampleSize: number | null = null,
isWorker = false
isWorker = false,
) => {
const aLetterOffset = "A".charCodeAt(0);
const lettersInAlphabet = 26;
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ export const customElementOnce =
(tagName: string): CustomElementDecorator =>
(
classOrTarget: CustomElementClass | Constructor<HTMLElement>,
context?: ClassDecoratorContext<Constructor<HTMLElement>>
context?: ClassDecoratorContext<Constructor<HTMLElement>>,
) => {
if (!window.customElements.get(tagName))
if (context) customElement(tagName)(classOrTarget, context);
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ export interface WithSVGHighlightInterface
updateHighlight: () => void;
}
const withSVGHighlight = <T extends Constructor<NightingaleBaseElement>>(
superClass: T
superClass: T,
) => {
class WithSVGHighlight extends withZoom(withHighlight(superClass)) {
protected highlighted?: Selection<
@@ -53,7 +53,7 @@ const withSVGHighlight = <T extends Constructor<NightingaleBaseElement>>(
.attr("height", this.height)
.attr("x", (d) => this.getXFromSeqPosition(d.start))
.attr("width", (d) =>
Math.max(0, this.getSingleBaseWidth() * (d.end - d.start + 1))
Math.max(0, this.getSingleBaseWidth() * (d.end - d.start + 1)),
);

highlighs.exit().remove();
6 changes: 3 additions & 3 deletions packages/nightingale-new-core/src/mixins/withMargin/index.ts
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ export interface withMarginInterface
unknown,
HTMLElement | SVGElement | null,
unknown
>
>,
) => void;
}

@@ -42,7 +42,7 @@ const withMargin = <T extends Constructor<NightingaleBaseElement>>(
"margin-left"?: number;
"margin-right"?: number;
"margin-color"?: string | null;
} = {}
} = {},
) => {
class WithMargin extends withDimensions(superClass) {
#intitialOptions = { ...defaultOptions, ...options };
@@ -75,7 +75,7 @@ const withMargin = <T extends Constructor<NightingaleBaseElement>>(
unknown,
HTMLElement | SVGElement | null,
unknown
>
>,
) {
if (!g) return;

Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ const withResizable = <T extends Constructor<NightingaleBaseElement>>(
options: {
"min-width"?: number;
"min-height"?: number;
} = {}
} = {},
) => {
class WithResizable extends withDimensions(superClass) {
#intitialOptions = { ...defaultOptions, ...options };
14 changes: 7 additions & 7 deletions packages/nightingale-new-core/src/mixins/withZoom/index.ts
Original file line number Diff line number Diff line change
@@ -37,10 +37,10 @@ export interface WithZoomInterface
const ATTRIBUTES_THAT_TRIGGER_REFRESH = ["length", "width", "height"];

const withZoom = <T extends Constructor<NightingaleBaseElement>>(
superClass: T
superClass: T,
) => {
class WithZoom extends withMargin(
withPosition(withResizable(withDimensions(superClass)))
withPosition(withResizable(withDimensions(superClass))),
) {
_applyZoomTranslation: () => void;
/**
@@ -157,7 +157,7 @@ const withZoom = <T extends Constructor<NightingaleBaseElement>>(
attributeChangedCallback(
name: string,
oldValue: string | null,
newValue: string | null
newValue: string | null,
): void {
super.attributeChangedCallback(name, oldValue, newValue);

@@ -190,12 +190,12 @@ const withZoom = <T extends Constructor<NightingaleBaseElement>>(
"display-start": Math.max(1, start),
"display-end": Math.min(
this.length || 0,
Math.max(end - 1, start + 1) // To make sure it never zooms in deeper than showing 2 bases covering the full width
Math.max(end - 1, start + 1), // To make sure it never zooms in deeper than showing 2 bases covering the full width
),
},
bubbles: true,
cancelable: true,
})
}),
);
}
}
@@ -208,7 +208,7 @@ const withZoom = <T extends Constructor<NightingaleBaseElement>>(
1,
// +1 because the displayend base should be included
(this.length || 0) /
(1 + (this["display-end"] || 0) - (this["display-start"] || 0))
(1 + (this["display-end"] || 0) - (this["display-start"] || 0)),
);
// The deltaX gets calculated using the position of the first base to display in original scale
const dx = -this.originXScale(this["display-start"] || 0);
@@ -219,7 +219,7 @@ const withZoom = <T extends Constructor<NightingaleBaseElement>>(
this.zoom.transform,
zoomIdentity // Identity transformation
.scale(k) // Scaled by our scaled factor
.translate(dx, 0) // Translated by the delta
.translate(dx, 0), // Translated by the delta
);
}
this.dontDispatch = false;
8 changes: 6 additions & 2 deletions packages/nightingale-sequence-heatmap/README.md
Original file line number Diff line number Diff line change
@@ -72,7 +72,9 @@ Allows dynamic setting of heatmap color palette

```javascript
customElements.whenDefined("nightingale-sequence-heatmap").then(() => {
const heatmapElement = document.getElementById("id-for-nightingale-sequence-heatmap");
const heatmapElement = document.getElementById(
"id-for-nightingale-sequence-heatmap",
);

const colorScale = d3.scaleLinear(
[0, 1], // score value domain
@@ -88,7 +90,9 @@ Allows dynamic setting of tooltip HTML content

```javascript
customElements.whenDefined("nightingale-sequence-heatmap").then(() => {
const heatmapElement = document.getElementById("id-for-nightingale-sequence-heatmap");
const heatmapElement = document.getElementById(
"id-for-nightingale-sequence-heatmap",
);

heatmapElement.heatmapInstance.setTooltip((d, x, y, xIndex, yIndex) => {
let returnHTML = `
8 changes: 4 additions & 4 deletions packages/nightingale-variation/src/nightingale-variation.ts
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ const aaList = [

@customElement("nightingale-variation")
class NightingaleVariation extends withManager(
withSVGHighlight(NightingaleElement)
withSVGHighlight(NightingaleElement),
) {
/**
* Indicates the data is in the format of the protein API and needs to be transformed acordingly
@@ -269,7 +269,7 @@ class NightingaleVariation extends withManager(
updateScale() {
if (this.yScale) {
const aaToDisplay = aaList.filter((aa) =>
this.condensedView ? this.processedData?.aaPresence[aa] : true
this.condensedView ? this.processedData?.aaPresence[aa] : true,
);
if (this.rowHeight) {
this.height =
@@ -283,7 +283,7 @@ class NightingaleVariation extends withManager(
this.svg?.attr("width", this.width).attr("height", this.height);

const yAxisLScale = axisLeft(this.yScale).tickSize(
-this.getWidthWithMargins()
-this.getWidthWithMargins(),
);
this.axisLeft
?.attr("class", "variation-y-left axis")
@@ -295,7 +295,7 @@ class NightingaleVariation extends withManager(
"transform",
`translate(${
this.getWidthWithMargins() - this["margin-right"] + 2
}, 0)`
}, 0)`,
)
.attr("class", "variation-y-right axis")
.call(yAxisRScale);
11 changes: 6 additions & 5 deletions packages/nightingale-variation/src/proteinAPI.ts
Original file line number Diff line number Diff line change
@@ -208,7 +208,7 @@ const getSourceType = (xrefs: Xref[], sourceType: SourceType) => {
};

export const transformData = (
data: ProteinsAPIVariation
data: ProteinsAPIVariation,
): {
sequence: string;
variants: VariationDatum[];
@@ -218,9 +218,10 @@ export const transformData = (
(variant) =>
({
...variant,
accession: (variant.genomicLocation || []).length !== 0
? (variant.genomicLocation || [])[0]
: '',
accession:
(variant.genomicLocation || []).length !== 0
? (variant.genomicLocation || [])[0]
: "",
variant: variant.alternativeSequence
? variant.alternativeSequence
: AminoAcid.Empty,
@@ -230,7 +231,7 @@ export const transformData = (
// tooltipContent: formatTooltip(variant),
protvistaFeatureId: String(Math.random()),
consequenceType: variant.consequenceType,
}) as VariationDatum
}) as VariationDatum,
);
if (!variants) return null;
return { sequence, variants };
2 changes: 1 addition & 1 deletion packages/nightingale-variation/src/variationPlot.ts
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ class VariationPlot {
HTMLElement | SVGElement | null,
unknown
>,
element: NightingaleVariation
element: NightingaleVariation,
) {
const ftWidth = element.getSingleBaseWidth();
const half = ftWidth / 2;
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ SequenceHeatmap.args = {
SequenceHeatmap.play = async () => {
await customElements.whenDefined("nightingale-sequence-heatmap");
const heatmapElement = document.getElementsByTagName(
"nightingale-sequence-heatmap"
"nightingale-sequence-heatmap",
)[0] as any;
if (heatmapElement) heatmapElement.setHeatmapData(xDomain, yDomain, data);
};

0 comments on commit e282f44

Please sign in to comment.