Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RNA_AtomVDW.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file core/scoring/methods/AtomVDW.hh
11 /// @brief
12 /// @author Rhiju Das
13 
14 
15 // Unit Headers
17 
18 // Package headers
19 
20 // Project headers
22 #include <core/chemical/AA.hh>
24 
25 #include <basic/database/open.hh>
26 
27 // Utility headers
28 #include <utility/io/izstream.hh>
29 
31 #include <utility/vector1.hh>
32 #include <basic/Tracer.hh>
33 
34 
35 static basic::Tracer tr("core.scoring.rna.RNA_AtomVDW");
36 
37 namespace core {
38 namespace scoring {
39 namespace rna {
40 
41 Size
43 {
44  if ( c == 'a') return 1;
45  if ( c == 'c') return 2;
46  if ( c == 'g') return 3;
47  if ( c == 'u') return 4;
48  if ( c == 'Z') return 5; // Mg(2+)
49  tr << "What is this? " << c << std::endl;
50  utility_exit_with_message( "Asked for rna_residue_name_to_num for unknown residue_name" );
51  return 0;
52 }
53 
54 //Why doesn't this helper function already exist in vector class?
55 Size
57 {
58  Size count( 1 );
59  for ( utility::vector1<std::string>::iterator iter = vec.begin(); iter < vec.end(); iter++ ) {
60  if (*iter == element) return count;
61  count++;
62  }
63  vec.push_back( element );
64  return count;
65 }
66 
67 
68 /// @details ctor, reads data file. Need to configure to allow alternate tables/atom_sets
70 {
71  //Read in data file, and fill in private data.
72  utility::io::izstream stream;
73  basic::database::open( stream, "chemical/rna/rna_atom_vdw.txt" );
74 
75  rna_vdw_parameter_.dimension( 9, 9, 5, 5 ); // 5 = a,c,g,u,Z (Mg2+)
76  rna_vdw_parameter_ = 0.0; // zero everything out.
77 
78  if ( !stream.good() ) utility_exit_with_message( "Unable to open rna_scoring/AtomVDW/atom_vdw.txt!" );
79 
80  // read the entire file and figure out what atom_types are present and in what order
82 
83  std::string line;
84  std::string atom_name1, atom_name2;
85  char which_residue1, which_residue2;
86  Real input_bump_parameter;
87  while ( getline( stream, line ) ) {
88  lines.push_back(line);
89  std::istringstream l(line);
90  l >> which_residue1 >> which_residue2 >> atom_name1 >> atom_name2 >> input_bump_parameter;
91 
92  Size const pos1 = get_position_in_vector( rna_vdw_atom_[which_residue1], atom_name1 );
93  Size const pos2 = get_position_in_vector( rna_vdw_atom_[which_residue2], atom_name2 );
94 
95  runtime_assert( pos1 <= rna_vdw_parameter_.size1() );
96  runtime_assert( pos1 <= rna_vdw_parameter_.size2() );
97 
98  rna_vdw_parameter_( pos1,
99  pos2,
100  rna_residue_name_to_num( which_residue1 ),
101  rna_residue_name_to_num( which_residue2 ) ) = input_bump_parameter;
102  //perhaps we should explicitly force symmetry here?
103 
104  }
105 
106  // for ( Size i = 1; i <= 9; i++ ) {
107  // for ( Size j = 1; j <= 9; j++ ) {
108  // for ( Size m = 1; m <= 5; m++ ) {
109  // for ( Size n = 1; n <= 5; n++ ) {
110  // std::cout << "BUMP PARAM: " << i << " " << j << " " << m << " " << n << " " << rna_vdw_parameter_( i, j, m, n ) << std::endl;
111  // }
112  // }
113  // }
114  // }
115 
116 }
117 
118 //////////////////////////////////////////////
120 RNA_AtomVDW::vdw_atom_list( char const which_nucleotide ) const
121 {
122  AtomList::const_iterator iter = rna_vdw_atom_.find( which_nucleotide );
123 
124  if ( iter == rna_vdw_atom_.end() ) {
125  tr << "WARNING! Asked for vdw_atom_list for " << which_nucleotide << " and it did not exist! " << std::endl;
126  utility::vector1< std::string > blank_vector;
127  return blank_vector;
128  }
129 
130  return (iter->second);
131 }
132 
133 Real
134 RNA_AtomVDW::bump_parameter( Size const atom1, Size const atom2,
135  char const which_residue1, char const which_residue2 ) const
136 {
137  return rna_vdw_parameter_( atom1, atom2,
138  rna_residue_name_to_num( which_residue1 ),
139  rna_residue_name_to_num( which_residue2 ) );
140 }
141 
142 
143 
144 } // namespace rna
145 } // namespace scoring
146 } // namespace core
147