Skip to content
Snippets Groups Projects
Commit 8891fa32 authored by dsehnal's avatar dsehnal
Browse files

cif2bcif BCIF => CIF conversion support

parent a23c06c4
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,11 @@ Note that since we don't clearly distinguish between a public and private interf ...@@ -6,7 +6,11 @@ Note that since we don't clearly distinguish between a public and private interf
## [Unreleased] ## [Unreleased]
## [v3.5.0] - 2022-03-25
- Fix issues with bounding-sphere & color-smoothing (mostly for small geometries) - Fix issues with bounding-sphere & color-smoothing (mostly for small geometries)
- Support BCIF => CIF conversion in ``cif2bcif`` CLI tool
## [v3.4.0] - 2022-03-13 ## [v3.4.0] - 2022-03-13
......
...@@ -141,7 +141,7 @@ and navigate to `build/viewer` ...@@ -141,7 +141,7 @@ and navigate to `build/viewer`
export NODE_PATH="lib"; node build/state-docs export NODE_PATH="lib"; node build/state-docs
**Convert any CIF to BinaryCIF** **Convert any CIF to BinaryCIF (or vice versa)**
node lib/commonjs/servers/model/preprocess -i file.cif -ob file.bcif node lib/commonjs/servers/model/preprocess -i file.cif -ob file.bcif
...@@ -151,6 +151,11 @@ Or ...@@ -151,6 +151,11 @@ Or
node lib/commonjs/cli/cif2bcif node lib/commonjs/cli/cif2bcif
E.g.
node lib/commonjs/cli/cif2bcif src.cif out.bcif.gz
node lib/commonjs/cli/cif2bcif src.bcif.gz out.cif
## Development ## Development
### Installation ### Installation
......
...@@ -71,7 +71,7 @@ function classify(name: string, field: CifField): CifWriter.Field { ...@@ -71,7 +71,7 @@ function classify(name: string, field: CifField): CifWriter.Field {
} }
export function convert(path: string, asText = false, hints?: EncodingStrategyHint[], filter?: string) { export function convert(path: string, asText = false, hints?: EncodingStrategyHint[], filter?: string) {
return Task.create<Uint8Array>('BinaryCIF', async ctx => { return Task.create<Uint8Array>('Convert CIF', async ctx => {
const encodingProvider: BinaryEncodingProvider = hints const encodingProvider: BinaryEncodingProvider = hints
? CifWriter.createEncodingProviderFromJsonConfig(hints) ? CifWriter.createEncodingProviderFromJsonConfig(hints)
: { get: (c, f) => void 0 }; : { get: (c, f) => void 0 };
......
...@@ -18,7 +18,7 @@ async function process(srcPath: string, outPath: string, configPath?: string, fi ...@@ -18,7 +18,7 @@ async function process(srcPath: string, outPath: string, configPath?: string, fi
const config = configPath ? JSON.parse(fs.readFileSync(configPath, 'utf8')) : void 0; const config = configPath ? JSON.parse(fs.readFileSync(configPath, 'utf8')) : void 0;
const filter = filterPath ? fs.readFileSync(filterPath, 'utf8') : void 0; const filter = filterPath ? fs.readFileSync(filterPath, 'utf8') : void 0;
const res = await convert(srcPath, false, config, filter); const res = await convert(srcPath, srcPath.toLowerCase().indexOf('.bcif') > 0, config, filter);
await write(outPath, res); await write(outPath, res);
} }
...@@ -38,13 +38,13 @@ function run(args: Args) { ...@@ -38,13 +38,13 @@ function run(args: Args) {
const parser = new argparse.ArgumentParser({ const parser = new argparse.ArgumentParser({
add_help: true, add_help: true,
description: 'Convert any CIF file to a BCIF file' description: 'Convert any BCIF file to a CIF file or vice versa'
}); });
parser.add_argument('src', { parser.add_argument('src', {
help: 'Source CIF path' help: 'Source file path'
}); });
parser.add_argument('out', { parser.add_argument('out', {
help: 'Output BCIF path' help: 'Output file path'
}); });
parser.add_argument('-c', '--config', { parser.add_argument('-c', '--config', {
help: 'Optional encoding strategy/precision config path', help: 'Optional encoding strategy/precision config path',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment