In [1]:
%autosave 0
from __future__ import print_function
We will now search for a double-stranded motif within the crystal structure of the large ribosomal subunit.
This can be performed using the ds_motif
function, that is very similar to the function ss_motif
.
It is necessary to specify the number of nucleotides in the first (l1) and second (l2) strand.
It is possible to specify the maximum number of allowed inserted or bulged residues with the option bulges.
In the example we use a threshold in ERMSD of 0.6 - relevant hits have a distance between 0.6-0.9 eRMSD.
If you specify the optional keyword out, PDB structures are written to disk.
By default the search is performed not considering the sequence. It is possible to specify a sequence with the sequence option. abbreviations (i.e N/R/Y) are accepted.
In [2]:
import barnaba as bb
# find all SARCIN motifs in H.Marismortui large ribosomal subunit (PDB 1S72)
query = "../test/data/SARCIN.pdb"
pdb = "../test/data/1S72.pdb"
# call function.
results = bb.ds_motif(query,pdb,l1=8,l2=7,bulges=0,threshold=0.7,out='sarcin_motif')
Now we print distances and sequences
In [3]:
import glob
pdbs = glob.glob("sarcin*.pdb")
for j in range(len(results)):
seq = ",".join([r for r in results[j][2]])
print("%2d eRMSD:%5.3f" % (j,results[j][1]))
print(" Sequence: %s" % seq)
Finally, we visualize the query and the first hit
In [4]:
import py3Dmol
query_s = open(query,'r').read()
hit_1 = open(pdbs[1],'r').read()
p = py3Dmol.view(width=900,height=600,viewergrid=(1,2))
#p = py3Dmol.view(width=900,height=600)
#p.addModel(query_s,'pdb')
p.addModel(query_s,'pdb',viewer=(0,0))
p.addModel(hit_1,'pdb',viewer=(0,1))
p.setStyle({'stick':{}})
p.setBackgroundColor('0xeeeeee')
p.zoomTo()
p.show()
Out[4]:
In [5]:
# annotate native
stackings_query, pairings_query, res_query = bb.annotate(query)
print("Query BASE-PAIR")
for p in range(len(pairings_query[0][0])):
print(res_query[pairings_query[0][0][p][0]], end=" ")
print(res_query[pairings_query[0][0][p][1]], end=" ")
print(pairings_query[0][1][p])
print()
stackings_hit, pairings_hit, res_hit = bb.annotate(pdbs[1])
print("Hit 2 base-pairs")
for p in range(len(pairings_hit[0][0])):
print(res_hit[pairings_hit[0][0][p][0]], end=" ")
print(res_hit[pairings_hit[0][0][p][1]], end=" ")
print(pairings_hit[0][1][p])
print()