33 #include <ObjexxFCL/format.hh>
36 #include <utility/vector1.fwd.hh>
37 #include <basic/Tracer.hh>
40 #include <utility/vector1.hh>
49 using namespace kinematics;
52 static basic::Tracer
tr(
"core.fragment");
60 using namespace chemical;
65 for (
Size seqpos = 1; seqpos <= sequence.length(); ++seqpos ) {
66 char aa = sequence[seqpos-1];
70 if ( rsd_type_list.size() == 0 ) {
71 std::cerr <<
" cannot find aminoacid " << my_aa <<
" from sequence " << sequence <<
" in Frame::fragment_from_pose() " << std::endl;
73 runtime_assert( rsd_type_list.size() );
75 ResidueType const & rsd_type( *(rsd_type_list[ best_index ]) );
103 end_ ( start + length - 1 ),
115 end_( start + frag1->
size() - 1 ),
116 nr_res_( frag1->
size() )
123 end_( start + length - 1),
146 newFrame->frag_list_[ 1 ]->set_valid(
false );
191 return start()+intra_pos-1;
213 return (seqpos >=
start_ ) && (seqpos <=
end_ ); }
236 return pos <= stop() && pos >=
start();
254 CacheMap::const_iterator iter(
cache_.find( tag ) );
255 if ( iter ==
cache_.end() ) {
256 return *(
cache_[ tag ] = new_cache->clone() );
258 return *(
cache_[ tag ] );
263 for ( CacheMap::iterator it=source.
cache_.begin(), eit=source.
cache_.end(); it!=eit; ++it ) {
287 return new_frag->is_compatible(
fragment( 1 ) );
293 }
else return (new_frag->size() ==
length() );
324 if ( success )
frag_list_.push_back( new_frag );
409 for ( FragDataList::const_iterator it=new_frag.begin(), eit=new_frag.end();
412 if ( !success )
return false;
418 using namespace ObjexxFCL::fmt;
420 out <<
"position: " << RJ( 10, position) <<
" neighbors: " << RJ( 10,
nr_frags() ) << std::endl << std::endl;
435 using namespace ObjexxFCL::fmt;
436 out <<
"FRAME " <<
" " << RJ( 3,
start() ) <<
" " << RJ( 3,
end() ) << std::endl;
451 out << std::endl << std::endl;
461 Size other_frag_num = 1;
462 for ( FragDataList::const_iterator it = other.
frag_list_.begin(),
463 eit = other.
frag_list_.end(); it!=eit; ++it ) {
474 bool success = ( s>0 && e>0 );
476 success = ( (e - s + 1 ) ==
length() );
477 if ( !success )
tr.Trace <<
"failed to align frame " <<
start() <<
" " <<
end() <<
" different size after alignment" << std::endl;
479 for (
Size pos =
start(); success && pos<=
end(); pos ++ ) {
480 success = map[ pos ] > 0;
481 if ( !success )
tr.Trace <<
"failed to align frame " <<
start() <<
" " <<
end() <<
" due to pos " << pos << std::endl;
494 sub_frame->start_ += start - 1;
495 sub_frame->nr_res_ =
length;
496 sub_frame->end_ = sub_frame->start_ + length - 1;
499 sub_frame->add_fragment( (*it)->generate_sub_fragment( start, start + length - 1 ) );
501 runtime_assert(
nr_frags() == sub_frame->nr_frags() );
508 bool success ( new_frag->steal( pose, *
this ) );
514 tr.Trace <<
"remove unitialized template FragData and replace it with stolen one" << std::endl;
528 frag_template->set_valid(
false );