Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mmagnus/rna-tools
Browse files Browse the repository at this point in the history
# Conflicts:
#	rna_tools/tools/PyMOL4RNA/PyMOL4RNA.py
  • Loading branch information
mmagnus committed Sep 26, 2024
2 parents a640dfb + a2a58cf commit 34f3b6f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
5 changes: 5 additions & 0 deletions docs/source/tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ To renumber residues::
Alter: modified 708 atoms.
PyMOL>sort

Renumber again, your chain starts at 123, renumber it, so it starts at 1.

PyMOL>alter (sele), resv -= 122
Alter: modified 2921 atoms.

Read more_.

.. _more: https://pymolwiki.org/index.php?title=Iterate&redirect=no
Expand Down
33 changes: 14 additions & 19 deletions rna_tools/tools/PyMOL4RNA/PyMOL4RNA.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,31 +602,26 @@ def clarna(selection, folder:str='', sele_as_name=False):# fn:str=''):
.. image:: ../../rna_tools/tools/PyMOL4RNA/doc/clarna.png
"""
# save the selection to a file
if sele_as_name:
output = folder + os.sep + strip_selection_name(selection).replace('resi ', '') + '.pdb' #
print(output)
# save the file
f = tempfile.NamedTemporaryFile(delete=False) # True)
if not folder:
output = f.name + '_clarna.pdb'
else:
f = tempfile.NamedTemporaryFile(delete=False) # True)
if not folder:
output = f.name + '_clarna.pdb'
else:
output= folder + os.sep + os.path.basename(f.name) + '_clarna.pdb'
f.close()
output= folder + os.sep + os.path.basename(f.name) + '_clarna.pdb'
cmd.save(output, selection)

# run the code
# run cmd
CLARNA_RUN = 'rna_clarna_run.py'
cmdline = BIN + CLARNA_RUN + " -ipdb " + output + ' -bp+stack'
cmdline = CLARNA_RUN + " -ipdb " + output + ' -bp+stack'
out, err = exe(cmdline)

# get the output
# get the output
print('\n'.join(out.split('\n')[1:])) # to remove first line of py3dna /tmp/xxx
if err: print(err)

# load a file
if err:
print(err)
# load a (sele) pdb file
cmd.load(output)

f.close()

cmd.extend('clarna', clarna) # export the function for pymol

def seq(selection):
"""Get sequence of the selected fragment using ``rna_pdb_tools.py --get_seq ``.
Expand Down

0 comments on commit 34f3b6f

Please sign in to comment.