mirror of https://github.com/CGAL/cgal
forgot to commit files
This commit is contained in:
parent
f6ddd6ae06
commit
f834735654
|
|
@ -23,7 +23,7 @@
|
|||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <limits>
|
||||
CGAL_PDB_BEGIN_NAMESPACE
|
||||
namespace CGAL { namespace PDB {
|
||||
|
||||
static double nan__=std::numeric_limits<double>::signaling_NaN();
|
||||
|
||||
|
|
@ -43,9 +43,9 @@ Atom::Type Atom::string_to_type(const char *cp) {
|
|||
else {
|
||||
std::ostringstream em;
|
||||
em << "Couldn't parse atom type of " << cp;
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_warning(em.str().c_str());
|
||||
internal::error_logger.new_warning(em.str().c_str());
|
||||
return INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
CGAL_PDB_END_NAMESPACE
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <sstream>
|
||||
#include <cstdio>
|
||||
|
||||
CGAL_PDB_BEGIN_NAMESPACE
|
||||
namespace CGAL { namespace PDB {
|
||||
//Residue dummy_residue;
|
||||
//Atom dummy_atom;
|
||||
|
||||
|
|
@ -52,11 +52,10 @@ int Chain::write(char chain, int start_index, std::ostream &out) const {
|
|||
// int anum=1;
|
||||
Monomer_key last_resindex;
|
||||
Monomer::Type last_type= Monomer::INV;
|
||||
for (Monomer_const_iterator it = monomers_begin(); it != monomers_end(); ++it) {
|
||||
const Monomer &res= it->monomer();
|
||||
CGAL_PDB_FOREACH(Monomer_pair r, monomers()) {
|
||||
//Residue::Label rl = res.label();
|
||||
//residues_[i]->atoms();
|
||||
start_index= res.write(chain, it->key().index(), ' ', start_index, out);
|
||||
start_index= r.monomer().write(chain, r.key().index(), ' ', start_index, out);
|
||||
|
||||
/*IR_Map::const_iterator irit= insert_residues_.find(it->key());
|
||||
if (irit!= insert_residues_.end()) {
|
||||
|
|
@ -68,8 +67,8 @@ int Chain::write(char chain, int start_index, std::ostream &out) const {
|
|||
ir->key().index(), start_index, out);
|
||||
}
|
||||
}*/
|
||||
last_resindex= it->key();
|
||||
last_type= it->data().type();
|
||||
last_resindex= r.key();
|
||||
last_type= r.data().type();
|
||||
}
|
||||
const char *terformat="TER %5d %3s %c %3d%c";
|
||||
if (!residues_.empty()) {
|
||||
|
|
@ -89,22 +88,6 @@ std::vector<Monomer::Type> Chain::sequence() const{
|
|||
return ret;
|
||||
}
|
||||
|
||||
unsigned int Chain::number_of_atoms() const {
|
||||
unsigned int ret=0;
|
||||
for (Container::const_iterator it= residues_.begin(); it != residues_.end(); ++it){
|
||||
ret += it->monomer().number_of_atoms();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
unsigned int Chain::number_of_bonds() const {
|
||||
unsigned int ret=0;
|
||||
for (Container::const_iterator it= residues_.begin(); it != residues_.end(); ++it){
|
||||
ret += it->monomer().number_of_bonds();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void Chain::swap_with(Chain &o) {
|
||||
std::swap(residues_, o.residues_);
|
||||
std::swap(header_, o.header_);
|
||||
|
|
@ -127,19 +110,19 @@ void Chain::set_has_bonds(bool tf) {
|
|||
}
|
||||
}
|
||||
|
||||
Chain::Monomer_iterator Chain::insert_internal(Monomer_key k, const Monomer &m) {
|
||||
Chain::Monomers::iterator Chain::insert_internal(Monomer_key k, const Monomer &m) {
|
||||
if (residues_.find(k) != residues_.end()){
|
||||
std::ostringstream eout;
|
||||
eout << "Warning, newly added residue has index "<< k
|
||||
<< " which already exists.";
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_warning(eout.str().c_str());
|
||||
internal::error_logger.new_warning(eout.str().c_str());
|
||||
}
|
||||
return residues_.insert(Container::value_type(k,m));
|
||||
}
|
||||
|
||||
bool Chain::has_bonds() const {
|
||||
for (Monomer_const_iterator it= monomers_begin();
|
||||
it != monomers_end(); ++it){
|
||||
for (Monomer_consts::iterator it= monomers().begin(); it != monomers().end();
|
||||
++it){
|
||||
if (!it->monomer().has_bonds()) return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -339,4 +322,4 @@ Residue& Chain::residue_containing_atom(Atom::Index atom_index) {
|
|||
}*/
|
||||
|
||||
|
||||
CGAL_PDB_END_NAMESPACE
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <CGAL/PDB/internal/Error_logger.h>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
CGAL_PDB_BEGIN_INTERNAL_NAMESPACE
|
||||
namespace CGAL { namespace PDB { namespace internal {
|
||||
|
||||
Error_logger error_logger;
|
||||
|
||||
|
|
@ -48,4 +48,4 @@ CGAL_PDB_BEGIN_INTERNAL_NAMESPACE
|
|||
}
|
||||
warnings_.clear();
|
||||
}
|
||||
CGAL_PDB_END_INTERNAL_NAMESPACE
|
||||
}}}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include <sstream>
|
||||
#include <cstdio>
|
||||
CGAL_PDB_BEGIN_NAMESPACE
|
||||
namespace CGAL { namespace PDB {
|
||||
|
||||
|
||||
void Heterogen::copy_from(const Heterogen &o) {
|
||||
|
|
@ -40,10 +40,10 @@ void Heterogen::copy_from(const Heterogen &o) {
|
|||
for (unsigned int i=0; i< o.bonds_.size(); ++i) {
|
||||
std::string nma=o.bonds_[i].first.key();
|
||||
std::string nmb=o.bonds_[i].second.key();
|
||||
Atom_const_iterator ita=find(nma);
|
||||
Atom_const_iterator itb=find(nmb);
|
||||
CGAL_assertion(ita != atoms_end());
|
||||
CGAL_assertion(itb != atoms_end());
|
||||
Atom_consts::iterator ita=find(nma);
|
||||
Atom_consts::iterator itb=find(nmb);
|
||||
CGAL_assertion(ita != atoms().end());
|
||||
CGAL_assertion(itb != atoms().end());
|
||||
// needed due to idiotic C++ syntax
|
||||
Bond_endpoint bea(ita);
|
||||
Bond_endpoint beb(itb);
|
||||
|
|
@ -55,9 +55,9 @@ void Heterogen::copy_from(const Heterogen &o) {
|
|||
|
||||
|
||||
bool Heterogen::connect(Atom::Index a, Atom::Index b) {
|
||||
Atom_iterator ita=atoms_end(), itb= atoms_end();
|
||||
Atoms::iterator ita=atoms().end(), itb= atoms().end();
|
||||
if (b < a) std::swap(a,b);
|
||||
for (Atom_iterator it= atoms_begin(); it != atoms_end(); ++it) {
|
||||
for (Atoms::iterator it= atoms().begin(); it != atoms().end(); ++it) {
|
||||
if (it->atom().index() == a) {
|
||||
ita= it;
|
||||
}
|
||||
|
|
@ -65,8 +65,8 @@ bool Heterogen::connect(Atom::Index a, Atom::Index b) {
|
|||
itb= it;
|
||||
}
|
||||
}
|
||||
if (ita == atoms_end()) return false;
|
||||
if (itb == atoms_end()) return false;
|
||||
if (ita == atoms().end()) return false;
|
||||
if (itb == atoms().end()) return false;
|
||||
for (unsigned int i=0; i< bonds_.size(); ++i) {
|
||||
if (bonds_[i].first.key() == ita->key()
|
||||
&& bonds_[i].second.key() == itb->key()){
|
||||
|
|
@ -94,16 +94,16 @@ void Heterogen::dump(std::ostream & /* out */ ) const {
|
|||
|
||||
int Heterogen::write(std::string name, int num,
|
||||
int start_index, std::ostream &out) const {
|
||||
for (Atoms::const_iterator it= atoms_.begin(); it != atoms_.end(); ++it) {
|
||||
Atom_key al= it->key();
|
||||
CGAL_PDB_FOREACH(const Atom_pair &aa, atoms()) {
|
||||
Atom_key al= aa.key();
|
||||
//Point pt= res->cartesian_coords(al);
|
||||
const Atom &a= it->atom();
|
||||
const Atom &a= aa.atom();
|
||||
a.set_index(Atom::Index(start_index));
|
||||
Point pt = a.point();
|
||||
//char chain=' ';
|
||||
|
||||
//"HETATM%5d %4s %3s %4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s%2s";
|
||||
out << boost::format(CGAL_PDB_INTERNAL_NS::hetatom_line_oformat_)
|
||||
out << boost::format(internal::hetatom_line_oformat_)
|
||||
% (start_index++) % al.c_str()
|
||||
% name.c_str() % num
|
||||
% pt.x() % pt.y() % pt.z() % a.occupancy() % a.temperature_factor()
|
||||
|
|
@ -138,4 +138,4 @@ Heterogen::Heterogen(std::string name): atoms_(20), type_(name){
|
|||
|
||||
|
||||
|
||||
CGAL_PDB_END_NAMESPACE
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
using std::sscanf;
|
||||
|
||||
CGAL_PDB_BEGIN_NAMESPACE
|
||||
namespace CGAL { namespace PDB {
|
||||
|
||||
/*static unsigned int getSequenceNumber (const char* line)
|
||||
{
|
||||
|
|
@ -66,7 +66,7 @@ void Model::process_hetatom(const char *line) {
|
|||
char element[3]={'\0','\0','\0'};
|
||||
char charge[3]={'\0','\0','\0'};
|
||||
// What field is missing?
|
||||
int numscan= sscanf(line, CGAL_PDB_INTERNAL_NS::hetatom_line_iformat_,
|
||||
int numscan= sscanf(line, internal::hetatom_line_iformat_,
|
||||
//"ATOM %5d%4s%1c%3s%1c%4d%1c%8f%8f%8f%6f%6f%4s%2s%2s",
|
||||
&snum, name, &alt, resname, &chain, &resnum, &insertion_residue_code,
|
||||
&x,&y,&z, &occupancy, &tempFactor, segID, element, charge);
|
||||
|
|
@ -101,7 +101,7 @@ void Model::add_hetatom(int numscan, int snum, char name[], char /* alt */,
|
|||
|
||||
std::string rname(resname);
|
||||
Heterogen_key hk(resname, resnum);
|
||||
if (heterogens_[hk].find(name) != heterogens_[hk].atoms_end()) {
|
||||
if (heterogens_[hk].contains(name)) {
|
||||
CGAL_LOG(Log::LOTS, "Duplicate atom in heterogen " << name << std::endl);
|
||||
} else {
|
||||
heterogens_[hk].insert(name, a);
|
||||
|
|
@ -126,7 +126,7 @@ void Model::process_atom(const char *line) {
|
|||
char segID[5]={'\0','\0','\0','\0','\0'};
|
||||
char element[3]={'\0','\0','\0'};
|
||||
char charge[3]={'\0','\0','\0'};
|
||||
int numscan= sscanf(line, CGAL_PDB_INTERNAL_NS::atom_line_iformat_,
|
||||
int numscan= sscanf(line, internal::atom_line_iformat_,
|
||||
//"ATOM %5d%4s%1c%3s%1c%4d%1c%8f%8f%8f%6f%6f%4s%2s%2s",
|
||||
&snum, name, &alt, resname, &chain, &resnum,
|
||||
&insertion_residue_code,
|
||||
|
|
@ -159,7 +159,7 @@ void Model::process_atom(const char *line) {
|
|||
if (resnum < 0) {
|
||||
std::ostringstream oss;
|
||||
oss << "Got negative residue index on line " << line;
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_warning(oss.str().c_str());
|
||||
internal::error_logger.new_warning(oss.str().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ void Model::process_atom(const char *line) {
|
|||
std::string nm(line, 17, 3);
|
||||
Monomer::Type rl= Monomer::type(resname);
|
||||
Monomer m(rl);
|
||||
Chain::Monomer_iterator mit= curchain.residues_.insert(Chain::Container::value_type(resindex, m));
|
||||
Chain::Monomers::iterator mit= curchain.residues_.insert(Chain::Container::value_type(resindex, m));
|
||||
cur_residue= &mit->monomer();
|
||||
CGAL_assertion(mit->key()== resindex);
|
||||
//residues_[resindex]=m;
|
||||
|
|
@ -227,15 +227,10 @@ void Model::process_atom(const char *line) {
|
|||
<< Monomer::type_string(cur_residue->type())
|
||||
<< " got " << Monomer::type_string(Monomer::type(resname))
|
||||
<< " on line:\n" << line << std::endl;
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_fatal_error(oss.str().c_str());
|
||||
internal::error_logger.new_fatal_error(oss.str().c_str());
|
||||
}
|
||||
//assert(cur_residue->type() == Residue::type(resname));
|
||||
Monomer::Atom_iterator rit= cur_residue->insert(al, a);
|
||||
if (rit == cur_residue->atoms_end()) {
|
||||
std::ostringstream oss;
|
||||
oss << "Error adding atom to residue " << resindex << std::endl;
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_warning(oss.str().c_str());
|
||||
}
|
||||
cur_residue->insert(al, a);
|
||||
|
||||
//residue(resnum-1)->set_coords (al, Point(x,y,z));
|
||||
//residue(resnum-1)->set_index(al, snum);
|
||||
|
|
@ -249,16 +244,16 @@ void Model::process_atom(const char *line) {
|
|||
}
|
||||
|
||||
void Model::process_line(const char *line) {
|
||||
CGAL_PDB_INTERNAL_NS::Line_type lt= CGAL_PDB_INTERNAL_NS::line_type(line);
|
||||
if (lt== CGAL_PDB_INTERNAL_NS::ATOM) {
|
||||
internal::Line_type lt= internal::line_type(line);
|
||||
if (lt== internal::ATOM) {
|
||||
process_atom(line);
|
||||
} else if (lt == CGAL_PDB_INTERNAL_NS::TER) {
|
||||
} else if (lt == internal::TER) {
|
||||
//CGAL_assertion(!chains_.empty());
|
||||
//chains_.back().process_line(line);
|
||||
} else if (lt== CGAL_PDB_INTERNAL_NS::HETATM){
|
||||
} else if (lt== internal::HETATM){
|
||||
process_hetatom(line);
|
||||
|
||||
} else if (lt== CGAL_PDB_INTERNAL_NS::ENDMDL){
|
||||
} else if (lt== internal::ENDMDL){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -267,18 +262,17 @@ void Model::write(int model_index, std::ostream &out) const {
|
|||
|
||||
out << boost::format("MODEL %8d ") % model_index << std::endl;
|
||||
int index=1;
|
||||
for (Chain_const_iterator it= chains_.begin(); it != chains_.end(); ++it){
|
||||
index= it->chain().write(it->key().index(), index, out);
|
||||
CGAL_PDB_FOREACH(const Chain_pair& c, chains()) {
|
||||
index= c.chain().write(c.key().index(), index, out);
|
||||
}
|
||||
for (unsigned int i=0; i< extra_.size(); ++i){
|
||||
out << extra_[i] << std::endl;
|
||||
}
|
||||
for (Heterogen_const_iterator it= heterogens_begin(); it != heterogens_end();
|
||||
++it){
|
||||
index= it->heterogen().write(it->key().name(), it->key().number(),
|
||||
CGAL_PDB_FOREACH(const Heterogen_pair& h, heterogens()) {
|
||||
index= h.heterogen().write(h.key().name(), h.key().number(),
|
||||
index, out);
|
||||
}
|
||||
out << "ENDMDL " << std::endl;
|
||||
}
|
||||
|
||||
CGAL_PDB_END_NAMESPACE
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
using std::sscanf;
|
||||
|
||||
CGAL_PDB_BEGIN_NAMESPACE
|
||||
namespace CGAL { namespace PDB {
|
||||
|
||||
void Monomer::set_has_bonds(bool tf) {
|
||||
typedef Monomer_data::Possible_bond Possible_bond;
|
||||
|
|
@ -42,8 +42,8 @@ void Monomer::set_has_bonds(bool tf) {
|
|||
} else {
|
||||
const std::vector<Possible_bond >& bonds= Monomer_data::amino_acid_data_[type()].bonds;
|
||||
for (unsigned int i=0; i< bonds.size(); ++i){
|
||||
Atom_const_iterator itf= find(bonds[i].first);
|
||||
Atom_const_iterator its= find(bonds[i].second);
|
||||
Atoms::iterator itf= find(bonds[i].first);
|
||||
Atoms::iterator its= find(bonds[i].second);
|
||||
if ( itf != atoms_.end() && its != atoms_.end()){
|
||||
bonds_.push_back(Bond(Bond_endpoint(itf),
|
||||
Bond_endpoint(its)));
|
||||
|
|
@ -99,29 +99,29 @@ void Monomer::erase_atom(Monomer::Atom_key al) {
|
|||
|
||||
|
||||
|
||||
Monomer::Atom_iterator Monomer::insert_internal(Atom_key ial, const Atom &a) {
|
||||
Monomer::Atoms::iterator Monomer::insert_internal(Atom_key ial, const Atom &a) {
|
||||
Monomer::Atom_key al= Monomer_data::fix_atom_label(label_, ial);
|
||||
if (!can_have_atom(al)){
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_warning((std::string("Trying to set invalid atom ")
|
||||
internal::error_logger.new_warning((std::string("Trying to set invalid atom ")
|
||||
+ atom_key_string(ial)
|
||||
+ " on a residue of type "
|
||||
+ type_string(label_)).c_str());
|
||||
return atoms_end();
|
||||
return atoms().end();
|
||||
}
|
||||
if (al == AL_INVALID) {
|
||||
return atoms_end();
|
||||
return atoms().end();
|
||||
}
|
||||
if (atoms_.find(al) != atoms_.end()) {
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_warning((std::string("Duplicate atoms ")
|
||||
internal::error_logger.new_warning((std::string("Duplicate atoms ")
|
||||
+ atom_key_string(ial)
|
||||
+ " on a residue of type "
|
||||
+ type_string(label_)).c_str());
|
||||
return atoms_end();
|
||||
return atoms().end();
|
||||
}
|
||||
//assert(atoms_.find(al)== atoms_.end());
|
||||
//bonds_.clear();
|
||||
|
||||
Atom_iterator ret= atoms_.insert(Atoms::value_type(al,a));
|
||||
Atoms::iterator ret= atoms_.insert(Atoms::value_type(al,a));
|
||||
// This is a bit evil, I haven't figured out a better way though.
|
||||
ret->atom().set_type(element(al));
|
||||
if (has_bonds()){
|
||||
|
|
@ -150,7 +150,7 @@ void Monomer::dump(std::ostream &out) const {
|
|||
for (unsigned int i=0; i< valid_atoms.size(); ++i){
|
||||
Monomer::Atom_key al= valid_atoms[i];
|
||||
out << Monomer::atom_key_string(al); //Monomer::write_atom_label(al, out);
|
||||
if (find(al) != atoms_end()){
|
||||
if (contains(al)){
|
||||
out << " (" << find(al)->atom().point().x() << ", "
|
||||
<< find(al)->atom().point().y() << ", "
|
||||
<< find(al)->atom().point().z() << ") " << std::endl;
|
||||
|
|
@ -163,15 +163,14 @@ void Monomer::dump(std::ostream &out) const {
|
|||
int Monomer::write(char chain, int monomer_index,
|
||||
char insertion_residue_code, int start_index, std::ostream &out) const {
|
||||
|
||||
|
||||
for (Atoms::const_iterator it= atoms_.begin(); it != atoms_.end(); ++it) {
|
||||
Atom_key al= it->key();
|
||||
CGAL_PDB_FOREACH(const Atom_pair &aa, atoms()) {
|
||||
Atom_key al= aa.key();
|
||||
//Point pt= res->cartesian_coords(al);
|
||||
const Atom &a= it->atom();
|
||||
const Atom &a= aa.atom();
|
||||
Point pt = a.point();
|
||||
char alt=' ';
|
||||
//char chain=' ';
|
||||
out << boost::format(CGAL_PDB_INTERNAL_NS::atom_line_oformat_)
|
||||
out << boost::format(internal::atom_line_oformat_)
|
||||
% (start_index++) % Monomer::atom_key_string(al).c_str() % alt
|
||||
% Monomer::type_string(type()).c_str() % chain % monomer_index % insertion_residue_code
|
||||
% pt.x() % pt.y() % pt.z() % a.occupancy() % a.temperature_factor() % a.segment_id().c_str()
|
||||
|
|
@ -231,7 +230,7 @@ Monomer::Atom_key Monomer::atom_key(const char *nm) {
|
|||
return Monomer_data::clean_atom_name_data_[i].l;
|
||||
}
|
||||
}
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_warning(std::string(s + " is not a known atom type.").c_str());;
|
||||
internal::error_logger.new_warning(std::string(s + " is not a known atom type.").c_str());;
|
||||
return Monomer::AL_OTHER;
|
||||
}
|
||||
|
||||
|
|
@ -246,7 +245,7 @@ Atom::Type Monomer::element(Atom_key al){
|
|||
return Monomer_data::atom_name_data_[i].t;
|
||||
}
|
||||
}
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_internal_error("Unknown element label ");
|
||||
internal::error_logger.new_internal_error("Unknown element label ");
|
||||
return Atom::INVALID;
|
||||
}
|
||||
|
||||
|
|
@ -264,7 +263,7 @@ std::string Monomer::atom_key_string(Atom_key al) {
|
|||
|
||||
std::ostringstream oss;
|
||||
oss << "Unknown atom label: " << al << " returning UNKN";
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.new_warning(oss.str().c_str());
|
||||
internal::error_logger.new_warning(oss.str().c_str());
|
||||
|
||||
return "UNKN";
|
||||
}
|
||||
|
|
@ -354,4 +353,4 @@ std::string Monomer::type_string(Monomer::Type rl){
|
|||
}
|
||||
|
||||
}
|
||||
CGAL_PDB_END_NAMESPACE
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <CGAL/PDB/internal/Monomer_data.h>
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
CGAL_PDB_BEGIN_NAMESPACE
|
||||
namespace CGAL { namespace PDB {
|
||||
|
||||
namespace Monomer_data {
|
||||
bool amino_acid_initialized_=false;
|
||||
|
|
@ -890,4 +890,4 @@ namespace Monomer_data {
|
|||
|
||||
}
|
||||
|
||||
CGAL_PDB_END_NAMESPACE
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <cctype>
|
||||
#include <cstdio>
|
||||
|
||||
CGAL_PDB_BEGIN_NAMESPACE
|
||||
namespace CGAL { namespace PDB {
|
||||
|
||||
PDB::PDB(std::istream &in, bool print_errors) {
|
||||
load(in, print_errors);
|
||||
|
|
@ -36,7 +36,7 @@ PDB::~PDB(){}
|
|||
void PDB::load(std::istream &in, bool print_errors){
|
||||
char line[600];
|
||||
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.set_is_output(print_errors);
|
||||
internal::error_logger.set_is_output(print_errors);
|
||||
std::map<char, std::string> names;
|
||||
std::string last_name;
|
||||
Model_key cur_model(1);
|
||||
|
|
@ -44,10 +44,10 @@ void PDB::load(std::istream &in, bool print_errors){
|
|||
char dummy_char;
|
||||
while (in.getline (line, 600)) {
|
||||
|
||||
CGAL_PDB_INTERNAL_NS::Line_type lt= CGAL_PDB_INTERNAL_NS::line_type(line);
|
||||
if (lt== CGAL_PDB_INTERNAL_NS::HEADER) {
|
||||
internal::Line_type lt= internal::line_type(line);
|
||||
if (lt== internal::HEADER) {
|
||||
header_.push_back(std::string(line));
|
||||
} if (lt == CGAL_PDB_INTERNAL_NS::CONECT) {
|
||||
} if (lt == internal::CONECT) {
|
||||
// do something
|
||||
std::istringstream iss(line+6);
|
||||
int base;
|
||||
|
|
@ -66,7 +66,7 @@ void PDB::load(std::istream &in, bool print_errors){
|
|||
connections_.push_back(std::make_pair(base, o));
|
||||
}
|
||||
} while (true);
|
||||
} else if (lt == CGAL_PDB_INTERNAL_NS::COMPND) {
|
||||
} else if (lt == internal::COMPND) {
|
||||
header_.push_back(std::string(line));
|
||||
int ti;
|
||||
char dummychain;
|
||||
|
|
@ -103,47 +103,47 @@ void PDB::load(std::istream &in, bool print_errors){
|
|||
}
|
||||
last_name= std::string(line+offset);
|
||||
}
|
||||
} else if (lt== CGAL_PDB_INTERNAL_NS::DBREF){
|
||||
} else if (lt== internal::DBREF){
|
||||
header_.push_back(std::string(line));
|
||||
} else if (lt== CGAL_PDB_INTERNAL_NS::SEQRES){
|
||||
} else if (lt== internal::SEQRES){
|
||||
header_.push_back(std::string(line));
|
||||
} else if (lt== CGAL_PDB_INTERNAL_NS::MODEL) {
|
||||
} else if (lt== internal::MODEL) {
|
||||
int mnum=0;
|
||||
char buf[81];
|
||||
std::sscanf(line, "%s %d", buf, &mnum);
|
||||
//new_model(Model_key(mnum), Model());
|
||||
cur_model= Model_key(mnum);
|
||||
done_with_model=false;
|
||||
} else if ( lt== CGAL_PDB_INTERNAL_NS::HETATM
|
||||
|| lt== CGAL_PDB_INTERNAL_NS::ATOM ) {
|
||||
} else if ( lt== internal::HETATM
|
||||
|| lt== internal::ATOM ) {
|
||||
if (done_with_model) {
|
||||
// charlie carter hack
|
||||
cur_model= Model_key(cur_model.index()+1);
|
||||
done_with_model=false;
|
||||
}
|
||||
models_[cur_model].process_line(line);
|
||||
} else if (lt== CGAL_PDB_INTERNAL_NS::TER){
|
||||
} else if (lt== internal::TER){
|
||||
models_[cur_model].process_line(line);
|
||||
} else if (lt== CGAL_PDB_INTERNAL_NS::ENDMDL){
|
||||
} else if (lt== internal::ENDMDL){
|
||||
done_with_model=true;
|
||||
models_[cur_model].process_line(line);
|
||||
} else if (lt== CGAL_PDB_INTERNAL_NS::MASTER){
|
||||
} else if (lt == CGAL_PDB_INTERNAL_NS::END){
|
||||
} else if (lt== internal::MASTER){
|
||||
} else if (lt == internal::END){
|
||||
}
|
||||
}
|
||||
|
||||
for (Model_iterator it= models_begin(); it != models_end(); ++it){
|
||||
for (Model::Chain_iterator cit = it->model().chains_begin(); cit != it->model().chains_end(); ++cit){
|
||||
cit->chain().set_has_bonds(true);
|
||||
if (names.find(cit->key().index()) != names.end()) {
|
||||
cit->chain().set_name(names[cit->key().index()]);
|
||||
CGAL_PDB_FOREACH(Model_pair &m, models()) {
|
||||
CGAL_PDB_FOREACH(Model::Chain_pair &c, m.model().chains()) {
|
||||
c.chain().set_has_bonds(true);
|
||||
if (names.find(c.key().index()) != names.end()) {
|
||||
c.chain().set_name(names[c.key().index()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build_heterogens();
|
||||
|
||||
CGAL_PDB_INTERNAL_NS::error_logger.dump();
|
||||
internal::error_logger.dump();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -160,12 +160,10 @@ void PDB::build_heterogens() {
|
|||
for (unsigned int i=0; i< connections_.size(); ++i) {
|
||||
int a= connections_[i].first;
|
||||
int b= connections_[i].second;
|
||||
for (Model_iterator it= models_begin(); it != models_end(); ++it) {
|
||||
CGAL_PDB_FOREACH(Model_pair &m, models()) {
|
||||
bool found=false;
|
||||
for (Model::Heterogen_iterator hit
|
||||
= it->model().heterogens_begin();
|
||||
hit != it->model().heterogens_end(); ++hit) {
|
||||
if (hit->heterogen().connect(Atom::Index(a), Atom::Index(b))) {
|
||||
CGAL_PDB_FOREACH(Model::Heterogen_pair &h, m.model().heterogens()) {
|
||||
if (h.heterogen().connect(Atom::Index(a), Atom::Index(b))) {
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -183,8 +181,8 @@ std::ostream& PDB::write(std::ostream &out) const {
|
|||
for (unsigned int i=0; i< header_.size(); ++i){
|
||||
out << header_[i] << std::endl;
|
||||
}
|
||||
for (Model_const_iterator it = models_begin(); it != models_end(); ++it){
|
||||
it->model().write(it->key().index(), out);
|
||||
CGAL_PDB_FOREACH(const Model_pair &m, models()) {
|
||||
m.model().write(m.key().index(), out);
|
||||
}
|
||||
out << "END \n";
|
||||
return out;
|
||||
|
|
@ -198,4 +196,4 @@ PDB::Model_key PDB::push_back(const Model &m) {
|
|||
return k;
|
||||
}
|
||||
|
||||
CGAL_PDB_END_NAMESPACE
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include <CGAL/PDB/Quaternion.h>
|
||||
#include <CGAL/PDB/Transform.h>
|
||||
CGAL_PDB_BEGIN_NAMESPACE
|
||||
namespace CGAL { namespace PDB {
|
||||
|
||||
/*Quaternion::Quaternion(const double m[3][3]){
|
||||
|
||||
|
|
@ -105,4 +105,4 @@ Transform Quaternion::transform(Vector translation) const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
CGAL_PDB_END_NAMESPACE
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ MA 02110-1301, USA. */
|
|||
#include <iostream>
|
||||
#include <set>
|
||||
#include <CGAL/PDB/internal/Error_logger.h>
|
||||
CGAL_PDB_BEGIN_INTERNAL_NAMESPACE
|
||||
namespace CGAL { namespace PDB { namespace internal {
|
||||
|
||||
//ATOM 812 OG ASER 106 -.072 22.447 10.384 .50 11.73 1ECD 918
|
||||
//ATOM 60 O SER L 9 -26.231 10.210 -4.537 1.00 26.25 7FAB 160
|
||||
|
|
@ -68,4 +68,4 @@ CGAL_PDB_BEGIN_INTERNAL_NAMESPACE
|
|||
return OTHER;
|
||||
}
|
||||
}
|
||||
CGAL_PDB_END_INTERNAL_NAMESPACE
|
||||
}}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue