Script for batch RMS protein calculation: UPDATE

I updated the script here on this post to include some options. I have it currently on my Software folder while linked to /usr/bin for ubiquitous access.

#!/bin/bash

CURRENTDIR=${PWD##*/}

if [ $# = 3 ] && [ -f $2 ]; then

    case $1 in 
    "CA")
    SCRIPTPATH="/home/joao/Software/Scripts/fitCA.txt"
    ;;
    "ZN")
    SCRIPTPATH="/home/joao/Software/Scripts/fitZN.txt"
    ;;
    *)
    echo -e 'Error!!\nUsage: script_rms_profit.sh CA/ZN <reference_model .pdb> <general_mobile_model>\n\nCheck if reference_model.pdb exists!\n\n<mobile_model> will be translated to *.<general_mobile_model>*.pdb in the script!'
    exit
    esac

    echo 'Fitting to '$1'...'

    for i in $(ls *.$3*.pdb); do

        echo $(profit -f $SCRIPTPATH $2 $i | grep RMS | cut -c 9- )

        echo ${i%.p*b} $(profit -f $SCRIPTPATH $2 $i | grep RMS | cut -c 9- ) $(cat $i | grep -i OBJECT | awk '{ print $6 }') >> 'RMS_'$CURRENTDIR'.temp'

    done

    echo 'Saving in RMS_'$1'_'$CURRENTDIR'.txt ...'
    echo 'Ordering File by RMS'

    sort -nk 2 'RMS_'$CURRENTDIR'.temp' > 'RMS_'$1'_'$CURRENTDIR'.txt'

    rm 'RMS_'$CURRENTDIR'.temp'

    echo 'Finished!'

else
    echo -e 'Error!!\nUsage: script_rms_profit.sh CA/ZN <reference_model .pdb> <general_mobile_model>\n\nCheck if reference_model.pdb exists!\n\n<mobile_model> will be translated to *.<general_mobile_model>*.pdb in the script!'
fi

exit

The fit*.txt scripts are just text files with:

“ATOM X

FIT”

Where X is the atom type we want to fit (for me it’s CA (alpha carbon) and ND1 and SG)

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s