diff --git a/modules/qa/pymod/CMakeLists.txt b/modules/qa/pymod/CMakeLists.txt index a63e9c2d9bc05f8a671c8bb172aac63cf7c8ccd5..c9681924294521ffbe8119f585f24bb9e7a3f120 100644 --- a/modules/qa/pymod/CMakeLists.txt +++ b/modules/qa/pymod/CMakeLists.txt @@ -3,6 +3,7 @@ set(OST_QA_PYMOD_SOURCES export_torsion.cc export_packing.cc export_reduced.cc + export_utilities.cc wrap_qa.cc export_clash.cc ) diff --git a/modules/qa/pymod/export_utilities.cc b/modules/qa/pymod/export_utilities.cc new file mode 100644 index 0000000000000000000000000000000000000000..31a6f2ab8d5bd954b75c9f2829a8753b2840fbc5 --- /dev/null +++ b/modules/qa/pymod/export_utilities.cc @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// This file is part of the OpenStructure project <www.openstructure.org> +// +// Copyright (C) 2008-2011 by the OpenStructure authors +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License as published by the Free +// Software Foundation; either version 3.0 of the License, or (at your option) +// any later version. +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +// details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this library; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +//------------------------------------------------------------------------------ +#include <boost/python.hpp> +#include <ost/qa/amino_acids.hh> +using namespace boost::python; +using namespace ost::qa; + + +void export_Utilties() +{ + + def ("ResidueToAminoAcid",&ResidueToAminoAcid); + def ("AminoAcidToResidueName",&AminoAcidToResidueName); + def ("OneLetterCodeToResidueName",&OneLetterCodeToResidueName); + def ("ResidueNameToOneLetterCode",&ResidueNameToOneLetterCode); + def ("OneLetterCodeToAminoAcid",&OneLetterCodeToAminoAcid); + +} \ No newline at end of file diff --git a/modules/qa/pymod/wrap_qa.cc b/modules/qa/pymod/wrap_qa.cc index 6c4e6fcacdd978542be34a4e6782ee963131d9f5..14c66d90e3b2ebce817671682f49dc93bea624b0 100644 --- a/modules/qa/pymod/wrap_qa.cc +++ b/modules/qa/pymod/wrap_qa.cc @@ -18,11 +18,13 @@ //------------------------------------------------------------------------------ #include <boost/python.hpp> + void export_Torsion(); void export_Interaction(); void export_Packing(); void export_Clash(); void export_Reduced(); +void export_Utilties(); BOOST_PYTHON_MODULE(_qa) { export_Torsion(); @@ -30,4 +32,5 @@ BOOST_PYTHON_MODULE(_qa) export_Packing(); export_Clash(); export_Reduced(); + export_Utilties(); } diff --git a/modules/qa/src/amino_acids.cc b/modules/qa/src/amino_acids.cc index 1dfefe0c5b3800c6afe62330ea5a75dc9725c6dd..5e5768634d3f312676c4af4adbf6f89032131fa8 100644 --- a/modules/qa/src/amino_acids.cc +++ b/modules/qa/src/amino_acids.cc @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // This file is part of the OpenStructure project <www.openstructure.org> // -// Copyright (C) 2008-2011 by the OpenStructure authors +// Copyright (C) 2008-2010 by the OpenStructure authors // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License as published by the Free @@ -174,6 +174,73 @@ String OneLetterCodeToResidueName(char olc) } } +char ResidueNameToOneLetterCode(String rn) +{ + String upper_rn=rn; + std::transform(rn.begin(),rn.end(),rn.begin(),toupper); + if (upper_rn == "ALA") { + return 'A'; + } + if (upper_rn == "ARG") { + return 'R'; + } + if (upper_rn == "ASN") { + return 'N'; + } + if (upper_rn == "ASP") { + return 'D'; + } + if (upper_rn == "GLN") { + return 'Q'; + } + if (upper_rn == "GLU") { + return 'E'; + } + if (upper_rn == "LYS") { + return 'K'; + } + if (upper_rn == "SER") { + return 'S'; + } + if (upper_rn == "CYS") { + return 'C'; + } + if (upper_rn == "TYR") { + return 'Y'; + } + if (upper_rn == "TRP") { + return 'W'; + } + if (upper_rn == "THR") { + return 'T'; + } + if (upper_rn == "VAL") { + return 'V'; + } + if (upper_rn == "ILE") { + return 'I'; + } + if (upper_rn == "MET") { + return 'M'; + } + if (upper_rn == "LEU") { + return 'L'; + } + if (upper_rn == "GLY") { + return 'G'; + } + if (upper_rn == "PRO") { + return 'P'; + } + if (upper_rn == "HIS") { + return 'H'; + } + if (upper_rn == "PHE") { + return 'F'; + } + return 'X'; +} + AminoAcid OneLetterCodeToAminoAcid(char olc) { char upper_olc=toupper(olc); diff --git a/modules/qa/src/amino_acids.hh b/modules/qa/src/amino_acids.hh index 309726fe6f17674fb570bf18d376c452e32f2edd..03521fa40eb3fcd3c9fa3770d0b73693f39cc2ba 100644 --- a/modules/qa/src/amino_acids.hh +++ b/modules/qa/src/amino_acids.hh @@ -54,6 +54,8 @@ DLLEXPORT_OST_QA String OneLetterCodeToResidueName(char olc); DLLEXPORT_OST_QA AminoAcid OneLetterCodeToAminoAcid(char olc); +char DLLEXPORT_OST_QA ResidueNameToOneLetterCode(String rn); + class AminoAcidSetIterator : public std::iterator<std::forward_iterator_tag, AminoAcid> { public: