Skip to content
Snippets Groups Projects
Commit b77f2ec0 authored by Valerio Mariani's avatar Valerio Mariani
Browse files

Added feasibility check unitests for profiles, refactored some stuff

parent c610c42c
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ void export_Builder() { ...@@ -36,7 +36,7 @@ void export_Builder() {
.add_property("dialect", &Builder::GetDialect, &Builder::SetDialect) .add_property("dialect", &Builder::GetDialect, &Builder::SetDialect)
.add_property("strict_hydrogens", &Builder::GetStrictHydrogenMode, .add_property("strict_hydrogens", &Builder::GetStrictHydrogenMode,
&Builder::SetStrictHydrogenMode) &Builder::SetStrictHydrogenMode)
.add_property("feasibility_check", &Builder::GetBondFeasibilityCheck, .add_property("bond_feasibility_check", &Builder::GetBondFeasibilityCheck,
&Builder::SetBondFeasibilityCheck) &Builder::SetBondFeasibilityCheck)
.def("GetDialect", &Builder::GetDialect) .def("GetDialect", &Builder::GetDialect)
.def("SetDialect", &Builder::SetDialect) .def("SetDialect", &Builder::SetDialect)
......
...@@ -86,7 +86,7 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=None, ...@@ -86,7 +86,7 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=None,
fault_tolerant=None, load_multi=False, quack_mode=None, fault_tolerant=None, load_multi=False, quack_mode=None,
join_spread_atom_records=None, calpha_only=None, join_spread_atom_records=None, calpha_only=None,
profile='DEFAULT', remote=False, dialect=None, profile='DEFAULT', remote=False, dialect=None,
strict_hydrogens=None, seqres=False, bond_feasibility=None): strict_hydrogens=None, seqres=False, bond_feasibility_check=None):
""" """
Load PDB file from disk and return one or more entities. Several options Load PDB file from disk and return one or more entities. Several options
allow to customize the exact behaviour of the PDB import. For more information allow to customize the exact behaviour of the PDB import. For more information
...@@ -147,7 +147,7 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=None, ...@@ -147,7 +147,7 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=None,
prof.quack_mode=_override(prof.quack_mode, quack_mode) prof.quack_mode=_override(prof.quack_mode, quack_mode)
prof.strict_hydrogens=_override(prof.strict_hydrogens, strict_hydrogens) prof.strict_hydrogens=_override(prof.strict_hydrogens, strict_hydrogens)
prof.fault_tolerant=_override(prof.fault_tolerant, fault_tolerant) prof.fault_tolerant=_override(prof.fault_tolerant, fault_tolerant)
prof.bond_feasibility=_override(prof.bond_feasibility, bond_feasibility) prof.bond_feasibility_check=_override(prof.bond_feasibility_check, bond_feasibility_check)
prof.join_spread_atom_records=_override(prof.join_spread_atom_records, prof.join_spread_atom_records=_override(prof.join_spread_atom_records,
join_spread_atom_records) join_spread_atom_records)
...@@ -165,7 +165,7 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=None, ...@@ -165,7 +165,7 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=None,
elif prof.dialect=='CHARMM': elif prof.dialect=='CHARMM':
builder.dialect=conop.CHARMM_DIALECT builder.dialect=conop.CHARMM_DIALECT
builder.strict_hydrogens=prof.strict_hydrogens builder.strict_hydrogens=prof.strict_hydrogens
builder.bond_feasibility=prof.bond_feasibility builder.bond_feasibility_check=prof.bond_feasibility_check
reader=PDBReader(filename, prof) reader=PDBReader(filename, prof)
reader.read_seqres=seqres reader.read_seqres=seqres
try: try:
......
...@@ -43,7 +43,7 @@ void export_pdb_io() ...@@ -43,7 +43,7 @@ void export_pdb_io()
arg("join_spread_atom_records")=false, arg("join_spread_atom_records")=false,
arg("no_hetatms")=false, arg("no_hetatms")=false,
arg("calpha_only")=false, arg("calpha_only")=false,
arg("bond_feasibility")=true))) arg("bond_feasibility_check")=true)))
.def_readwrite("dialect", &IOProfile::dialect) .def_readwrite("dialect", &IOProfile::dialect)
.def_readwrite("fault_tolerant", &IOProfile::fault_tolerant) .def_readwrite("fault_tolerant", &IOProfile::fault_tolerant)
.def_readwrite("quack_mode", &IOProfile::quack_mode) .def_readwrite("quack_mode", &IOProfile::quack_mode)
...@@ -51,7 +51,7 @@ void export_pdb_io() ...@@ -51,7 +51,7 @@ void export_pdb_io()
.def_readwrite("no_hetatms", &IOProfile::no_hetatms) .def_readwrite("no_hetatms", &IOProfile::no_hetatms)
.def_readwrite("calpha_only", &IOProfile::calpha_only) .def_readwrite("calpha_only", &IOProfile::calpha_only)
.def_readwrite("join_spread_atom_records", &IOProfile::join_spread_atom_records) .def_readwrite("join_spread_atom_records", &IOProfile::join_spread_atom_records)
.def_readwrite("bond_feasibility", &IOProfile::bond_feasibilty) .def_readwrite("bond_feasibility_check", &IOProfile::bond_feasibility_check)
.def("Copy", &IOProfile::Copy) .def("Copy", &IOProfile::Copy)
.def(self_ns::str(self)) .def(self_ns::str(self))
; ;
......
...@@ -29,11 +29,11 @@ struct DLLEXPORT IOProfile { ...@@ -29,11 +29,11 @@ struct DLLEXPORT IOProfile {
public: public:
IOProfile(String d, bool sh, bool qm, bool ft, bool js, bool nh, bool co, bool bf): IOProfile(String d, bool sh, bool qm, bool ft, bool js, bool nh, bool co, bool bf):
dialect(d), strict_hydrogens(sh), quack_mode(qm), fault_tolerant(ft), dialect(d), strict_hydrogens(sh), quack_mode(qm), fault_tolerant(ft),
join_spread_atom_records(js), no_hetatms(nh), calpha_only(co), bond_feasibilty(bf) join_spread_atom_records(js), no_hetatms(nh), calpha_only(co), bond_feasibility_check(bf)
{ } { }
IOProfile(): dialect("PDB"), strict_hydrogens(true), quack_mode(false), IOProfile(): dialect("PDB"), strict_hydrogens(true), quack_mode(false),
fault_tolerant(false), join_spread_atom_records(false), no_hetatms(false), fault_tolerant(false), join_spread_atom_records(false), no_hetatms(false),
calpha_only(false), bond_feasibilty(true) calpha_only(false), bond_feasibility_check(true)
{ } { }
virtual ~IOProfile() { } virtual ~IOProfile() { }
...@@ -44,12 +44,12 @@ public: ...@@ -44,12 +44,12 @@ public:
bool join_spread_atom_records; bool join_spread_atom_records;
bool no_hetatms; bool no_hetatms;
bool calpha_only; bool calpha_only;
bool bond_feasibilty; bool bond_feasibility_check;
IOProfile Copy() IOProfile Copy()
{ {
return IOProfile(dialect, strict_hydrogens, quack_mode, fault_tolerant, return IOProfile(dialect, strict_hydrogens, quack_mode, fault_tolerant,
join_spread_atom_records, no_hetatms, calpha_only, bond_feasibilty); join_spread_atom_records, no_hetatms, calpha_only, bond_feasibility_check);
} }
virtual void PostImport(mol::EntityHandle ent) { } virtual void PostImport(mol::EntityHandle ent) { }
}; };
...@@ -62,8 +62,8 @@ inline std::ostream& operator<<(std::ostream& stream, const IOProfile& p) ...@@ -62,8 +62,8 @@ inline std::ostream& operator<<(std::ostream& stream, const IOProfile& p)
<< (p.join_spread_atom_records ? "True" : "False") << ", no_hetatms=" << (p.join_spread_atom_records ? "True" : "False") << ", no_hetatms="
<< (p.no_hetatms ? "True" : "False") << ", calpha_only=" << (p.no_hetatms ? "True" : "False") << ", calpha_only="
<< (p.calpha_only ? "True" : "False") << ", fault_tolerant=" << (p.calpha_only ? "True" : "False") << ", fault_tolerant="
<< (p.fault_tolerant ? "True" : "False") << ", bond_feasibilty=" << (p.fault_tolerant ? "True" : "False") << ", bond_feasibility_check="
<< (p.bond_feasibilty ? "True" : "False") << ")"; << (p.bond_feasibility_check ? "True" : "False") << ")";
return stream; return stream;
} }
......
...@@ -11,7 +11,22 @@ class TestPDB(unittest.TestCase): ...@@ -11,7 +11,22 @@ class TestPDB(unittest.TestCase):
ch = e.FindChain("A"); ch = e.FindChain("A");
self.assertEquals(ch.GetIntProp("mol_id"), 1) self.assertEquals(ch.GetIntProp("mol_id"), 1)
class TestPDB(unittest.TestCase):
def setUp(self):
pass
def test_compnd_parser(self):
profiles=io.IOProfiles()
profiles['NO_FEAS_CHECK']=io.IOProfile(bond_feasibility_check=False)
e=io.LoadPDB('testfiles/pdb/simple_defective.pdb', restrict_chains="A",profile='NO_FEAS_CHECK')
res=e.FindResidue('A',3)
self.assertTrue(mol.BondExists(res.FindAtom("CA"),res.FindAtom("CB")))
if __name__== '__main__': if __name__== '__main__':
unittest.main() unittest.main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment