Useful scripts

Disclaimer: All these scripts were written by Emil Åberg
Imagine you have multiple folders with rec.pdbqt and rec.pdb files and have a folder with all the ligands with .pdbqt files. Imagine now you want to dock all the ligands with receptors present in all the folders. You can use a script something like the following
#3fli, 3fxv name of the folders which contain receptor pdb and pdbqt files
for i in 3fli 3fxv 3l1b 3okh 3olf 3omk 3omm 3oof 4qe6 4qe8; do

cd $i

cd ..

the VS.bash file looks something like following
#Ligands are situated at ../Ligands/Withoutcharges/ folder
for f in lig{1..36}_noch.pdbqt; do  b=`basename $f .pdbqt`; echo Processing ligand $b; mkdir -p data01; cp ../Ligands/Withoutcharges/$f . ; vina --config conf.txt --ligand $f --out data01/$f.pdbqt --log data01/$f.txt; done
#result analysis
cd data01
grep "   1 " *.txt | cut -c35-42,1-12 >>result
sort -rt" " +2 result >result2
cat result2
Now imagine in case of each receptor (for each folder) you want to list the binding affinity of all the 36 receptors in a text file you might like to use the following script
for a in 1osh_2 3fli 3fxv 3l1b 3okh 3olf 3omk 3omm 3oof 4qe6 4qe8 3dct 3dcu 3hc5 3hc6 3p88 3rut 3ruu_noanisou apo; do
cd $a/
echo -n >affinities_$a.txt
   cd data01/
    for i in {1..36}; do

               grep ' 1 ' lig${i}_noch.pdbqt.txt | awk '{print $2}' >>../affinities_$a.txt

   cd ../../

    echo "Rec $a" 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: