Skip to content
Snippets Groups Projects
Commit ee43a971 authored by Alexander Rose's avatar Alexander Rose
Browse files

added model.properties.asymIdSerialMap

parent f56574eb
No related branches found
No related tags found
No related merge requests found
......@@ -135,7 +135,7 @@ function isHierarchyDataEqual(a: AtomicData, b: AtomicData) {
&& Table.areEqual(a.atoms as Table<AtomsSchema>, b.atoms as Table<AtomsSchema>)
}
function modResMap(format: mmCIF_Format) {
function getModifiedResidueNameMap(format: mmCIF_Format) {
const data = format.data.pdbx_struct_mod_residue;
const map = new Map<string, string>();
const comp_id = data.label_comp_id.isDefined ? data.label_comp_id : data.auth_comp_id;
......@@ -148,6 +148,24 @@ function modResMap(format: mmCIF_Format) {
return map;
}
function getAsymIdSerialMap(format: mmCIF_Format) {
const data = format.data.struct_asym;
const map = new Map<string, number>();
let serial = 0
const id = data.id
const count = data._rowCount
for (let i = 0; i < count; ++i) {
const _id = id.value(i)
if (!map.has(_id)) {
map.set(_id, serial)
serial += 1
}
}
return map;
}
function createModel(format: mmCIF_Format, atom_site: AtomSite, previous?: Model): Model {
const hierarchyOffsets = findHierarchyOffsets(atom_site);
const hierarchyData = createHierarchyData(atom_site, hierarchyOffsets);
......@@ -176,7 +194,8 @@ function createModel(format: mmCIF_Format, atom_site: AtomSite, previous?: Model
? format.data.entry.id.value(0)
: format.data._name;
const modifiedResidueNameMap = modResMap(format);
const modifiedResidueNameMap = getModifiedResidueNameMap(format);
const asymIdSerialMap = getAsymIdSerialMap(format)
return {
id: UUID.create(),
......@@ -191,7 +210,8 @@ function createModel(format: mmCIF_Format, atom_site: AtomSite, previous?: Model
coarseConformation: coarse.conformation,
properties: {
secondaryStructure: getSecondaryStructureMmCif(format.data, atomicHierarchy),
modifiedResidueNameMap
modifiedResidueNameMap,
asymIdSerialMap
},
symmetry: getSymmetry(format)
};
......
......@@ -13,7 +13,7 @@ import { CoarseHierarchy, CoarseConformation } from './properties/coarse'
import { Entities } from './properties/common';
import { SecondaryStructure } from './properties/seconday-structure';
//import from_gro from './formats/gro'
// import from_gro from './formats/gro'
import from_mmCIF from './formats/mmcif'
/**
* Interface to the "source data" of the molecule.
......@@ -40,6 +40,7 @@ interface Model extends Readonly<{
readonly secondaryStructure: SecondaryStructure,
// maps modified residue name to its parent
readonly modifiedResidueNameMap: Map<string, string>,
readonly asymIdSerialMap: Map<string, number>,
[customName: string]: any
},
......@@ -54,7 +55,7 @@ interface Model extends Readonly<{
namespace Model {
export function create(format: Format) {
switch (format.kind) {
//case 'gro': return from_gro(format);
// case 'gro': return from_gro(format);
case 'mmCIF': return from_mmCIF(format);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment