Vortex script to make a random selection

Sometimes it is the simplest scripts that prove to be the most useful. I regularly need to select a specified number of molecules in a random fashion and this script does just that. Import a sdf file containing structures and run the script to make a random selection.

The first part of the script is simply to create the GUI, this lets the user type in how many molecules they want randomly selecting, as the script stands you can select any number upto 10 million.

Once the user clicks ‘OK” we gather the number from the dialog and check that the number wanted is smaller than the number of entires in the table.

The next step is to iterate through the table to set each row to unselected, and add the row number to “rowlist”.

The next step is to make a random selection

Then use the list of selected row numbers to make selections

I ran this script on the 1.8 million structures downloaded from ChEMBL and it took much less than a second to run.

The Vortex Script

You can download the script here.

Last updated 15 November 2018

Related Posts