Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PartialThreadingMover.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 protocols/comparative_modeling/PartialThreadingMover.hh
11 /// @brief
12 /// @author James Thompson
13 
16 
17 #include <core/types.hh>
18 #include <basic/Tracer.hh>
20 
21 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
22 #include <core/sequence/util.hh>
24 #include <core/pose/PDBInfo.hh>
25 
26 #include <utility/vector1.hh>
27 #include <utility/tag/Tag.hh>
30 
31 // C++ headers
32 #include <string>
33 
35 #include <utility/vector0.hh>
36 
37 
38 namespace protocols {
39 namespace comparative_modeling {
40 
43  core::pose::Pose const & template_pose
44 ) :
45  ThreadingMover( align, template_pose )
46 {}
47 
49  core::pose::Pose & query_pose
50 ) {
51  using core::Size;
52  using basic::Tracer;
54 
55  static Tracer tr("protocols.comparative_modeling.partial_threading");
56  build_loops(false);
57  repack_query(true);
58  ThreadingMover::apply(query_pose);
59 
60  SequenceMapping query_to_pdbseq = get_qt_mapping(query_pose);
61 
62  //fpd update PDBinfo to have correct residue numbering
63  utility::vector1< int > pdb_numbering;
64  utility::vector1< char > pdb_chains;
65 
66  // iterate backwards as we change downstream sequence numbering with deletions
67  tr.Debug << "current sequence is " << query_pose.sequence() << std::endl;
68  for ( Size resi = query_pose.total_residue(); resi >= 1; --resi ) {
69  Size const t_resi = query_to_pdbseq[ resi ];
70 
71  if ( t_resi == 0 && query_pose.total_residue() > 1 ) {
72  query_pose.conformation().delete_residue_slow(resi);
73  } else {
74  pdb_numbering.push_back( resi );
75  pdb_chains.push_back( 'A' );
76  }
77  } // for resi
78  tr.Debug << "final sequence is " << query_pose.sequence() << std::endl;
79 
80  std::reverse(pdb_numbering.begin(), pdb_numbering.end());
81  core::pose::PDBInfoOP new_pdb_info( new core::pose::PDBInfo(query_pose,true) );
82  new_pdb_info->set_numbering( pdb_numbering );
83  new_pdb_info->set_chains( pdb_chains );
84  query_pose.pdb_info( new_pdb_info );
85  query_pose.pdb_info()->obsolete( false );
86 
87  tr.flush_all_channels();
88 } // apply
89 
91  utility::tag::TagPtr const tag,
92  protocols::moves::DataMap & /* data */,
93  protocols::filters::Filters_map const & /* filters */,
94  protocols::moves::Movers_map const & /* movers */,
95  core::pose::Pose const & /* pose */
96 ) {
97  // need to provide aln_fn, template Pose somehow
98  runtime_assert( tag->hasOption("aln_fn") );
99  runtime_assert( tag->hasOption("aln_id") );
100  runtime_assert( tag->hasOption("template_pdb_fn") );
101 
102  using std::string;
103  using utility::vector1;
104  using core::pose::Pose;
108 
109  string const template_pdb_fn(
110  tag->getOption< string >("template_pdb_fn")
111  );
113  core::import_pose::pose_from_pdb(template_pose,template_pdb_fn);
114  ThreadingMover::template_pose(template_pose);
115 
116  string const aln_fn( tag->getOption< string >("aln_fn") );
117  string const aln_id( tag->getOption< string >("aln_id") );
118  string aln_format("grishin");
119  if ( tag->hasOption("aln_format") ) {
120  aln_format = tag->getOption< string >("aln_format");
121  }
122 
123  vector1< SequenceAlignment > alns = read_aln( aln_fn, aln_format );
125  bool found_aln(false);
126  for ( iter it = alns.begin(), end = alns.end(); it != end; ++it ) {
127  if ( it->alignment_id() == aln_id ) {
128  found_aln = true;
130  }
131  }
132 
133  if ( !found_aln ) {
134  string const msg(
135  "Error: couldn't find aln with id " + aln_id +
136  " in aln_file " + aln_fn + "!"
137  );
138  utility_exit_with_message("Error!");
139  }
140 }
141 
144  return "PartialThreadingMover";
145 }
146 
147 } // comparative_modeling
148 } // protocols