Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Binary file added assets/icon.ico
Binary file not shown.
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" type="image/png" sizes="192x192" href="/hict-icon-192.png" />
<link rel="icon" type="image/png" sizes="256x256" href="/hict-icon-256.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HiCT</title>
<style>
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"tauri:payload": "node scripts/build-tauri-browser-payload.mjs",
"tauri:payload:linux": "npm run build:web && node scripts/build-tauri-browser-payload.mjs --platform linux_x86_64",
"tauri:payload:windows": "npm run build:web && node scripts/build-tauri-browser-payload.mjs --platform windows_x86_64",
"tauri:payload:darwin-arm64": "npm run build:web && node scripts/build-tauri-browser-payload.mjs --platform darwin_arm64",
"tauri:payload:darwin-x86_64": "npm run build:web && node scripts/build-tauri-browser-payload.mjs --platform darwin_x86_64",
"app:dev": "npm run electron:compile && concurrently vite \"electron . http://localhost:8080/\" \"npm run watch\"",
"app:build": "npm run build && electron-builder",
"app:multibuild": "npm run build && electron-builder -wl --ia-32 --x64 --publish never",
Expand Down Expand Up @@ -128,6 +130,7 @@
"buildResources": "assets",
"output": "release/${version}"
},
"icon": "assets/icon",
"win": {
"target": [
{
Expand Down
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/hict-icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/hict-icon-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/hict-logo-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 18 additions & 5 deletions scripts/build-tauri-browser-payload.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const generatedIconPngBase64 = [
"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAD6ElEQVR4nM2WQWhUVxSGv/vuezOTmcnMaMSaEBJFEUQSNKVoceWqs6oLSxcVunDRRTfqypWbum1JQ0u7sIiU0oWkENw0WagFQagBwXRjcROkVtq0kCBhJibvni7ezeS+926SSSi0PwyEe879//+ce+ZM4D+GOjt9vQZI+hRWZv7g9dwiKgrSoTBoy6pZnZ3+NnX+VvNDVBREsmZK7rmsGqLRBqV33siqJHTAp8AoYDaOFXq4jPr1FZjULS1GJsP+8menzl80P/9wE4BT5y8S1ArB2p+ty8B7QNyhKmrC4TIoBZLiCoC5ELgLvA/UN2wLeqiM7i8R/9YC5ZYkg/Ff7Z/EyOzbH30MwNqLZeR1+01ELgMDG7mg+0vooXJWHGAJGA+AKWAyFRJQlZBobA+qkH4ChAExcino0aV4oUW80CLo0SUxcglxxAFVCBKOSuhr/yQwFQArwBfA81TYCOFwGX24mr9s5Jxpx01pxUgrxrTjJkbOZYvQh6tJ+01O/bnVXFkv7wnwDVmpUFE42UBVcxVUMVxRJd2nSroPwxWg6oqrakjhZANCRQZitZ4ABPeb19YDN4HH2dRgf5HoeC09BwAiZ2TNXJA1cwGRM6mYguh4jWB/0df6x1aL+81ruA/8ApggeZI02UidYF+OTGPkKkauAjplel+RaKSeN51wT1gtIPkq4HRhCpjJdkH12nbqDKMwkB08tH22Xu/gzViNjmZmxHkFjAN/Z03oI1XCIe9AbcAI4VAZfcQzuAnnuNXooGPA6cID4PvsbVUMiMYaqB7tI0861aOTnGK2LrCcDzJa6Q7YQAx8BTzLCujBMuHRXh85AOHRXvRg2WfwmeWMXfGcAQdPga9xVup6dnSiQVCP0iICQT0iOtHwMcaW66lPKJfuOPwOeJgKCgR9BaLRzIQriEbrBH0FX/UPLRfZ6r0GHCwAnwPL2UB4rIY+UErEBPSBEuGxmo9j2XIsbCbiNeA4/RG4kwoKqIomGtuTbLlQ2X3vHc47lsNb/aYGHLRIFsfLrInwUIXwoP0cqvjEX9q7ra0ENjXgOH4E3MolRIrC6b0UTu+FKL/y7J1HGa4cvDddnJ2+DnCQpJ0j3tv56n8B3gXmtxKH7Z9gHfPAl8Bq6lS84qs2d74b4m0NOBXcBu51wXnP5m7Z+q4NOFgk+UotbZGzZHMWuyXtyoBTyV1sdZvgts3pqvquDTjY6n3n8c3Jv2XAqWgOuEHu14AbNtZ19TsykCG+Bcw6oVl7tiPxHRtw8DvJlmvbz4Q92zG2XUQ+2OVUYeMflw+A5Z1WDxDuxoDFMvCJ8/eusKsOQKcLHeym+v8F/gEnK0D2mS+qQgAAAABJRU5ErkJggg=="
].join("");

if (!["linux_x86_64", "windows_x86_64"].includes(platform)) {
if (!["linux_x86_64", "windows_x86_64", "darwin_arm64", "darwin_x86_64"].includes(platform)) {
throw new Error(`Unsupported Tauri browser payload platform: ${platform}`);
}
if (!existsSync(resolve(repoDir, "dist", "index.html"))) {
Expand All @@ -63,7 +63,7 @@ mkdirSync(join(outputDir, "licenses"), { recursive: true });

const command = platform === "windows_x86_64" ? "bin/hict-tauri-browser.exe" : "bin/hict-tauri-browser";
cpSync(builtExecutable, join(outputDir, command));
if (platform === "linux_x86_64") {
if (platform !== "windows_x86_64") {
chmodExecutable(join(outputDir, command));
}

Expand All @@ -75,7 +75,8 @@ writeFileSync(
"",
"This payload contains a small Rust/Tauri wrapper written by the HiCT team.",
"It does not bundle Chromium. It uses the operating system WebView runtime:",
"Microsoft Edge WebView2 on Windows and WebKitGTK on Linux.",
"Microsoft Edge WebView2 on Windows, WebKitGTK on Linux, and WKWebView",
"from macOS.",
"",
"Tauri, WRY, TAO and their Rust dependencies are redistributed as compiled",
"Rust code under their upstream licenses. See cargo-metadata.json for the",
Expand Down Expand Up @@ -115,6 +116,10 @@ const manifest = {
windows: {
runtime: "Microsoft Edge WebView2 Runtime",
detection: "EdgeUpdate Clients {F3017226-FE2A-4295-8BDF-00C3A9A7E4C5} pv registry value or standard Microsoft/EdgeWebView installation directory"
},
macos: {
runtime: "WKWebView",
detection: "Built into macOS; no separate browser runtime is bundled or required."
}
},
sizeBytes: directorySize(outputDir),
Expand Down Expand Up @@ -154,6 +159,9 @@ function detectPlatform() {
if (process.platform === "linux") {
return "linux_x86_64";
}
if (process.platform === "darwin") {
return process.arch === "arm64" ? "darwin_arm64" : "darwin_x86_64";
}
throw new Error(`Unsupported platform for HiCT Tauri browser payload: ${process.platform}`);
}

Expand All @@ -171,14 +179,19 @@ function ensureTauriConventionalIcons() {
const iconsDir = resolve(tauriDir, "icons");
const pngPath = resolve(iconsDir, "icon.png");
const icoPath = resolve(iconsDir, "icon.ico");
const sourcePngPath = resolve(repoDir, "public", "hict-logo-512.png");
const faviconPath = resolve(repoDir, "public", "favicon.ico");
const pngBuffer = Buffer.from(generatedIconPngBase64, "base64");

mkdirSync(iconsDir, { recursive: true });
writeFileSync(pngPath, pngBuffer);
if (existsSync(sourcePngPath)) {
cpSync(sourcePngPath, pngPath);
} else {
writeFileSync(pngPath, Buffer.from(generatedIconPngBase64, "base64"));
}
if (existsSync(faviconPath)) {
cpSync(faviconPath, icoPath);
} else {
const pngBuffer = readFileSync(pngPath);
writeFileSync(icoPath, icoBufferFromPng(pngBuffer));
}
}
Expand Down
13 changes: 2 additions & 11 deletions src/ContigMouseWheelZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default class ContigMouseWheelZoom extends MouseWheelZoom {

if (this.useAnchor_) {
this.lastMouseCoord = mapBrowserEvent.coordinate;
this.lastAnchor_ = mapBrowserEvent.coordinate;
this.lastMousePixel = mapBrowserEvent.pixel;
this.lastCenterPixel = [
Math.round(map.getSize()[0] / 2),
Expand Down Expand Up @@ -293,22 +294,12 @@ export default class ContigMouseWheelZoom extends MouseWheelZoom {
} catch (error) {
console.warn("Unable to derive zoom target guidance resolution", error);
}
const guidanceResolutionChanged =
oldGuidanceDescriptor &&
newGuidanceDescriptor &&
(oldGuidanceDescriptor.bpResolution !==
newGuidanceDescriptor.bpResolution ||
oldGuidanceDescriptor.pixelResolution !==
newGuidanceDescriptor.pixelResolution ||
oldGuidanceDescriptor.sourceName !== newGuidanceDescriptor.sourceName);

if (
this.lastMouseBps &&
this.lastCenterPixel &&
this.lastMousePixel &&
this.lastMouseCoord &&
!isNaN(this.lastMouseCoord[0]) &&
guidanceResolutionChanged
!isNaN(this.lastMouseCoord[0])
) {
if (newGuidanceDescriptor) {
const dimensionHolder = this.getDimensionHolderForDescriptor(
Expand Down
29 changes: 29 additions & 0 deletions src/app/core/net/api/RequestManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ import {
StartConversionJobRequest,
StartDotplotJobsRequest,
ListDotplotJobsRequest,
StopDotplotJobRequest,
ListConversionJobsRequest,
GetConversionJobRequest,
GetConversionToolchainStatusRequest,
SetDotplotAlignerPreferenceRequest,
ConvertAssemblyToAgpRequest,
ApplyJuiceboxAssemblyRequest,
StopConversionJobRequest,
RenameContigRequest,
RenameScaffoldRequest,
Expand Down Expand Up @@ -913,6 +915,14 @@ class RequestManager {
);
}

public async stopDotplotJob(
jobId: string
): Promise<{ status: string; jobId: string }> {
return this.sendRequest(new StopDotplotJobRequest(jobId)).then(
(response) => response.data
);
}

public async listConversionJobs(): Promise<ConversionJobResponse[]> {
return this.sendRequest(new ListConversionJobsRequest()).then((response) =>
(response.data as Record<string, unknown>[]).map((job) =>
Expand Down Expand Up @@ -1094,6 +1104,25 @@ class RequestManager {
});
}

public async applyJuiceboxAssembly(request: ApplyJuiceboxAssemblyRequest): Promise<AssemblyInfo> {
return this.sendRequest(request)
.then((response) => response.data)
.then((json) => new AssemblyInfoDTO(json).toEntity())
.then((asmInfo) => {
this.networkManager.mapManager?.contigDimensionHolder.updateContigData(
asmInfo.contigDescriptors
);
this.networkManager.mapManager?.scaffoldHolder.updateScaffoldData(
asmInfo.scaffoldDescriptors
);
this.networkManager.mapManager?.reloadVisuals();
return asmInfo;
})
.catch((err) => {
throw new Error("Cannot apply Juicebox assembly: " + err);
});
}

public async getFASTAForAssembly(
request: GetFastaForAssemblyRequest
): Promise<unknown> {
Expand Down
21 changes: 21 additions & 0 deletions src/app/core/net/api/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ class ListDotplotJobsRequest implements HiCTAPIRequest {
requestPath = "/dotplot/jobs/list";
}

class StopDotplotJobRequest implements HiCTAPIRequest {
public requestPath: string;
public constructor(public readonly jobId: string) {
this.requestPath = `/dotplot/jobs/${jobId}/stop`;
}
}

class SetContrastRangeRequest implements HiCTAPIRequest {
requestPath = "/set_contrast_range";

Expand Down Expand Up @@ -403,6 +410,18 @@ class LoadAGPRequest implements HiCTAPIRequest {
) {}
}

class ApplyJuiceboxAssemblyRequest implements HiCTAPIRequest {
requestPath = "/apply_juicebox_assembly";

public constructor(
public readonly options: {
readonly assemblyFilename: string;
readonly fastaFilename?: string;
readonly source?: "PRIMARY" | "SECONDARY";
}
) {}
}

class OpenProgressRequest implements HiCTAPIRequest {
requestPath = "/open_progress";
public constructor() {}
Expand Down Expand Up @@ -690,6 +709,7 @@ export {
SetDotplotAlignerPreferenceRequest,
StartDotplotJobsRequest,
ListDotplotJobsRequest,
StopDotplotJobRequest,
RenameContigRequest,
RenameScaffoldRequest,
ExportNameMappingRequest,
Expand All @@ -708,6 +728,7 @@ export {
MoveSelectionRangeRequest,
ListAGPFilesRequest,
LoadAGPRequest,
ApplyJuiceboxAssemblyRequest,
OpenProgressRequest,
OpenSecondarySourceRequest,
CloseSecondarySourceRequest,
Expand Down
25 changes: 25 additions & 0 deletions src/app/core/net/dto/requestDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
MoveSelectionRangeRequest,
ListAGPFilesRequest,
LoadAGPRequest,
ApplyJuiceboxAssemblyRequest,
OpenProgressRequest,
OpenSecondarySourceRequest,
CloseSecondarySourceRequest,
Expand Down Expand Up @@ -76,6 +77,7 @@ import {
SetDotplotAlignerPreferenceRequest,
ConvertAssemblyToAgpRequest,
ListDotplotJobsRequest,
StopDotplotJobRequest,
ListConversionJobsRequest,
GetConversionJobRequest,
StopConversionJobRequest,
Expand Down Expand Up @@ -144,6 +146,8 @@ abstract class HiCTAPIRequestDTO<
);
case entity instanceof ListDotplotJobsRequest:
return new ListDotplotJobsRequestDTO(entity as ListDotplotJobsRequest);
case entity instanceof StopDotplotJobRequest:
return new StopDotplotJobRequestDTO(entity as StopDotplotJobRequest);
case entity instanceof UngroupContigsFromScaffoldRequest:
return new UngroupContigsFromScaffoldRequestDTO(
entity as UngroupContigsFromScaffoldRequest
Expand Down Expand Up @@ -240,6 +244,10 @@ abstract class HiCTAPIRequestDTO<
return new ListAGPFilesRequestDTO(entity);
case entity instanceof LoadAGPRequest:
return new LoadAGPRequestDTO(entity as LoadAGPRequest);
case entity instanceof ApplyJuiceboxAssemblyRequest:
return new ApplyJuiceboxAssemblyRequestDTO(
entity as ApplyJuiceboxAssemblyRequest
);
case entity instanceof OpenProgressRequest:
return new OpenProgressRequestDTO(entity);
case entity instanceof OpenSecondarySourceRequest:
Expand Down Expand Up @@ -569,6 +577,12 @@ class ListDotplotJobsRequestDTO extends HiCTAPIRequestDTO<ListDotplotJobsRequest
}
}

class StopDotplotJobRequestDTO extends HiCTAPIRequestDTO<StopDotplotJobRequest> {
toDTO(): Record<string, unknown> {
return {};
}
}

class ListConversionJobsRequestDTO extends HiCTAPIRequestDTO<ListConversionJobsRequest> {
toDTO(): Record<string, unknown> {
return {};
Expand Down Expand Up @@ -680,6 +694,16 @@ class LoadAGPRequestDTO extends HiCTAPIRequestDTO<LoadAGPRequest> {
}
}

class ApplyJuiceboxAssemblyRequestDTO extends HiCTAPIRequestDTO<ApplyJuiceboxAssemblyRequest> {
toDTO(): Record<string, unknown> {
return {
assemblyFilename: this.entity.options.assemblyFilename,
fastaFilename: this.entity.options.fastaFilename,
source: this.entity.options.source,
};
}
}

class GroupContigsIntoScaffoldRequestDTO extends HiCTAPIRequestDTO<GroupContigsIntoScaffoldRequest> {
toDTO(): Record<string, unknown> {
return {
Expand Down Expand Up @@ -1005,6 +1029,7 @@ export {
StartDotplotJobsRequestDTO,
SetDotplotAlignerPreferenceRequestDTO,
ListDotplotJobsRequestDTO,
StopDotplotJobRequestDTO,
ListConversionJobsRequestDTO,
GetConversionJobRequestDTO,
StopConversionJobRequestDTO,
Expand Down
Loading
Loading