${this.show_directory_checkbox
? html`
`
: ''}
${this.renderSelectedFiles()}
`;
}
handleFileChanges(event: InputEvent) {
event.preventDefault();
this.selectedFiles = Array.from(
(event.currentTarget as HTMLInputElement).files
).filter((file: File) => this.acceptsFile(file));
this.progress = Object.fromEntries(
this.selectedFiles.map((file: File) => [file.name, 0])
);
this.signatures = {};
this.errors = {};
const signatureFiles = this.selectedFiles.filter((file: File) =>
this.isSignatureFile(file)
);
const sequenceFiles = this.selectedFiles.filter(
(file: File) => !this.isSignatureFile(file)
);
if (sequenceFiles.length) {
worker.postMessage({
files: sequenceFiles,
options: {
num: this.num,
ksize: this.ksize,
is_protein: this.is_protein,
dayhoff: this.dayhoff,
hp: this.hp,
seed: this.seed,
scaled: this.scaled,
track_abundance: this.track_abundance,
},
});
}
this.dispatchEvent(
new CustomEvent('change', {
bubbles: true,
detail: {
selectedFiles: this.selectedFiles,
},
})
);
signatureFiles.forEach((file: File) => this.loadSignatureFile(file));
this.requestUpdate();
}
}
declare global {
interface HTMLElementTagNameMap {
'mgnify-sourmash-component': MGnifySourmash;
}
}