File size: 893 Bytes
71174bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import type { TreeNodeList } from "@/TreeNodes/TreeNodeList/TreeNodeList";
import { parseMolecularModelFromTexts } from "./ParseMolModelsUtils";
import type { IFormatInfo } from "../Types/MolFormats";
import type { FileInfo } from "@/FileSystem/FileInfo";

/**
 * Uses 3DMol.js to parse the a molecular-model file.
 *
 * @param  {FileInfo}    fileInfo           The file to parse.
 * @param  {IFormatInfo} formatInfo         The format of the file.
 * @returns {Promise<TreeNodeList>}  A promise that resolves when the file is
 *    parsed. The promise resolves to a TreeNodeList containing the frames. Can
 *    also resolve void.
 */
export function parseUsing3DMolJs(
    fileInfo: FileInfo,
    formatInfo: IFormatInfo
): Promise<TreeNodeList> {
    return parseMolecularModelFromTexts(
        [fileInfo],
        formatInfo.primaryExt
    ).catch((err) => {
        throw err;
    });
}