<s> """<STR_LIT>""" <EOL> import sys <EOL> import prody <EOL> import random <EOL> import numpy <EOL> from pyproct . tools . scriptTools import create_directory <EOL> from pyRMSD . RMSDCalculator import RMSDCalculator <EOL> from pyRMSD . condensedMatrix import CondensedMatrix <EOL> from pyproct . tools . plotTools import matrixToImage <EOL> def get_frame_numbers ( args ) : <EOL> cluster_frames_str = sys . argv [ <NUM_LIT:3> : len ( args ) ] <EOL> cluster_frames = [ ] <EOL> for c in cluster_frames_str : <EOL> cluster_frames . append ( int ( c ) ) <EOL> cluster_frames = numpy . array ( cluster_frames ) <EOL> print "<STR_LIT>" , cluster_frames <EOL> return cluster_frames <EOL> def preprocess_pdb ( args ) : <EOL> pdb_file = args [ <NUM_LIT:1> ] <EOL> output = "<STR_LIT>" + args [ <NUM_LIT:2> ] + "<STR_LIT:/>" + args [ <NUM_LIT:2> ] <EOL> create_directory ( "<STR_LIT>" + args [ <NUM_LIT:2> ] ) <EOL> cluster_frames = get_frame_numbers ( args ) <EOL> pdb = prody . parsePDB ( pdb_file ) <EOL> input_coordsets = numpy . array ( pdb . getCoordsets ( ) [ cluster_frames ] ) <EOL> pdb . delCoordset ( range ( pdb . numCoordsets ( ) ) ) <EOL> input_pdb = prody . parsePDB ( pdb_file ) <EOL> input_pdb . delCoordset ( range ( input_pdb . numCoordsets ( ) ) ) <EOL> for i in range ( len ( cluster_frames ) ) : <EOL> input_pdb . addCoordset ( input_coordsets [ i ] ) <EOL> prody . writePDB ( output + "<STR_LIT>" , input_pdb ) <EOL> print_matrix ( input_pdb . select ( "<STR_LIT>" ) . getCoordsets ( ) , output ) <EOL> return pdb , input_coordsets , cluster_frames , output <EOL> def print_matrix ( input_coordsets , output ) : <EOL> calculator = RMSDCalculator ( calculatorType = "<STR_LIT>" , fittingCoordsets = input_coordsets ) <EOL> matrixToImage ( CondensedMatrix ( calculator . pairwiseRMSDMatrix ( ) ) , output + "<STR_LIT>" ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> pdb , input_coordsets , cluster_frames , output = preprocess_pdb ( sys . argv ) <EOL> for f in range ( len ( cluster_frames ) ) : <EOL> base_coordinates = input_coordsets [ f ] <EOL> numatoms = len ( base_coordinates ) <EOL> for i in range ( <NUM_LIT:100> ) : <EOL> rand_list = [ ] <EOL> for r in range ( numatoms * <NUM_LIT:3> ) : <EOL> rand_list . append ( random . uniform ( - <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> rand_displacements = numpy . resize ( numpy . array ( rand_list ) , ( numatoms , <NUM_LIT:3> ) ) <EOL> pdb . addCoordset ( numpy . array ( [ rand_displacements + base_coordinates ] ) ) <EOL> print_matrix ( pdb . select ( "<STR_LIT>" ) . getCoordsets ( ) , output + "<STR_LIT>" ) <EOL> prody . writePDB ( output + "<STR_LIT>" , pdb ) </s>
