Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OutputWriter.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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file protocols/match/output/OutputWriter.cc
12 /// @brief Implementation for the class to write output matches that have (presumably) passed the output filters.
13 /// @author Alex Zanghellini (zanghell@u.washington.edu)
14 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com), Florian Richter (floric@u.washington.edu) porting to mini
15 
16 // Unit headers
18 
22 #include <protocols/match/Hit.hh>
23 
24 //utility headers
25 #include <utility/string_util.hh>
26 
27 #include <utility/vector1.hh>
28 
29 
30 
31 
32 namespace protocols {
33 namespace match {
34 namespace output {
35 
37  : cst_io_(NULL)
38 {}
39 
41 
44  {
45  return cst_io_;
46  }
47 
48 
49 void
51  MatcherTaskCOP mtask
52 ){
53  cst_io_ = mtask->enz_input_data();
54 }
55 
56 
57 void
59  match_dspos1 const & m,
60  std::map< core::Size, core::Size > & redundant_upstream_res
61 ) const
62 {
63  using namespace core;
64  using namespace toolbox::match_enzdes_util;
65 
66  redundant_upstream_res.clear();
67  std::map< Size, Size > seen_scafpos_to_geom_cst;
68  std::map< Size, Size > bb_scafpos_to_geom_cst;
69 
70  for ( core::Size i = 1; i <= m.upstream_hits.size(); ++i ) {
71  core::Size this_scafpos = m.upstream_hits[i].scaffold_build_id();
73  cst_io_->mcfi_list( i )->mcfi( m.upstream_hits[i].external_geom_id() );
74  bool bb_interaction( cur_mcfi->is_backbone( cur_mcfi->upstream_res() ) );
75 
76  std::map< Size, Size >::iterator seen_it = seen_scafpos_to_geom_cst.find( this_scafpos );
77  std::map< Size, Size >::iterator bb_seen_it = bb_scafpos_to_geom_cst.find( this_scafpos );
78 
79  //first case: this residue position has already been seen,
80  //so either this or the previously seen constraint are redundant
81  if ( seen_it != seen_scafpos_to_geom_cst.end() ) {
82  if ( bb_interaction ) {
83  redundant_upstream_res[ i ] = seen_it->second;
84  continue;
85  } else {
86  if ( bb_seen_it != bb_scafpos_to_geom_cst.end() ) {
87  redundant_upstream_res[ bb_seen_it->second ] = i;
88  } else {
89  utility_exit_with_message("Error in matcher: two sidechains (for geomcsts "+utility::to_string( i )+" and " +utility::to_string( seen_it->second )+") placed at the same scaffold location ("+utility::to_string( this_scafpos)+") considered a match. Hint: if one of these geomcsts is supposed to be a backbone only interaction, this needs to be specified in the cstfile through the \"TEMPLATE:: ATOM_MAP: <residue num> is_backbone \" tag.");
90  }
91  }
92  } else {
93  //otherwise this position has not been encountered before
94  seen_scafpos_to_geom_cst[ this_scafpos] = i;
95  if ( bb_interaction ) {
96  bb_scafpos_to_geom_cst[ this_scafpos ] = i;
97  }
98  }
99  } //loop over all matchres
100 }
101 
102 }
103 }
104 }