Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
fast_gap.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 full_length_model.cc
11 /// @brief
12 /// @author James Thompson
13 
14 #include <core/types.hh>
15 #include <core/init/init.hh>
16 #include <basic/Tracer.hh>
17 #include <core/chemical/util.hh>
18 
19 #include <basic/options/option.hh>
20 
21 #include <core/sequence/util.hh>
22 #include <core/sequence/Sequence.hh>
23 #include <core/sequence/SequenceAlignment.hh>
24 #include <core/sequence/NWAligner.hh>
25 #include <core/sequence/ScoringScheme.fwd.hh>
26 #include <core/sequence/SimpleScoringScheme.hh>
27 
28 #include <core/kinematics/MoveMap.hh>
29 #include <core/kinematics/MoveMap.fwd.hh>
30 
31 #include <core/import_pose/pose_stream/util.hh>
32 #include <core/import_pose/pose_stream/MetaPoseInputStream.hh>
33 #include <core/import_pose/PDBSilentStruct.hh>
34 
35 #include <core/io/pdb/pose_io.hh>
36 #include <core/conformation/Conformation.hh>
37 #include <core/scoring/ScoreFunction.hh>
38 
39 #include <core/pose/Pose.hh>
40 #include <core/pose/util.hh>
41 #include <core/pack/task/TaskFactory.hh>
42 
43 #include <core/fragment/FragSet.hh>
44 #include <core/fragment/FragSet.fwd.hh>
45 
46 #include <protocols/relax/MiniRelax.cc>
47 
48 #include <protocols/loophash/FastGapMover.hh>
49 #include <protocols/comparative_modeling/ThreadingMover.hh>
50 
51 #include <utility/vector1.hh>
52 #include <utility/io/ozstream.hh>
54 
55 // C++ headers
56 #include <string>
57 
58 // option key includes
59 #include <basic/options/keys/in.OptionKeys.gen.hh>
60 #include <basic/options/keys/relax.OptionKeys.gen.hh>
61 
62 #include <core/pose/annotated_sequence.hh>
63 #include <utility/vector0.hh>
64 
65 
67  core::import_pose::PDBSilentStruct ss;
68 
69  ss.fill_struct( pose );
70  ss.fill_pose( pose, *(core::chemical::rsd_set_from_cmd_line()) );
71 }
72 
73 int
74 main( int argc, char* argv [] ) {
75  try {
76 
77  using namespace basic::options;
78  using namespace basic::options::OptionKeys;
79  using namespace core::chemical;
80  using namespace core::sequence;
81  using namespace core::fragment;
82  using namespace core::import_pose::pose_stream;
83  using namespace protocols::comparative_modeling;
84  using namespace core::scoring;
85  using namespace core::pack;
86  using namespace core::kinematics;
87  using core::Size;
88  using utility::vector1;
89 
90  basic::Tracer tr( "full_length_model" );
91 
92  // options, random initialization
93  core::init::init( argc, argv );
94 
95  protocols::loophash::FastGapMover fast_gap;
96  ResidueTypeSetCAP rsd_set = rsd_set_from_cmd_line();
97  MetaPoseInputStream input = streams_from_cmd_line();
98  std::string sequence = core::sequence::read_fasta_file(
99  option[ in::file::fasta ]()[1]
100  )[1]->sequence();
101  NWAligner nw_align;
102 
103  while ( input.has_another_pose() ) {
105  input.fill_pose( start_pose, *rsd_set );
106 
107  // make an alignment from the input pose to the full-length fasta
108  ScoringSchemeOP ss( new SimpleScoringScheme( 6, 1, -4, -1 ) );
109  SequenceOP full_length( new Sequence(
110  sequence, "full_length", 1
111  ) );
112  SequenceOP pdb_seq( new Sequence(
113  start_pose.sequence(), "pdb", 1
114  ) );
115  SequenceAlignment aln = nw_align.align( full_length, pdb_seq, ss );
116  tr.Debug << "rebuilding pose with alignment: " << std::endl;
117  tr.Debug << aln << std::endl;
118  tr.flush();
119 
120  // build a model using threading (copy aligned regions)
121  ThreadingMover threader(aln,start_pose);
122  threader.build_loops(false);
123  core::pose::Pose full_length_pose;
124  core::pose::make_pose_from_sequence( full_length_pose, sequence, *rsd_set );
125  threader.apply(full_length_pose);
126 
127  full_length_pose.dump_pdb("here.pdb");
128 
129  fast_gap.apply(full_length_pose);
130 
131  std::string output_prefix( core::pose::tag_from_pose(start_pose) );
132  // output PDB
133  alignment_into_pose( aln, full_length_pose );
134  utility::io::ozstream output( output_prefix + "_full_length.pdb" );
135  output << "REMARK REBUILT_RESIDUES";
136  output << std::endl;
137  output << "REMARK query_aln " << aln.sequence(1)->to_string() << std::endl;
138  output << "REMARK template_aln " << aln.sequence(2)->to_string()<< std::endl;
139  output << std::endl;
140  core::io::pdb::dump_pdb( full_length_pose, output );
141  output.close();
142  //full_length_pose.dump_pdb( output_prefix + "_full_length.pdb" );
143  } // has_another_pose()
144  } catch ( utility::excn::EXCN_Base const & e ) {
145  std::cout << "caught exception " << e.msg() << std::endl;
146  return -1;
147  }
148 } // int main( int argc, char * argv [] )
void restore_hack(core::pose::Pose &pose)
Definition: fast_gap.cc:66
virtual std::string const msg() const
Definition: EXCN_Base.hh:70
vector0: std::vector with assert-checked bounds
core::pose::Pose Pose
Definition: supercharge.cc:101
string output
Definition: contacts.py:31
common derived classes for thrown exceptions
int main(int argc, char *argv[])
Definition: fast_gap.cc:74
Tracer IO system.
std::vector with 1-based indexing
Definition: vector1.fwd.hh:44
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
utility::options::OptionCollection option
OptionCollection global.
Definition: option.cc:45
Output file stream wrapper for uncompressed and compressed files.
void close()
Close the ofstream and reset the state.
Definition: ozstream.hh:430
tuple pack
Definition: loops.py:50
ocstream cout(std::cout)
Wrapper around std::cout.
Definition: ocstream.hh:287
vector1: std::vector with 1-based indexing
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
Definition: Tracer.hh:134
ozstream: Output file stream wrapper for uncompressed and compressed files
Definition: ozstream.hh:53
void init()
set global 'init_was_called' to true
Definition: init.cc:26
Program options global and initialization function.
THREAD_LOCAL basic::Tracer tr("struc_set_fragment_picker")
platform::Size Size
Definition: random.fwd.hh:30
TracerProxy Debug
Definition: Tracer.hh:262