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

Wrote ResidueNameToOneLetterCode and exported this and other utility functions in qa

parent ec509098
Branches
Tags
No related merge requests found
......@@ -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
)
......
//------------------------------------------------------------------------------
// 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
......@@ -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();
}
//------------------------------------------------------------------------------
// 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);
......
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment