mailRe: a black box is needed


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Michael Bieri on September 17, 2009 - 02:42:
Hi Boaz

There are many data present in the result file obtained by relax (final run of full_analysis.py).

To extract the data I am interested, I'm created the following script: final_data_extraction.py (see attachment).

Just navigate to your final run directory, where the file results.bz2 is located, and copy your pdb file and this script into it. Then run the script using the command "relax final_data_extraction.py".

This will create a table with Residue Numer - Model - S2 - Rex as well as single data files and grace plots. Furtermore, it calculates the diffucion tensor pdb and generates PyMol macros to visualize the S2 and Rex values in PyMol (just run the macros in PyMol terminal by the command "@s2.pml").

The script works with relax 1.3.4 (not tested with 1.3.3).

I hope this script may help you! There is more that can be incorporated.

Cheers
Michael


Michael Bieri, PhD
Department of Biochemistry and Molecular Biology
Bio21 Molecular Science and Biotechnology Institute
The University of Melbourne, 30 Flemington Road
Parkville, Victoria 3010, Australia

Tel.: +61 3 8334 2256

http://www.biochemistry.unimelb.edu.au



Boaz Shapira wrote:
Hi,

I just installed relax and tried to figure out how it works (couldn't).
I have no idea about python and I don't mind to keep it that way unless i have no other choice. Still, I tried to play with the examples and couldn't make it work (the relax --text-suite didn't give me error)


I tried to run model-free.py from the relax prompt but it gives me error.
" Traceback (most recent call last):
  File "<console>", line 1, in <module>
NameError: name 'model' is not defined "

Then I copied line by line and it did work.
It save it in a .bz2 format.
Now If I want to read the data what format should I use?
It looks like a source html file.


In general I collected data on two fields and want to analyze the data with a black box (the full_analysis.py ?)
I have the input files in the right format as in the examples
I have the pdb file

Is it possible to simply run a black-box that will give me an output:
List of the residues with the best model for each, the values for this model (S2, tau ...), the goodness of the fitting, and
the overall diffusion tensor?
This black box will also reject "bad" relaxation data.
and all of that will be given in a text file?

It is too much to ask?

Thank you,

Boaz


------------------------------------------------
Boaz Shapira PhD
Complex Carbohydrate Research Center
University of Georgia
315 Riverbend Rd
Athens, GA 30602-4712
706-542-6286
bshapira@xxxxxxxxxxxx
------------------------------------------------------------------------

_______________________________________________
relax (http://nmr-relax.com)

This is the relax-users mailing list
relax-users@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-users
#####################################################################################
#          Script for Final Data Extraction after Model-free Analysis         
      #
#                                Michael Bieri                                
      #
#                                  16.9.2009                                  
      #
#####################################################################################


# Extract Data to Table

#create a table file

# Python module imports.
from string import replace

# relax module imports.
from generic_fns.mol_res_spin import spin_loop
from generic_fns import pipes


pipe.create('Data_extraction','mf')
results.read()

#create file

self.file = open('Model-free_Results.txt', 'w')

self.file.write('Data Extraction by Michael Bieri')
self.file.write("\n")
self.file.write("\n")
self.file.write("Residue                Model   S2                      
Rex\n")
self.file.write("\n")


for spin, spin_id in spin_loop(return_id=True):
            # The spin ID string.
            spin_no = spin_id[spin_id.index(':')+1:spin_id.index('&')]
            spin_res = spin_id[spin_id.index('&')+2:spin_id.index('@')]
            self.file.write((spin_res) + " " + (spin_no))
            # The spin is not selected.
            if not spin.select:
                self.file.write("\n")
                continue


# The model-free model.
            if hasattr(spin, 'model'):
                spin.model = spin.model[1:2]
                self.file.write("               " + spin.model)


# S2.
            if  hasattr(spin, 's2'):
                s2 = str(spin.s2)
                s2_err = str(spin.s2_err)
                if spin.s2 == None:
                        self.file.write("")
                else:
                        self.file.write("       " + s2[0:5]+ " +/- " + 
s2_err[0:4])


# Rex.
            if hasattr(spin, 'rex'):
                rex = str(spin.rex)
                rex_err = str(spin.rex_err)
                if spin.rex == None:
                        self.file.write("")
                else:
                        self.file.write("               " + rex[0:5]+ " +/- " 
+ rex_err[0:4])



# Start a new line.
            self.file.write("\n")


##################################################################################################

#Create Single Data Files


value.write(param='rex', file='rex.txt', dir='final_results', force=True)
value.write(param='s2', file='s2.txt', dir='final_results', force=True)
value.write(param='s2f', file='s2f.txt', dir='final_results', force=True)
value.write(param='s2s', file='s2s.txt', dir='final_results', force=True)
value.write(param='te', file='te.txt', dir='final_results', force=True)
value.write(param='tf', file='tf.txt', dir='final_results',  force=True)
value.write(param='ts', file='ts.txt', dir='final_results', force=True)
value.write(param='rex', file='rex.txt', dir='final_results', force=True)
value.write(param='r', file='r.txt', dir='final_results', force=True)
value.write(param='rex', file='rex.txt', dir='final_results', force=True)
value.write(param='csa', file='csa.txt', dir='final_results', force=True)
value.write(param='rex', file='rex.txt', dir='final_results', force=True)
value.write(param='local_tm', file='local_tm.txt', dir='final_results', 
force=True)

##################################################################################################

#Create Grace Plots

grace.write(x_data_type='spin', y_data_type='s2', file='s2.agr', force=True)
grace.write(x_data_type='spin', y_data_type='te', file='te.agr', force=True)
grace.write(x_data_type='spin', y_data_type='s2f', file='s2f.agr', force=True)
grace.write(x_data_type='spin', y_data_type='s2s', file='s2s.agr', force=True)
grace.write(x_data_type='spin', y_data_type='ts', file='ts.agr', force=True)
grace.write(x_data_type='spin', y_data_type='tf', file='tf.agr', force=True)
grace.write(x_data_type='spin', y_data_type='csa', file='csa.agr', force=True)
grace.write(x_data_type='te', y_data_type='s2', file='s2-te.agr', force=True)

##################################################################################################

#Create Diffusion Tensor

# Display the diffusion tensor.
diffusion_tensor.display()

# Create the tensor PDB file.
tensor_file = 'tensor.pdb'
structure.create_diff_tensor_pdb(file=tensor_file, force=True)

##################################################################################################

# Create S2 Macro for PyMol 

# Python module imports.
from string import replace

# relax module imports.
from generic_fns.mol_res_spin import spin_loop
from generic_fns import pipes

#create file

self.file = open('s2.pml', 'w')

self.file.write("bg_color white\n")
self.file.write("color gray90\n")
self.file.write("hide all\n")
self.file.write("show ribbon\n")

for spin, spin_id in spin_loop(return_id=True):

#select residue
            spin_no = spin_id[spin_id.index(':')+1:spin_id.index('&')]


#ribbon color
            if  hasattr(spin, 's2'):
                s2 = str(spin.s2)
                if spin.s2 == None:
                        self.file.write("")
                else:
                        width = ((1-spin.s2) * 2)
                        green = 1 - ((spin.s2)**3) 
                        green = green * green * green #* green * green
                        green = 1 - green
                        self.file.write("set_color resicolor" + spin_no + ", 
[0," + str(green) + ",1]\n")
                        self.file.write("color resicolor" + spin_no + ", resi 
" + spin_no + "\n")
                        self.file.write("set_bond stick_radius, " + 
str(width) + ", resi " + spin_no + "\n")



self.file.write("hide all\n")
self.file.write("show sticks, name C+N+CA\n")
self.file.write("set stick_quality, 10\n")
self.file.write("ray\n")


##################################################################################################

# Create Rex Macro for PyMol 

#create file

self.file = open('rex.pml', 'w')

self.file.write("bg_color white\n")
self.file.write("color gray90\n")
self.file.write("hide all\n")
self.file.write("show ribbon\n")

max_rex = 0

#find max Rex
for spin, spin_id in spin_loop(return_id=True):

            if  hasattr(spin, 'rex'):

                  if not spin.rex == None:
                       if spin.rex > max_rex:
                             max_rex = spin.rex 


for spin, spin_id in spin_loop(return_id=True):

#select residue
            spin_no = spin_id[spin_id.index(':')+1:spin_id.index('&')]
#ribbon color
            if  hasattr(spin, 'rex'):
                rex = str(spin.rex)
                if spin.rex == None:
                        self.file.write("")
                else:
                        rel_rex = spin.rex / max_rex
                        width = ((rel_rex) * 2)
                        green = ((rel_rex)) 
                        green = green * green * green #* green * green
                        green = 1 - green
                        self.file.write("set_color resicolor" + spin_no + ", 
[0," + str(green) + ",1]\n")
                        self.file.write("color resicolor" + spin_no + ", resi 
" + spin_no + "\n")
                        self.file.write("set_bond stick_radius, " + 
str(width) + ", resi " + spin_no + "\n")



self.file.write("hide all\n")
self.file.write("show sticks, name C+N+CA\n")
self.file.write("set stick_quality, 10\n")
self.file.write("ray\n")



##################################################################################################


print ""
print ""
print " ---------- done ----------------"
print ""
print ""
print "Grace Plots are in Folder /grace/"
print ""
print "Signle Text Files for Relaxation Parameters are in Folder 
/final_results/"
print ""
print "Diffusion Tensor is in current Folder"
print ""
print "PyMol Macros are in current Folder - execute in PyMol with Command:"
print "@rex.pml and @s2.pml"





Related Messages


Powered by MHonArc, Updated Thu Sep 17 03:00:37 2009