Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
8471d337
You need to sign in or sign up before continuing.
Commit
8471d337
authored
4 years ago
by
JonStargaryen
Browse files
Options
Downloads
Patches
Plain Diff
add protvar atoms to cca.bcif
parent
b49d036f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cli/chem-comp-dict/create-table.ts
+57
-7
57 additions, 7 deletions
src/cli/chem-comp-dict/create-table.ts
with
57 additions
and
7 deletions
src/cli/chem-comp-dict/create-table.ts
+
57
−
7
View file @
8471d337
...
...
@@ -27,6 +27,10 @@ function ccbKey(compId: string, atomId1: string, atomId2: string) {
return
atomId1
<
atomId2
?
`
${
compId
}
:
${
atomId1
}
-
${
atomId2
}
`
:
`
${
compId
}
:
${
atomId2
}
-
${
atomId1
}
`
;
}
function
ccaKey
(
compId
:
string
,
atomId
:
string
)
{
return
`
${
compId
}
:
${
atomId
}
`
;
}
function
addChemCompBondToSet
(
set
:
Set
<
string
>
,
ccb
:
CCB
)
{
for
(
let
i
=
0
,
il
=
ccb
.
_rowCount
;
i
<
il
;
++
i
)
{
set
.
add
(
ccbKey
(
ccb
.
comp_id
.
value
(
i
),
ccb
.
atom_id_1
.
value
(
i
),
ccb
.
atom_id_2
.
value
(
i
)));
...
...
@@ -36,7 +40,7 @@ function addChemCompBondToSet(set: Set<string>, ccb: CCB) {
function
addChemCompAtomToSet
(
set
:
Set
<
string
>
,
cca
:
CCA
)
{
for
(
let
i
=
0
,
il
=
cca
.
_rowCount
;
i
<
il
;
++
i
)
{
set
.
add
(
cca
.
atom_id
.
value
(
i
));
set
.
add
(
ccaKey
(
cca
.
comp_id
.
value
(
i
),
cca
.
atom_id
.
value
(
i
))
)
;
}
return
set
;
}
...
...
@@ -82,6 +86,27 @@ function checkAddingBondsFromPVCD(pvcd: DatabaseCollection<CCD_Schema>) {
}
}
function
checkAddingAtomsFromPVCD
(
pvcd
:
DatabaseCollection
<
CCD_Schema
>
)
{
const
ccbSetByParent
=
DefaultMap
<
string
,
Set
<
string
>>
(()
=>
new
Set
());
for
(
const
k
in
pvcd
)
{
const
{
chem_comp
,
chem_comp_atom
}
=
pvcd
[
k
];
if
(
chem_comp_atom
.
_rowCount
)
{
const
parentIds
=
chem_comp
.
mon_nstd_parent_comp_id
.
value
(
0
);
if
(
parentIds
.
length
===
0
)
{
const
set
=
ccbSetByParent
.
getDefault
(
chem_comp
.
id
.
value
(
0
));
addChemCompAtomToSet
(
set
,
chem_comp_atom
);
}
else
{
for
(
let
i
=
0
,
il
=
parentIds
.
length
;
i
<
il
;
++
i
)
{
const
parentId
=
parentIds
[
i
];
const
set
=
ccbSetByParent
.
getDefault
(
parentId
);
addChemCompAtomToSet
(
set
,
chem_comp_atom
);
}
}
}
}
}
async
function
createBonds
(
ccd
:
DatabaseCollection
<
CCD_Schema
>
,
pvcd
:
DatabaseCollection
<
CCD_Schema
>
,
...
...
@@ -152,10 +177,12 @@ async function createBonds(
{
chem_comp_bond
:
bondTable
}
);
return
{
bonds
:
bondDatabase
,
atoms
:
atomsRequested
?
createAtoms
(
ccd
)
:
void
0
};
return
{
bonds
:
bondDatabase
,
atoms
:
atomsRequested
?
createAtoms
(
ccd
,
pvcd
)
:
void
0
};
}
function
createAtoms
(
ccd
:
DatabaseCollection
<
CCD_Schema
>
)
{
function
createAtoms
(
ccd
:
DatabaseCollection
<
CCD_Schema
>
,
pvcd
:
DatabaseCollection
<
CCD_Schema
>
)
{
const
ccaSet
=
new
Set
<
string
>
();
const
comp_id
:
string
[]
=
[];
const
atom_id
:
string
[]
=
[];
const
charge
:
number
[]
=
[];
...
...
@@ -163,10 +190,33 @@ function createAtoms(ccd: DatabaseCollection<CCD_Schema>) {
function
addAtoms
(
compId
:
string
,
cca
:
CCA
)
{
for
(
let
i
=
0
,
il
=
cca
.
_rowCount
;
i
<
il
;
++
i
)
{
atom_id
.
push
(
cca
.
atom_id
.
value
(
i
));
comp_id
.
push
(
compId
);
charge
.
push
(
cca
.
charge
.
value
(
i
));
pdbx_stereo_config
.
push
(
cca
.
pdbx_stereo_config
.
value
(
i
));
const
atomId
=
cca
.
atom_id
.
value
(
i
);
const
k
=
ccaKey
(
compId
,
atomId
);
if
(
!
ccaSet
.
has
(
k
))
{
atom_id
.
push
(
atomId
);
comp_id
.
push
(
compId
);
charge
.
push
(
cca
.
charge
.
value
(
i
));
pdbx_stereo_config
.
push
(
cca
.
pdbx_stereo_config
.
value
(
i
));
ccaSet
.
add
(
k
);
}
}
}
// check adding atoms from PVCD
checkAddingAtomsFromPVCD
(
pvcd
);
// add atoms from PVCD
for
(
const
k
in
pvcd
)
{
const
{
chem_comp
,
chem_comp_atom
}
=
pvcd
[
k
];
if
(
chem_comp_atom
.
_rowCount
)
{
const
parentIds
=
chem_comp
.
mon_nstd_parent_comp_id
.
value
(
0
);
if
(
parentIds
.
length
===
0
)
{
addAtoms
(
chem_comp
.
id
.
value
(
0
),
chem_comp_atom
);
}
else
{
for
(
let
i
=
0
,
il
=
parentIds
.
length
;
i
<
il
;
++
i
)
{
addAtoms
(
parentIds
[
i
],
chem_comp_atom
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment