|
@@ -9,27 +9,29 @@ import { PDBTMDescriptor } from './types';
|
|
|
|
|
|
export function registerTmDetSymmetry(pdbtmDescriptor: PDBTMDescriptor) {
|
|
|
ModelSymmetry.Provider.formatRegistry.remove('mmCIF');
|
|
|
- const chains = constructChainListFromOperations(pdbtmDescriptor);
|
|
|
+ const excludedChains = constructChainListFromOperations(pdbtmDescriptor);
|
|
|
ModelSymmetry.Provider.formatRegistry.add('mmCIF', function(model: Model) {
|
|
|
- return tmDetSymmetryFromMmCif(model, chains);
|
|
|
+ return tmDetSymmetryFromMmCif(model, excludedChains);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function constructChainListFromOperations(pdbtmDescriptor: PDBTMDescriptor): string[] {
|
|
|
- console.log("PDBTMDesc", pdbtmDescriptor);
|
|
|
const excludedChains: string[] = [];
|
|
|
// add chain deletes
|
|
|
- pdbtmDescriptor.additional_entry_annotations.biomatrix.chain_deletes.forEach(
|
|
|
- chainId => excludedChains.push(chainId)
|
|
|
- );
|
|
|
+ const biomatrix = pdbtmDescriptor.additional_entry_annotations.biomatrix;
|
|
|
+ if (biomatrix != undefined && biomatrix.chain_deletes != undefined) {
|
|
|
+ biomatrix.chain_deletes.forEach(
|
|
|
+ chainId => excludedChains.push(chainId)
|
|
|
+ );
|
|
|
+ }
|
|
|
// exclude result of transformations
|
|
|
- pdbtmDescriptor.additional_entry_annotations.biomatrix.matrix_list.forEach(
|
|
|
- matrix => matrix.apply_to_chain_list.forEach(
|
|
|
- applyItem => excludedChains.push(applyItem.new_chain_id)
|
|
|
- )
|
|
|
- );
|
|
|
- console.log(excludedChains);
|
|
|
- // todo all minus excluded
|
|
|
+ if (biomatrix != undefined && biomatrix.matrix_list != undefined) {
|
|
|
+ biomatrix.matrix_list.forEach(
|
|
|
+ matrix => matrix.apply_to_chain_list.forEach(
|
|
|
+ applyItem => excludedChains.push(applyItem.new_chain_id)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
return excludedChains;
|
|
|
}
|
|
@@ -40,15 +42,13 @@ function tmDetSymmetryFromMmCif(model: Model, chainsForOperExpression: string[])
|
|
|
let data = model.sourceData.data.db;
|
|
|
let asymIdColumnData: string[][] = [];
|
|
|
// update chains (asym) for each author_defined_assemly
|
|
|
- for (let i = 0; i < data.pdbx_struct_assembly._rowCount; i++) {
|
|
|
- if (data.pdbx_struct_assembly.details.value(i).startsWith('author_defined_assembly')) {
|
|
|
- const currentAssemblyId: string = data.pdbx_struct_assembly_gen.assembly_id.value(i);
|
|
|
- const result: string[][] = createAsymIdColumnData(
|
|
|
- data.pdbx_struct_assembly_gen, currentAssemblyId, chainsForOperExpression
|
|
|
- );
|
|
|
- asymIdColumnData = asymIdColumnData.concat(result);
|
|
|
- }
|
|
|
- }
|
|
|
+ // NOTE: We assume that the first assembly is an author defined assembly.
|
|
|
+ const currentAssemblyId: string = data.pdbx_struct_assembly_gen.assembly_id.value(0);
|
|
|
+ const result: string[][] = createAsymIdColumnData(
|
|
|
+ data.pdbx_struct_assembly_gen, currentAssemblyId, chainsForOperExpression
|
|
|
+ );
|
|
|
+ asymIdColumnData = asymIdColumnData.concat(result);
|
|
|
+
|
|
|
const asym_id_list_column = Column.ofStringListArray(asymIdColumnData);
|
|
|
// create table with new column
|
|
|
let updated_pdbx_struct_assembly_gen = Table.ofColumns(
|
|
@@ -56,8 +56,7 @@ function tmDetSymmetryFromMmCif(model: Model, chainsForOperExpression: string[])
|
|
|
{
|
|
|
assembly_id: data.pdbx_struct_assembly_gen.assembly_id,
|
|
|
asym_id_list: asym_id_list_column,
|
|
|
- oper_expression: data.pdbx_struct_assembly_gen.oper_expression,
|
|
|
-
|
|
|
+ oper_expression: data.pdbx_struct_assembly_gen.oper_expression
|
|
|
}
|
|
|
);
|
|
|
|