-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
74 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright Global Phasing Ltd. | ||
|
||
#include "common.h" | ||
#include <gemmi/unitcell.hpp> | ||
|
||
void add_cell() { | ||
em::class_<gemmi::UnitCell>("UnitCell") | ||
.property("a", &gemmi::UnitCell::a) | ||
.property("b", &gemmi::UnitCell::b) | ||
.property("c", &gemmi::UnitCell::c) | ||
.property("alpha", &gemmi::UnitCell::alpha) | ||
.property("beta", &gemmi::UnitCell::beta) | ||
.property("gamma", &gemmi::UnitCell::gamma) | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// interface for mtz.js that can be built with "make mtz.js" | ||
|
||
export interface UnitCell { | ||
a: number; | ||
b: number; | ||
c: number; | ||
alpha: number; | ||
beta: number; | ||
gamma: number; | ||
delete(): void; | ||
} | ||
|
||
export interface Mtz { | ||
readonly cell: UnitCell; | ||
readonly nx: number; | ||
readonly ny: number; | ||
readonly nz: number; | ||
readonly rmsd: number; | ||
readonly last_error: string; | ||
read(_0: number, _1: number): boolean; | ||
calculate_map(_0: boolean): any; | ||
calculate_map_from_labels(_0: string, _1: string): any; | ||
delete(): void; | ||
} | ||
|
||
export interface Module { | ||
readMtz(mtz_buf: string|ArrayBuffer): Mtz; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const fs = require('node:fs'); | ||
const zlib = require('node:zlib'); | ||
const Gemmi = require('./gemmi.js') | ||
|
||
|
||
test('counts atom occupancies', () => { | ||
Gemmi().then((gemmi) => { | ||
const path = '../tests/5wkd_phases.mtz.gz'; | ||
const buffer_gz = fs.readFileSync(path); | ||
const buffer = zlib.gunzipSync(new Buffer.from(buffer_gz)); | ||
const mtz = gemmi.readMtz(buffer); | ||
expect(mtz.cell.a).toBe(50.347); | ||
expect(mtz.cell.gamma).toBe(90.); | ||
mtz.delete(); | ||
}); | ||
}); |