Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
ac497932
Unverified
Commit
ac497932
authored
Mar 06, 2024
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix loading embedded restraint data
parent
9927b506
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
45 deletions
+53
-45
src/compound.cpp
+53
-45
No files found.
src/compound.cpp
View file @
ac497932
...
...
@@ -550,12 +550,6 @@ class local_compound_factory_impl : public compound_factory_impl
for
(
const
auto
&
[
id
,
name
,
threeLetterCode
,
group
]
:
file
[
"comp_list"
][
"chem_comp"
].
rows
<
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
>
(
"id"
,
"name"
,
"three_letter_code"
,
"group"
))
{
// if (std::regex_match(group, peptideRx))
// mKnownPeptides.insert(threeLetterCode);
// else if (cif::iequals(group, "DNA") or cif::iequals(group, "RNA"))
// mKnownBases.insert(threeLetterCode);
// Test if this compound is known in CCD
auto
&
rdb
=
m_local_file
[
"comp_"
+
id
];
if
(
rdb
.
empty
())
{
...
...
@@ -563,6 +557,53 @@ class local_compound_factory_impl : public compound_factory_impl
continue
;
}
construct_compound
(
rdb
,
id
,
name
,
threeLetterCode
,
group
);
}
}
compound
*
create
(
const
std
::
string
&
id
)
override
;
private
:
compound
*
construct_compound
(
const
datablock
&
db
,
const
std
::
string
&
id
,
const
std
::
string
&
name
,
const
std
::
string
&
three_letter_code
,
const
std
::
string
&
group
);
cif
::
file
m_local_file
;
};
compound
*
local_compound_factory_impl
::
create
(
const
std
::
string
&
id
)
{
compound
*
result
=
nullptr
;
for
(
auto
&
db
:
m_local_file
)
{
if
(
db
.
name
()
==
"comp_"
+
id
)
{
auto
chem_comp
=
db
.
get
(
"chem_comp"
);
if
(
not
chem_comp
)
break
;
try
{
const
auto
&
[
id
,
name
,
threeLetterCode
,
group
]
=
chem_comp
->
front
().
get
<
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
>
(
"id"
,
"name"
,
"three_letter_code"
,
"group"
);
result
=
construct_compound
(
db
,
id
,
name
,
threeLetterCode
,
group
);
}
catch
(
const
std
::
exception
&
ex
)
{
std
::
throw_with_nested
(
std
::
runtime_error
(
"Error loading compound "
+
id
));
}
break
;
}
}
return
result
;
}
compound
*
local_compound_factory_impl
::
construct_compound
(
const
datablock
&
rdb
,
const
std
::
string
&
id
,
const
std
::
string
&
name
,
const
std
::
string
&
three_letter_code
,
const
std
::
string
&
group
)
{
cif
::
datablock
db
(
id
);
float
formula_weight
=
0
;
...
...
@@ -644,48 +685,15 @@ class local_compound_factory_impl : public compound_factory_impl
{
"formula"
,
formula
},
{
"pdbx_formal_charge"
,
formal_charge
},
{
"formula_weight"
,
formula_weight
},
{
"three_letter_code"
,
threeLetterC
ode
}
{
"three_letter_code"
,
three_letter_c
ode
}
});
m_compounds
.
push_back
(
new
compound
(
db
));
}
}
// compound *create(const std::string &id) override;
private
:
cif
::
file
m_local_file
;
};
// compound *local_compound_factory_impl::create(const std::string &id)
// {
// compound *result = nullptr;
// for (auto &db : m_local_file)
// {
// if (db.name() == id)
// {
// cif::datablock db_copy(db);
// try
// {
// result = new compound(db_copy, 1);
// }
// catch (const std::exception &ex)
// {
// std::throw_with_nested(std::runtime_error("Error loading compound " + id));
// }
// std::shared_lock lock(mMutex);
// m_compounds.push_back(result);
// break;
// }
// }
std
::
shared_lock
lock
(
mMutex
);
// return result;
// }
auto
result
=
new
compound
(
db
);
m_compounds
.
push_back
(
result
);
return
result
;
}
// --------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment