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
24ca1017
Unverified
Commit
24ca1017
authored
Oct 11, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mm::polymer to have its own auth_asym_id
parent
85c21aeb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
30 deletions
+28
-30
include/cif++/model.hpp
+12
-15
src/model.cpp
+16
-15
No files found.
include/cif++/model.hpp
View file @
24ca1017
...
@@ -403,12 +403,16 @@ class residue
...
@@ -403,12 +403,16 @@ class residue
// constructor
// constructor
residue
(
const
structure
&
structure
,
const
std
::
string
&
compoundID
,
residue
(
const
structure
&
structure
,
const
std
::
string
&
compoundID
,
const
std
::
string
&
asymID
,
int
seqID
,
const
std
::
string
&
authSeqID
)
const
std
::
string
&
asymID
,
int
seqID
,
const
std
::
string
&
authAsymID
,
const
std
::
string
&
authSeqID
,
const
std
::
string
&
pdbInsCode
)
:
m_structure
(
&
structure
)
:
m_structure
(
&
structure
)
,
m_compound_id
(
compoundID
)
,
m_compound_id
(
compoundID
)
,
m_asym_id
(
asymID
)
,
m_asym_id
(
asymID
)
,
m_seq_id
(
seqID
)
,
m_seq_id
(
seqID
)
,
m_auth_asym_id
(
authAsymID
)
,
m_auth_seq_id
(
authSeqID
)
,
m_auth_seq_id
(
authSeqID
)
,
m_pdb_ins_code
(
pdbInsCode
)
{
{
}
}
...
@@ -427,16 +431,9 @@ class residue
...
@@ -427,16 +431,9 @@ class residue
const
std
::
string
&
get_asym_id
()
const
{
return
m_asym_id
;
}
const
std
::
string
&
get_asym_id
()
const
{
return
m_asym_id
;
}
int
get_seq_id
()
const
{
return
m_seq_id
;
}
int
get_seq_id
()
const
{
return
m_seq_id
;
}
const
std
::
string
get_auth_asym_id
()
const
const
std
::
string
get_auth_asym_id
()
const
{
return
m_auth_asym_id
;
}
{
return
m_atoms
.
empty
()
?
m_asym_id
:
m_atoms
.
front
().
get_auth_asym_id
();
}
const
std
::
string
get_auth_seq_id
()
const
{
return
m_auth_seq_id
;
}
const
std
::
string
get_auth_seq_id
()
const
{
return
m_auth_seq_id
;
}
std
::
string
get_pdb_ins_code
()
const
{
return
m_pdb_ins_code
;
}
std
::
string
get_pdb_ins_code
()
const
{
return
m_atoms
.
empty
()
?
""
:
m_atoms
.
front
().
get_pdb_ins_code
();
}
const
std
::
string
&
get_compound_id
()
const
{
return
m_compound_id
;
}
const
std
::
string
&
get_compound_id
()
const
{
return
m_compound_id
;
}
void
set_compound_id
(
const
std
::
string
&
id
)
{
m_compound_id
=
id
;
}
void
set_compound_id
(
const
std
::
string
&
id
)
{
m_compound_id
=
id
;
}
...
@@ -501,7 +498,7 @@ class residue
...
@@ -501,7 +498,7 @@ class residue
const
structure
*
m_structure
=
nullptr
;
const
structure
*
m_structure
=
nullptr
;
std
::
string
m_compound_id
,
m_asym_id
;
std
::
string
m_compound_id
,
m_asym_id
;
int
m_seq_id
=
0
;
int
m_seq_id
=
0
;
std
::
string
m_auth_
seq_id
;
std
::
string
m_auth_
asym_id
,
m_auth_seq_id
,
m_pdb_ins_code
;
std
::
vector
<
atom
>
m_atoms
;
std
::
vector
<
atom
>
m_atoms
;
};
};
...
@@ -519,7 +516,7 @@ class monomer : public residue
...
@@ -519,7 +516,7 @@ class monomer : public residue
monomer
&
operator
=
(
monomer
&&
rhs
);
monomer
&
operator
=
(
monomer
&&
rhs
);
monomer
(
const
polymer
&
polymer
,
size_t
index
,
int
seqID
,
const
std
::
string
&
authSeqID
,
monomer
(
const
polymer
&
polymer
,
size_t
index
,
int
seqID
,
const
std
::
string
&
authSeqID
,
const
std
::
string
&
compoundID
);
const
std
::
string
&
pdbInsCode
,
const
std
::
string
&
compoundID
);
bool
is_first_in_chain
()
const
;
bool
is_first_in_chain
()
const
;
bool
is_last_in_chain
()
const
;
bool
is_last_in_chain
()
const
;
...
@@ -582,7 +579,7 @@ class monomer : public residue
...
@@ -582,7 +579,7 @@ class monomer : public residue
class
polymer
:
public
std
::
vector
<
monomer
>
class
polymer
:
public
std
::
vector
<
monomer
>
{
{
public
:
public
:
polymer
(
const
structure
&
s
,
const
std
::
string
&
entityID
,
const
std
::
string
&
asymID
);
polymer
(
const
structure
&
s
,
const
std
::
string
&
entityID
,
const
std
::
string
&
asymID
,
const
std
::
string
&
auth_asym_id
);
polymer
(
const
polymer
&
)
=
delete
;
polymer
(
const
polymer
&
)
=
delete
;
polymer
&
operator
=
(
const
polymer
&
)
=
delete
;
polymer
&
operator
=
(
const
polymer
&
)
=
delete
;
...
@@ -593,16 +590,16 @@ class polymer : public std::vector<monomer>
...
@@ -593,16 +590,16 @@ class polymer : public std::vector<monomer>
const
structure
*
get_structure
()
const
{
return
m_structure
;
}
const
structure
*
get_structure
()
const
{
return
m_structure
;
}
std
::
string
get_asym_id
()
const
{
return
m_asym_id
;
}
std
::
string
get_asym_id
()
const
{
return
m_asym_id
;
}
std
::
string
get_auth_asym_id
()
const
{
return
m_auth_asym_id
;
}
// The PDB chain ID, actually
std
::
string
get_entity_id
()
const
{
return
m_entity_id
;
}
std
::
string
get_entity_id
()
const
{
return
m_entity_id
;
}
// std::string chainID() const;
// int Distance(const monomer &a, const monomer &b) const;
// int Distance(const monomer &a, const monomer &b) const;
private
:
private
:
const
structure
*
m_structure
;
const
structure
*
m_structure
;
std
::
string
m_entity_id
;
std
::
string
m_entity_id
;
std
::
string
m_asym_id
;
std
::
string
m_asym_id
;
std
::
string
m_auth_asym_id
;
};
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
...
src/model.cpp
View file @
24ca1017
...
@@ -566,8 +566,8 @@ std::ostream &operator<<(std::ostream &os, const residue &res)
...
@@ -566,8 +566,8 @@ std::ostream &operator<<(std::ostream &os, const residue &res)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// monomer
// monomer
monomer
::
monomer
(
const
polymer
&
polymer
,
size_t
index
,
int
seqID
,
const
std
::
string
&
authSeqID
,
const
std
::
string
&
compoundID
)
monomer
::
monomer
(
const
polymer
&
polymer
,
size_t
index
,
int
seqID
,
const
std
::
string
&
authSeqID
,
const
std
::
string
&
pdbInsCode
,
const
std
::
string
&
compoundID
)
:
residue
(
*
polymer
.
get_structure
(),
compoundID
,
polymer
.
get_asym_id
(),
seqID
,
authSeqID
)
:
residue
(
*
polymer
.
get_structure
(),
compoundID
,
polymer
.
get_asym_id
(),
seqID
,
polymer
.
get_auth_asym_id
(),
authSeqID
,
pdbInsCode
)
,
m_polymer
(
&
polymer
)
,
m_polymer
(
&
polymer
)
,
m_index
(
index
)
,
m_index
(
index
)
{
{
...
@@ -955,11 +955,11 @@ bool monomer::is_cis(const monomer &a, const monomer &b)
...
@@ -955,11 +955,11 @@ bool monomer::is_cis(const monomer &a, const monomer &b)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// polymer
// polymer
polymer
::
polymer
(
const
structure
&
s
,
const
std
::
string
&
entityID
,
const
std
::
string
&
asym_id
)
polymer
::
polymer
(
const
structure
&
s
,
const
std
::
string
&
entityID
,
const
std
::
string
&
asym_id
,
const
std
::
string
&
auth_asym_id
)
:
m_structure
(
const_cast
<
structure
*>
(
&
s
))
:
m_structure
(
const_cast
<
structure
*>
(
&
s
))
,
m_entity_id
(
entityID
)
,
m_entity_id
(
entityID
)
,
m_asym_id
(
asym_id
)
,
m_asym_id
(
asym_id
)
// , mPolySeq(s.m_db["pdbx_poly_seq_scheme"), key("asym_id") == m_asym_id and key("entity_id") == m_entity_i]
)
,
m_auth_asym_id
(
auth_asym_id
)
{
{
using
namespace
cif
::
literals
;
using
namespace
cif
::
literals
;
...
@@ -971,8 +971,8 @@ polymer::polymer(const structure &s, const std::string &entityID, const std::str
...
@@ -971,8 +971,8 @@ polymer::polymer(const structure &s, const std::string &entityID, const std::str
for
(
auto
r
:
poly_seq_scheme
.
find
(
"asym_id"
_key
==
asym_id
))
for
(
auto
r
:
poly_seq_scheme
.
find
(
"asym_id"
_key
==
asym_id
))
{
{
int
seqID
;
int
seqID
;
std
::
string
compoundID
,
authSeqID
;
std
::
string
compoundID
,
authSeqID
,
pdbInsCode
;
cif
::
tie
(
seqID
,
authSeqID
,
compoundID
)
=
r
.
get
(
"seq_id"
,
"auth_seq_num"
,
"mon_id
"
);
cif
::
tie
(
seqID
,
authSeqID
,
compoundID
,
pdbInsCode
)
=
r
.
get
(
"seq_id"
,
"auth_seq_num"
,
"mon_id"
,
"pdb_ins_code
"
);
size_t
index
=
size
();
size_t
index
=
size
();
...
@@ -980,11 +980,11 @@ polymer::polymer(const structure &s, const std::string &entityID, const std::str
...
@@ -980,11 +980,11 @@ polymer::polymer(const structure &s, const std::string &entityID, const std::str
if
(
not
ix
.
count
(
seqID
))
if
(
not
ix
.
count
(
seqID
))
{
{
ix
[
seqID
]
=
index
;
ix
[
seqID
]
=
index
;
emplace_back
(
*
this
,
index
,
seqID
,
authSeqID
,
compoundID
);
emplace_back
(
*
this
,
index
,
seqID
,
authSeqID
,
pdbInsCode
,
compoundID
);
}
}
else
if
(
VERBOSE
>
0
)
else
if
(
VERBOSE
>
0
)
{
{
monomer
m
{
*
this
,
index
,
seqID
,
authSeqID
,
compoundID
};
monomer
m
{
*
this
,
index
,
seqID
,
authSeqID
,
pdbInsCode
,
compoundID
};
std
::
cerr
<<
"Dropping alternate residue "
<<
m
<<
std
::
endl
;
std
::
cerr
<<
"Dropping alternate residue "
<<
m
<<
std
::
endl
;
}
}
}
}
...
@@ -1043,7 +1043,7 @@ polymer::polymer(const structure &s, const std::string &entityID, const std::str
...
@@ -1043,7 +1043,7 @@ polymer::polymer(const structure &s, const std::string &entityID, const std::str
sugar
::
sugar
(
const
branch
&
branch
,
const
std
::
string
&
compoundID
,
sugar
::
sugar
(
const
branch
&
branch
,
const
std
::
string
&
compoundID
,
const
std
::
string
&
asym_id
,
int
authSeqID
)
const
std
::
string
&
asym_id
,
int
authSeqID
)
:
residue
(
branch
.
get_structure
(),
compoundID
,
asym_id
,
0
,
std
::
to_string
(
authSeqID
)
)
:
residue
(
branch
.
get_structure
(),
compoundID
,
asym_id
,
0
,
asym_id
,
std
::
to_string
(
authSeqID
),
""
)
,
m_branch
(
&
branch
)
,
m_branch
(
&
branch
)
{
{
}
}
...
@@ -1318,10 +1318,10 @@ void structure::load_data()
...
@@ -1318,10 +1318,10 @@ void structure::load_data()
{
{
auto
&
polySeqScheme
=
m_db
[
"pdbx_poly_seq_scheme"
];
auto
&
polySeqScheme
=
m_db
[
"pdbx_poly_seq_scheme"
];
for
(
const
auto
&
[
asym_id
,
entityID
]
:
polySeqScheme
.
rows
<
std
::
string
,
std
::
string
>
(
"asym
_id"
,
"entity_id"
))
for
(
const
auto
&
[
asym_id
,
auth_asym_id
,
entityID
]
:
polySeqScheme
.
rows
<
std
::
string
,
std
::
string
,
std
::
string
>
(
"asym_id"
,
"pdb_strand
_id"
,
"entity_id"
))
{
{
if
(
m_polymers
.
empty
()
or
m_polymers
.
back
().
get_asym_id
()
!=
asym_id
or
m_polymers
.
back
().
get_entity_id
()
!=
entityID
)
if
(
m_polymers
.
empty
()
or
m_polymers
.
back
().
get_asym_id
()
!=
asym_id
or
m_polymers
.
back
().
get_entity_id
()
!=
entityID
)
m_polymers
.
emplace_back
(
*
this
,
entityID
,
asym_id
);
m_polymers
.
emplace_back
(
*
this
,
entityID
,
asym_id
,
auth_asym_id
);
}
}
auto
&
branchScheme
=
m_db
[
"pdbx_branch_scheme"
];
auto
&
branchScheme
=
m_db
[
"pdbx_branch_scheme"
];
...
@@ -1334,8 +1334,9 @@ void structure::load_data()
...
@@ -1334,8 +1334,9 @@ void structure::load_data()
auto
&
nonPolyScheme
=
m_db
[
"pdbx_nonpoly_scheme"
];
auto
&
nonPolyScheme
=
m_db
[
"pdbx_nonpoly_scheme"
];
for
(
const
auto
&
[
asym_id
,
monID
,
pdbSeqNum
]
:
nonPolyScheme
.
rows
<
std
::
string
,
std
::
string
,
std
::
string
>
(
"asym_id"
,
"mon_id"
,
"pdb_seq_num"
))
for
(
const
auto
&
[
asym_id
,
monID
,
pdbStrandID
,
pdbSeqNum
,
pdbInsCode
]
:
m_non_polymers
.
emplace_back
(
*
this
,
monID
,
asym_id
,
0
,
pdbSeqNum
);
nonPolyScheme
.
rows
<
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
>
(
"asym_id"
,
"mon_id"
,
"pdb_strand_id"
,
"pdb_seq_num"
,
"pdb_ins_code"
))
m_non_polymers
.
emplace_back
(
*
this
,
monID
,
asym_id
,
0
,
pdbStrandID
,
pdbSeqNum
,
pdbInsCode
);
// place atoms in residues
// place atoms in residues
...
@@ -2110,7 +2111,7 @@ std::string structure::create_non_poly(const std::string &entity_id, const std::
...
@@ -2110,7 +2111,7 @@ std::string structure::create_non_poly(const std::string &entity_id, const std::
auto
&
atom_site
=
m_db
[
"atom_site"
];
auto
&
atom_site
=
m_db
[
"atom_site"
];
auto
&
res
=
m_non_polymers
.
emplace_back
(
*
this
,
comp_id
,
asym_id
,
0
,
"1
"
);
auto
&
res
=
m_non_polymers
.
emplace_back
(
*
this
,
comp_id
,
asym_id
,
0
,
asym_id
,
"1"
,
"
"
);
for
(
auto
&
atom
:
atoms
)
for
(
auto
&
atom
:
atoms
)
{
{
...
@@ -2181,7 +2182,7 @@ std::string structure::create_non_poly(const std::string &entity_id, std::vector
...
@@ -2181,7 +2182,7 @@ std::string structure::create_non_poly(const std::string &entity_id, std::vector
auto
&
atom_site
=
m_db
[
"atom_site"
];
auto
&
atom_site
=
m_db
[
"atom_site"
];
auto
&
res
=
m_non_polymers
.
emplace_back
(
*
this
,
comp_id
,
asym_id
,
0
,
"1
"
);
auto
&
res
=
m_non_polymers
.
emplace_back
(
*
this
,
comp_id
,
asym_id
,
0
,
asym_id
,
"1"
,
"
"
);
for
(
auto
&
atom
:
atoms
)
for
(
auto
&
atom
:
atoms
)
{
{
...
...
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