schrodinger.structutils.shuffle module

exception schrodinger.structutils.shuffle.ShuffleException

Bases: Exception

schrodinger.structutils.shuffle.split_and_shuffle(infile, batch_size=1000000000.0, random_seed=None)

Split structures in infile to batches. Shuffle structures in each batch. Write each batch to a temporary file.

Parameters
  • infile (MAESTRO or SD file) – input structure file.

  • batch_size (int) – size of temporary split sub files in bytes.

  • random_seed (int or None) – random seed number for shuffling the ligands

Returns

list of file names, list of number of structures in each file.

Return type

list(str), list(int)

schrodinger.structutils.shuffle.shuffle_merge(batch_files, num_st_in_batch, outfile, max_structs, random_seed=None)

Merge structures in temporary files by picking a structure from each temporary file at random (weighed by the number of structures in the file).

Parameters
  • batch_files (list(str)) – list of file names

  • num_st_in_batch (list(int)) – list of number of structures in each file.

  • outfile (str) – output file name

  • max_structs (int) – max. number of structures to write (negative means all)

  • random_seed (int or None) – random seed number for shuffling the ligands.

schrodinger.structutils.shuffle.shuffle_structs(input_file, output_file, max_structs=- 1, batch_size=1000000000.0, random_seed=None)

Structures in input_file are shuffled and outputed to the output file

Parameters
  • input_file (str) – input filename

  • output_file (str) – output filename

  • max_structs (int) – max. number of structures to write (negative means all)

  • batch_size (int) – size of temporary split sub files in bytes.

  • random_seed (int or None) – random seed number for shuffling the ligands