Example #1
0
	void RotLibConvert_Dunbrack_BBInd::readDefinition( StringBuilder& sb, RotamerLibrary& _RotLib ) const
	{
		ASSERT( sb.size() >= 67, ParseException, "String too short to parse!!");

		StringBuilder resname(3);
		resname.setTo( sb, 0, 3 );
		sb.TruncateLeftBy(18);

		int pdbCount = sb.parseInt(0,7);
		if( pdbCount == 0 )
			return;
		double probability = sb.parseDouble(7,8);
		sb.TruncateLeftBy(37);
		
		std::vector<double> importChis;
		std::vector<std::string> parts = sb.tokenise();
		ASSERT( (parts.size() % 2 == 0), ParseException, "Unexpected element count");

		for( size_t i = 0; i < parts.size(); i+=2 )
		{
			double chi;
			ASSERT( 0 == str2double( parts[i], chi ), ParseException, "Error parsing chi def");
			importChis.push_back(Maths::DegToRad(chi));
		}

		ASSERT( importChis.size() != 0, ParseException, "No chis found!!");
		_RotLib.addRotamer( resname.toString(), importChis, ConstantProbability( probability ) );
	}
Example #2
0
std::string pdbPathToStem( const std::string& pdbPath, int startRes, int length, int branchNum, int execID )
{	
	StringBuilder stem;
	stem.append(execID);
	stem.append('_');
	stem.append( pdbPath );
	size_t at;
	while( SIZE_T_FAIL != (at = stem.FirstOf('/') ) )
	{
		stem.replace( at, '\\' );
	}
	at = stem.LastOf( '\\' );
	if( at != SIZE_T_FAIL )
		stem.TruncateLeftBy( at + 1 );
	at = stem.FirstOf( '.' );
	if( at != SIZE_T_FAIL )
		stem.TruncateRightTo( at );

	stem.append('_');
	stem.append(startRes);
	stem.append('_');
	stem.append(length);
	stem.append('_');
	stem.append(branchNum);

	return stem.toString();
}