|
@@ -37,7 +37,7 @@ async function downloadPDB(plugin: PluginContext, url: string, id: string, asset
|
|
|
}
|
|
|
|
|
|
export async function getFromPdb(plugin: PluginContext, pdbId: string, assetManager: AssetManager) {
|
|
|
- //${pdbId.toUpperCase()}
|
|
|
+ // ${pdbId.toUpperCase()}
|
|
|
const { cif, asset } = await downloadCif(plugin, `https://models.rcsb.org/${pdbId}.bcif`, true, assetManager);
|
|
|
return { mmcif: cif.blocks[0], asset };
|
|
|
}
|
|
@@ -77,33 +77,33 @@ export function getStructureMean(structure: Structure) {
|
|
|
return Vec3.create(xSum / elementCount, ySum / elementCount, zSum / elementCount);
|
|
|
}
|
|
|
|
|
|
-export function getFloatValue(value: DataView, offset : number) {
|
|
|
- // if the last byte is a negative value (MSB is 1), the final
|
|
|
- // float should be too
|
|
|
- const negative = value.getInt8(offset + 2) >>> 31;
|
|
|
+export function getFloatValue(value: DataView, offset: number) {
|
|
|
+ // if the last byte is a negative value (MSB is 1), the final
|
|
|
+ // float should be too
|
|
|
+ const negative = value.getInt8(offset + 2) >>> 31;
|
|
|
|
|
|
- // this is how the bytes are arranged in the byte array/DataView
|
|
|
- // buffer
|
|
|
- const [b0, b1, b2, exponent] = [
|
|
|
- // get first three bytes as unsigned since we only care
|
|
|
- // about the last 8 bits of 32-bit js number returned by
|
|
|
- // getUint8().
|
|
|
- // Should be the same as: getInt8(offset) & -1 >>> 24
|
|
|
- value.getUint8(offset),
|
|
|
- value.getUint8(offset + 1),
|
|
|
- value.getUint8(offset + 2),
|
|
|
+ // this is how the bytes are arranged in the byte array/DataView
|
|
|
+ // buffer
|
|
|
+ const [b0, b1, b2, exponent] = [
|
|
|
+ // get first three bytes as unsigned since we only care
|
|
|
+ // about the last 8 bits of 32-bit js number returned by
|
|
|
+ // getUint8().
|
|
|
+ // Should be the same as: getInt8(offset) & -1 >>> 24
|
|
|
+ value.getUint8(offset),
|
|
|
+ value.getUint8(offset + 1),
|
|
|
+ value.getUint8(offset + 2),
|
|
|
|
|
|
- // get the last byte, which is the exponent, as a signed int
|
|
|
- // since it's already correct
|
|
|
- value.getInt8(offset + 3)
|
|
|
- ];
|
|
|
+ // get the last byte, which is the exponent, as a signed int
|
|
|
+ // since it's already correct
|
|
|
+ value.getInt8(offset + 3)
|
|
|
+ ];
|
|
|
|
|
|
- let mantissa = b0 | (b1 << 8) | (b2 << 16);
|
|
|
- if (negative) {
|
|
|
- // need to set the most significant 8 bits to 1's since a js
|
|
|
- // number is 32 bits but our mantissa is only 24.
|
|
|
- mantissa |= 255 << 24;
|
|
|
- }
|
|
|
+ let mantissa = b0 | (b1 << 8) | (b2 << 16);
|
|
|
+ if (negative) {
|
|
|
+ // need to set the most significant 8 bits to 1's since a js
|
|
|
+ // number is 32 bits but our mantissa is only 24.
|
|
|
+ mantissa |= 255 << 24;
|
|
|
+ }
|
|
|
|
|
|
- return mantissa * Math.pow(10, exponent);
|
|
|
+ return mantissa * Math.pow(10, exponent);
|
|
|
}
|