-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lanthipeptide and recon multistate design update #263
base: main
Are you sure you want to change the base?
Changes from 11 commits
a0d0bde
0ae639e
e74fddf
038c6db
e108dfd
26b0e94
2a6e9c1
2985543
83ec883
266cb2d
4c8004d
f51903b
5fe7251
6d14130
9f833c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ | |
|
||
#include <protocols/minimization_packing/PackRotamersMover.hh> | ||
|
||
#include <sstream> | ||
#include <utility/string_util.hh> | ||
#include <utility/mpi_util.hh> | ||
|
||
|
@@ -168,7 +169,7 @@ MSDMover::apply( core::pose::Pose & pose ) { | |
setup_mover( pose ); | ||
|
||
// Find the sequence of the other poses | ||
utility::vector1< std::string > other_pose_sequences; | ||
utility::vector1< utility::vector1< std::string > > other_pose_sequences; | ||
for ( core::Size ii = 1; ii <= poses_.size(); ++ii ) { | ||
if ( ii != current_pose_ ) { | ||
other_pose_sequences.push_back( | ||
|
@@ -217,7 +218,7 @@ MSDMover::apply( core::pose::Pose & pose ) { | |
/// applied so they can be removed later | ||
utility::vector1< core::scoring::constraints::ConstraintCOP > | ||
MSDMover::apply_linked_constraints( core::pose::Pose & pose, | ||
utility::vector1< std::string > other_pose_sequences, | ||
utility::vector1< utility::vector1< std::string > > other_pose_sequences, | ||
utility::vector1< core::Size > my_designable_residues ) { | ||
|
||
using namespace core::scoring::constraints; | ||
|
@@ -280,34 +281,50 @@ MSDMover::apply_mpi( core::pose::Pose & pose ) { | |
/// Find out my designable residues from my pose and my resfile | ||
utility::vector1< core::Size > my_designable_residues = get_designable_residues( pose, this_nodes_resfile ); | ||
|
||
/// Make a string out of the AAs at my designable positions in the current state | ||
std::string my_sequence = get_designable_sequence ( pose, my_designable_residues ); | ||
/// Make a string vector out of the AAs at my designable positions in the current state | ||
utility::vector1< std::string > my_sequence = get_designable_sequence ( pose, my_designable_residues ); | ||
|
||
std::string pass_seq; | ||
for( const std::string& resi_base_name: my_sequence) { | ||
pass_seq += resi_base_name + " "; | ||
} | ||
|
||
/// Get the AAs at designable positions of the other states I need to cooperate with | ||
utility::vector1<std::string> other_pose_sequences( n_procs ); | ||
utility::vector1< utility::vector1<std::string> > other_pose_sequences( n_procs ); | ||
for ( core::Size ii = 1; ii <= n_procs; ++ii ) { | ||
if ( rank == ii ) { | ||
for ( core::Size jj = 1; jj <= n_procs; ++jj ) { | ||
if ( rank!=jj ) utility::send_string_to_node( jj-1, my_sequence ); // node ranks are 0-indexed | ||
if ( rank!=jj ) utility::send_string_to_node( jj-1, pass_seq ); // node ranks are 0-indexed | ||
else other_pose_sequences[jj] = my_sequence; | ||
} | ||
} else { | ||
other_pose_sequences[ii] = utility::receive_string_from_node( ii-1 ); // node ranks are 0-indexed | ||
std::string passed_seq; | ||
passed_seq = utility::receive_string_from_node( ii-1 ); // node ranks are 0-indexed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Combine this on a single line. (In general, when possible, try to declare variables on the same line you first initialize them.) |
||
//Need to split passed_seq by spaces | ||
std::istringstream iss(passed_seq); | ||
std::string resi_name; | ||
while (iss >> resi_name){ | ||
other_pose_sequences[ii].push_back(resi_name); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I use that fxn, is there any way to avoid this awkward passing the output to other_pose_sequences: utility::vector1std::string split_seq = split_whitespace(passed_seq); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't have to push it one string at a time; you should be able to set |
||
} | ||
} | ||
|
||
/// Let the master make sure all the sequences are the same length, | ||
/// i.e. all the states have same number of designable residues | ||
if ( master ) { | ||
for ( std::string const & sequence: other_pose_sequences ) { | ||
for ( utility::vector1< std::string > const & sequence: other_pose_sequences ) { | ||
if ( sequence.size() != my_sequence.size() ) { | ||
utility_exit_with_message( "Error: all states must have the same number of designable residues" ); | ||
} | ||
} | ||
} | ||
|
||
if ( debug_ ) { | ||
TR << "my sequence is " << my_sequence << std::endl; | ||
TR << "my sequence is "; | ||
for( core::Size i = 1; i <= my_sequence.size(); ++i ) { | ||
TR << my_sequence[i] << " "; | ||
} | ||
TR << std::endl; | ||
} | ||
|
||
/// Run my multistate design | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,31 +45,40 @@ get_designable_residues( core::pose::Pose & pose, std::string resfile ) { | |
|
||
/// Based on a pose and the indices of all designable residues, get a | ||
/// string of all designable AAs concatenated | ||
std::string | ||
utility::vector1< std::string > | ||
get_designable_sequence ( core::pose::Pose & pose, utility::vector1< core::Size > designable_residues ) { | ||
std::string sequence = ""; | ||
//std::string sequence = ""; | ||
utility::vector1< std::string > sequence; | ||
for ( core::Size seqpos: designable_residues ) { | ||
sequence += pose.residue( seqpos ).name1(); | ||
//sequence += pose.residue( seqpos ).name1(); | ||
sequence.push_back(pose.residue_type( seqpos ).base_name()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the issues you'll run into here is that it looks like ResidueTypeConstraint takes a string which it compares with the (My recommendation is to either use |
||
} | ||
return sequence; | ||
} | ||
|
||
/// Based on a list of sequences from poses, get all the AAs present at | ||
/// the position given by position_no | ||
utility::vector1< std::string > | ||
get_candidate_AAs( utility::vector1< std::string > other_pose_sequences, | ||
get_candidate_AAs( utility::vector1< utility::vector1< std::string > > other_pose_sequences, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You probably want to pass unchanged vectors by |
||
core::Size position_no ) { | ||
|
||
utility::vector1< std::string > candidate_AAs; | ||
|
||
// Iterate through all poses in my collection and find their AA at this position | ||
for ( std::string const & sequence: other_pose_sequences ) { | ||
char current_AA = sequence[ position_no-1 ]; // string is zero indexed | ||
std::string current_AA_3letter = core::chemical::name_from_aa( core::chemical::aa_from_oneletter_code( current_AA ) ); | ||
if ( std::find( candidate_AAs.begin(), candidate_AAs.end(), current_AA_3letter ) == candidate_AAs.end() ) { | ||
candidate_AAs.push_back( current_AA_3letter ); | ||
} | ||
} | ||
//for ( std::string const & sequence: other_pose_sequences ) { | ||
// char current_AA = sequence[ position_no-1 ]; // string is zero indexed | ||
// std::string current_AA_3letter = core::chemical::name_from_aa( core::chemical::aa_from_oneletter_code( current_AA ) ); | ||
// if ( std::find( candidate_AAs.begin(), candidate_AAs.end(), current_AA_3letter ) == candidate_AAs.end() ) { | ||
// candidate_AAs.push_back( current_AA_3letter ); | ||
// } | ||
//} | ||
for ( utility::vector1< std::string > const & sequence: other_pose_sequences ) { | ||
std::string current_AA = sequence[ position_no ]; // vector1 is 1 indexed | ||
//std::string current_AA_3letter = core::chemical::name_from_aa( core::chemical::aa_from_oneletter_code( current_AA ) ); | ||
if ( std::find( candidate_AAs.begin(), candidate_AAs.end(), current_AA ) == candidate_AAs.end() ) { | ||
candidate_AAs.push_back( current_AA ); | ||
} | ||
} | ||
|
||
return candidate_AAs; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rosetta convention is "east const":
std::string const &