RNA PDB Tools

rna_pdb_toolsx

rna_pdb_toolsx - a swiss army knife to manipulation of RNA pdb structures

Tricks:

for i in *pdb; do rna_pdb_toolsx.py –get-rnapuzzle-ready $i > ${i/.pdb/_rpr.pdb}; done

Usage:

$ for i in *pdb; do rna_pdb_toolsx.py --delete A:46-56 $i > ../rpr_rm_loop/$i ; done

 $ rna_pdb_toolsx.py --get-seq *
 # BujnickiLab_RNApuzzle14_n01bound
 > A:1-61
 # BujnickiLab_RNApuzzle14_n02bound
 > A:1-61
 CGUUAGCCCAGGAAACUGGGCGGAAGUAAGGCCCAUUGCACUCCGGGCCUGAAGCAACGCG
 [...]

usage: rna_pdb_toolsx.py [-h] [--version] [-r] [--renum-atoms]
                         [--delete-anisou] [--split-alt-locations] [-c]
                         [--is-pdb] [--is-nmr] [--nmr-dir NMR_DIR] [--un-nmr]
                         [--orgmode] [--get-chain GET_CHAIN] [--fetch]
                         [--fetch-ba] [--get-seq] [--hide-warnings]
                         [--compact] [--get-ss] [--rosetta2generic]
                         [--get-rnapuzzle-ready] [--rpr] [--no-hr]
                         [--renumber-residues] [--dont-rename-chains]
                         [--dont-fix-missing-atoms]
                         [--dont-report-missing-atoms] [--collapsed-view]
                         [--cv] [-v] [--replace-hetatm] [--inplace]
                         [--mutate MUTATE] [--edit EDIT]
                         [--rename-chain RENAME_CHAIN]
                         [--swap-chains SWAP_CHAINS]
                         [--replace-chain REPLACE_CHAIN] [--delete DELETE]
                         [--extract EXTRACT] [--uniq UNIQ] [--chain-first]
                         [--oneline] [--fasta]
                         file [file ...]
Positional arguments:
file file
Options:
--version Undocumented
-r=False, --report=False
 get report
--renum-atoms=False
 renumber atoms, tested with –get-seq
--delete-anisou=False
 remove files with ANISOU records, works with –inplace
--split-alt-locations=False
 @todo
-c=False, --clean=False
 get clean structure
--is-pdb=False check if a file is in the pdb format
--is-nmr=False check if a file is NMR-style multiple model pdb
--nmr-dir make NMR-style multiple model pdb file from a set of files rna_pdb_toolsx.py –nmr-dir . ‘cwc15_u5_fragments*.pdb’ > ~/Desktop/cwc15-u5.pdb please use ‘’ for pattern file recognition, this is a hack to deal with folders with thousands of models, if you used only *.pdb then the terminal will complain that you selected to many files.
--un-nmr=False split NMR-style multiple model pdb files into individual models [biopython]
--orgmode=False
 get a structure in org-mode format <sick!>
--get-chain get chain, one or many, e.g, A, but now also ABC works
--fetch=False fetch file from the PDB db
--fetch-ba=False
 fetch biological assembly from the PDB db
--get-seq=False
 get seq
--hide-warnings=False
 hide warnings, works with –get-chain, it hides warnings that given changes are not detected in a PDB file
--compact=False
 with –get-seq, get it in compact view’ $ rna_pdb_toolsx.py –get-seq –compact *.pdb # 20_Bujnicki_1 ACCCGCAAGGCCGACGGCGCCGCCGCUGGUGCAAGUCCAGCCACGCUUCGGCGUGGGCGCUCAUGGGU # A:1-68 # 20_Bujnicki_2 ACCCGCAAGGCCGACGGCGCCGCCGCUGGUGCAAGUCCAGCCACGCUUCGGCGUGGGCGCUCAUGGGU # A:1-68 # 20_Bujnicki_3 ACCCGCAAGGCCGACGGCGCCGCCGCUGGUGCAAGUCCAGCCACGCUUCGGCGUGGGCGCUCAUGGGU # A:1-68 # 20_Bujnicki_4
--get-ss=False get secondary structure
--rosetta2generic=False
 convert ROSETTA-like format to a generic pdb
--get-rnapuzzle-ready=False
 get RNApuzzle ready (keep only standard atoms).’ Be default it does not renumber residues, use –renumber-residues [requires BioPython]
--rpr=False alias to get_rnapuzzle ready)
--no-hr=False do not insert the header into files
--renumber-residues=False
 by defult is false
--dont-rename-chains=False
 used only with –get-rnapuzzle-ready. By default: –get-rnapuzzle-ready rename chains from ABC.. to stop behavior switch on this option
--dont-fix-missing-atoms=False
 used only with –get-rnapuzzle-ready
--dont-report-missing-atoms=False
 used only with –get-rnapuzzle-ready
--collapsed-view=False
 Undocumented
--cv=False alias to collapsed_view
-v=False, --verbose=False
 tell me more what you’re doing, please!
--replace-hetatm=False
 replace ‘HETATM’ with ‘ATOM’ [tested only with –get-rnapuzzle-ready]
--inplace=False
 in place edit the file! [experimental, only for get_rnapuzzle_ready, delete, –get-ss, –get-seq, –edit-pdb]
--mutate mutate residues, e.g. A:1A+2A+3A+4A,B:1A to mutate the first nucleotide of the A chain to Adenine etc and the first nucleotide of the B chain
--edit= edit ‘A:6>B:200’, ‘A:2-7>B:2-7’
--rename-chain edit ‘A>B’ to rename chain A to chain B
--swap-chains B>A, rename A to _, then B to A, then _ to B
--replace-chain=
 a file PDB name with one chain that will be used to replace the chain in the original PDB file, the chain id in this file has to be the same with the chain id of the original chain
--delete= delete the selected fragment, e.g. A:10-16, or for more than one fragment –delete ‘A:1-25+30-57’
--extract= extract the selected fragment, e.g. A:10-16, or for more than one fragment –extract ‘A:1-25+30-57’
--uniq rna_pdb_toolsx.py –get-seq –uniq ‘[:5]’ –compact –chain-first * | sort A:1-121 ACCUUGCGCAACUGGCGAAUCCUGGGGCUGCCGCCGGCAGUACCC…CA # rp13nc3295_min.out.1 A:1-123 ACCUUGCGCGACUGGCGAAUCCUGAAGCUGCUUUGAGCGGCUUCG…AG # rp13cp0016_min.out.1 A:1-123 ACCUUGCGCGACUGGCGAAUCCUGAAGCUGCUUUGAGCGGCUUCG…AG # zcp_6537608a_ALL-000001_AA A:1-45 57-71 GGGUCGUGACUGGCGAACAGGUGGGAAACCACCGGGGAGCGACCCGCCGCCCGCCUGGGC # solution
--chain-first=False
 Undocumented
--oneline=False
 Undocumented
--fasta=False with –get-seq, show sequences in fasta format, can be combined with –compact (mind, chains will be separated with ‘ ‘ in one line) $ rna_pdb_toolsx.py –get-seq –fasta –compact input/20_Bujnicki_1.pdb > 20_Bujnicki_1 ACCCGCAAGGCCGACGGC GCCGCCGCUGGUGCAAGUCCAGCCACGCUUCGGCGUGGGCGCUCAUGGGU

get RNAPuzzle ready

class rna_tools.rna_tools_lib.RNAStructure(fn)[source]

RNAStructure - handles an RNA pdb file.

Atributes:

fn (string) : filename of the pdb file lines (list) : the PDB file is loaded and ATOM/HETATM/TER/END go to self.lines
get_rnapuzzle_ready(renumber_residues=True, fix_missing_atoms=True, rename_chains=True, report_missing_atoms=True, verbose=True)[source]

Get rnapuzzle (SimRNA) ready structure.

Clean up a structure, get current order of atoms.

Parameters:
  • renumber_residues – boolean, from 1 to …, second chain starts from 1 etc.
  • fix_missing_atoms – boolean, superimpose motifs from the minilibrary and copy-paste missing atoms, this is super crude, so should be used with caution.

Submission format @http://ahsoka.u-strasbg.fr/rnapuzzles/

Run rna_tools.rna_tools.lib.RNAStructure.std_resn() before this function to fix names.

  • 170305 Merged with get_simrna_ready and fixing OP3 terminal added
  • 170308 Fix missing atoms for bases, and O2’
_images/fix_missing_o_before_after.png

Fig. Add missing O2’ atom (before and after).

_images/fix_missing_superposition.png

Fig. The residue to fix is in cyan. The G base from the library in red. Atoms O4’, C2’, C1’ are shared between the sugar (in cyan) and the G base from the library (in red). These atoms are used to superimpose the G base on the sugar, and then all atoms from the base are copied to the residues.

_images/fix_missing_bases.png

Fig. Rebuild ACGU base-less. It’s not perfect but good enough for some applications.

Warning

It was only tested with the whole base missing!

Warning

requires: Biopython

get sequence

Example:

$ rna_pdb_toolsx.py --get-seq 5_solution_1.pdb
> 5_solution_1.pdb A:1-576
CAUCCGGUAUCCCAAGACAAUCUCGGGUUGGGUUGGGAAGUAUCAUGGCUAAUCACCAUGAUGCAAUCGGGUUGAACACUUAAUUGGGUUAAAACGGUGGGGGACGAUCCCGUAACAUCCGUCCUAACGGCGACAGACUGCACGGCCCUGCCUCAGGUGUGUCCAAUGAACAGUCGUUCCGAAAGGAAG
class rna_tools.rna_tools_lib.RNAStructure(fn)[source]

RNAStructure - handles an RNA pdb file.

Atributes:

fn (string) : filename of the pdb file lines (list) : the PDB file is loaded and ATOM/HETATM/TER/END go to self.lines
get_seq(compact=False, chainfirst=False, fasta=False)[source]

Get seq (v2) gets segments of chains with correct numbering

Run:

python rna_pdb_seq.py input/1ykq_clx.pdb
> 1ykq_clx A:101-111
GGAGCUCGCCC
> 1ykq_clx B:201-238
GGGCGAGGCCGUGCCAGCUCUUCGGAGCAAUACUCGGC

> 6_solution_0 A:1-19 26-113 117-172
GGCGGCAGGUGCUCCCGACGUCGGGAGUUAAAAGGGAAG

Chains is {'A': {'header': 'A:1-19 26-113 117-172', 'resi': [1, 2, 3, ...,         19, 26, 27, ..., 172], 'seq': ['G', 'G', 'C', 'G', ... C', 'G', 'U', 'C']}}

Chains are in other as the appear in the file.

Warning

take only ATOM and HETATM lines.

fetch

Example:

$ rna_pdb_toolsx.py --fetch 1xjr
downloading...1xjr ok
rna_tools.rna_tools_lib.fetch(pdb_id, path='.')[source]

fetch pdb file from RCSB.org https://files.rcsb.org/download/1Y26.pdb

fetch Biological Assembly

Example:

$ rna_pdb_toolsx.py --fetch-ba 1xjr
downloading...1xjr_ba.pdb ok

or over a list of pdb ids in a text file:

$ cat data/pdb_ids.txt
1y26
1fir

$ while read p; do rna_pdb_toolsx.py --fetch-ba $p; done < data/pdb_ids.txt
downloading...1y26_ba.pdb ok
downloading...1fir_ba.pdb ok

$ ls *.pdb
1fir_ba.pdb 1y26_ba.pdb
rna_tools.rna_tools_lib.fetch_ba(pdb_id, path='.')[source]

fetch biological assembly pdb file from RCSB.org

>>> fetch_ba('1xjr')
...

delete

Examples:

$ for i in *pdb; do rna_pdb_toolsx.py --delete A:46-56 $i > ../rpr_rm_loop/$i ; done

go over all files in the current directory, remove a fragment of chain A, residues between 46-56 (including them) and save outputs to in the folder rpr_rm_loops.

edit

rna_tools.rna_tools_lib.edit_pdb(f, args)[source]

Edit your structure.

The function can take A:3-21>A:1-19 or even syntax like this A:3-21>A:1-19,B:22-32>B:20-30 and will do an editing.

The output is printed, line by line. Only ATOM lines are edited!

Examples:

$ rna_pdb_toolsx.py --edit 'A:3-21>A:1-19' 1f27_clean.pdb > 1f27_clean_A1-19.pdb

or even:

$ rna_pdb_toolsx.py --edit 'A:3-21>A:1-19,B:22-32>B:20-30' 1f27_clean.pdb > 1f27_clean_renumb.pdb

the library

rna_tools_lib.py - main lib file, many tools in this lib is using this file.

class rna_tools.rna_tools_lib.RNAStructure(fn)[source]

RNAStructure - handles an RNA pdb file.

Atributes:

fn (string) : filename of the pdb file lines (list) : the PDB file is loaded and ATOM/HETATM/TER/END go to self.lines
edit_occupancy_of_pdb(txt, pdb, pdb_out, v=False)[source]

Make all atoms 1 (flexi) and then set occupancy 0 for seletected atoms. Return False if error. True if OK

fix_O_in_UC()[source]
fix_op_atoms()[source]

Replace OXP’ to OPX1, e.g (‘O1P’ -> ‘OP1’)

fix_with_qrnas(outfn='', verbose=False)[source]

Add missing heavy atom.

A residue is recognized base on a residue names.

Copy QRNAS folder to curr folder, run QRNAS and remove QRNAS.

Warning

QRNAS required (http://genesilico.pl/QRNAS/QRNAS.tgz)

get_all_chain_ids()[source]
Returns:chain ids, e.g. set([‘A’, ‘B’])
Return type:set
get_atom_code(line)[source]

Get atom code from a line of a PDB file

get_atom_coords(line)[source]

Get atom coordinates from a line of a PDB file

get_atom_num(line)[source]

Extract atom number from a line of PDB file :param * line = ATOM line from a PDB file:

Output:
  • atom number as an integer
get_info_chains()[source]

return A:3-21 B:22-32

get_report()[source]
Returns:report, messages collected on the way of parsing this file
Return type:string
get_res_code(line)[source]

Get residue code from a line of a PDB file

get_res_num(line)[source]

Extract residue number from a line of PDB file :param * line = ATOM line from a PDB file:

Output:
  • residue number as an integer
get_rnapuzzle_ready(renumber_residues=True, fix_missing_atoms=True, rename_chains=True, report_missing_atoms=True, verbose=True)[source]

Get rnapuzzle (SimRNA) ready structure.

Clean up a structure, get current order of atoms.

Parameters:
  • renumber_residues – boolean, from 1 to …, second chain starts from 1 etc.
  • fix_missing_atoms – boolean, superimpose motifs from the minilibrary and copy-paste missing atoms, this is super crude, so should be used with caution.

Submission format @http://ahsoka.u-strasbg.fr/rnapuzzles/

Run rna_tools.rna_tools.lib.RNAStructure.std_resn() before this function to fix names.

  • 170305 Merged with get_simrna_ready and fixing OP3 terminal added
  • 170308 Fix missing atoms for bases, and O2’
_images/fix_missing_o_before_after.png

Fig. Add missing O2’ atom (before and after).

_images/fix_missing_superposition.png

Fig. The residue to fix is in cyan. The G base from the library in red. Atoms O4’, C2’, C1’ are shared between the sugar (in cyan) and the G base from the library (in red). These atoms are used to superimpose the G base on the sugar, and then all atoms from the base are copied to the residues.

_images/fix_missing_bases.png

Fig. Rebuild ACGU base-less. It’s not perfect but good enough for some applications.

Warning

It was only tested with the whole base missing!

Warning

requires: Biopython

get_seq(compact=False, chainfirst=False, fasta=False)[source]

Get seq (v2) gets segments of chains with correct numbering

Run:

python rna_pdb_seq.py input/1ykq_clx.pdb
> 1ykq_clx A:101-111
GGAGCUCGCCC
> 1ykq_clx B:201-238
GGGCGAGGCCGUGCCAGCUCUUCGGAGCAAUACUCGGC

> 6_solution_0 A:1-19 26-113 117-172
GGCGGCAGGUGCUCCCGACGUCGGGAGUUAAAAGGGAAG

Chains is {'A': {'header': 'A:1-19 26-113 117-172', 'resi': [1, 2, 3, ...,         19, 26, 27, ..., 172], 'seq': ['G', 'G', 'C', 'G', ... C', 'G', 'U', 'C']}}

Chains are in other as the appear in the file.

Warning

take only ATOM and HETATM lines.

get_text(add_end=True)[source]

works on self.lines.

is_amber_like()[source]

Use self.lines and check if there is XX line

is_mol2()[source]

Return True if is_mol2 based on the presence of `@<TRIPOS>`.

is_nmr()[source]

True if the file is an NMR-style multiple model pdb

Returns:True or Fo
Return type:boolean
is_pdb()[source]

Return True if the files is in PDB format.

If self.lines is empty it means that nothing was parsed into the PDB format.

remove(verbose)[source]

Delete file, self.fn

remove_ion()[source]

TER 1025 U A 47 HETATM 1026 MG MG A 101 42.664 34.395 50.249 1.00 70.99 MG HETATM 1027 MG MG A 201 47.865 33.919 48.090 1.00 67.09 MG

rtype:object
remove_water()[source]

Remove HOH and TIP3

renum_atoms()[source]

Renum atoms, from 1 to X for line; ATOM/HETATM

set_atom_occupancy(line, occupancy)[source]

set occupancy for line

set_occupancy_atoms(occupancy)[source]
Parameters:occupancy
std_resn()[source]

‘Fix’ residue names which means to change them to standard, e.g. RA5 -> A

Works on self.lines, and returns the result to self.lines.

Will change things like:

# URI -> U, URA -> U
1xjr_clx_charmm.pdb:ATOM    101  P   URA A   5      58.180  39.153  30.336  1.00 70.94
rp13_Dokholyan_1_URI_CYT_ADE_GUA_hydrogens.pdb:ATOM  82  P   URI A   4     501.633 506.561 506.256  1.00  0.00         P
un_nmr(startwith1=False, verbose=False)[source]

Un NMR - Split NMR-style multiple model pdb files into individual models.

Take self.fn and create new files in the way:

input/1a9l_NMR_1_2_models.pdb
   input/1a9l_NMR_1_2_models_0.pdb
   input/1a9l_NMR_1_2_models_1.pdb

Warning

This function requires biopython.

write(outfn, v=True)[source]

Write `self.lines` to a file (and END file”)

rna_tools.rna_tools_lib.collapsed_view(args)[source]

Collapsed view of pdb file. Only lines with C5’ atoms are shown and TER, MODEL, END.

example:

[mm] rna_tools git:(master) $ python rna-pdb-tools.py --cv input/1f27.pdb
ATOM      1  C5'   A A   3      25.674  19.091   3.459  1.00 16.99           C
ATOM     23  C5'   C A   4      19.700  19.206   5.034  1.00 12.65           C
ATOM     43  C5'   C A   5      14.537  16.130   6.444  1.00  8.74           C
ATOM     63  C5'   G A   6      11.726  11.579   9.544  1.00  9.81           C
ATOM     86  C5'   U A   7      12.007   7.281  13.726  1.00 11.35           C
ATOM    106  C5'   C A   8      12.087   6.601  18.999  1.00 12.74           C
TER
rna_tools.rna_tools_lib.edit_pdb(f, args)[source]

Edit your structure.

The function can take A:3-21>A:1-19 or even syntax like this A:3-21>A:1-19,B:22-32>B:20-30 and will do an editing.

The output is printed, line by line. Only ATOM lines are edited!

Examples:

$ rna_pdb_toolsx.py --edit 'A:3-21>A:1-19' 1f27_clean.pdb > 1f27_clean_A1-19.pdb

or even:

$ rna_pdb_toolsx.py --edit 'A:3-21>A:1-19,B:22-32>B:20-30' 1f27_clean.pdb > 1f27_clean_renumb.pdb
rna_tools.rna_tools_lib.fetch(pdb_id, path='.')[source]

fetch pdb file from RCSB.org https://files.rcsb.org/download/1Y26.pdb

rna_tools.rna_tools_lib.fetch_ba(pdb_id, path='.')[source]

fetch biological assembly pdb file from RCSB.org

>>> fetch_ba('1xjr')
...
rna_tools.rna_tools_lib.fetch_cif_ba(cif_id, path='.')[source]

fetch biological assembly cif file from RCSB.org

rna_tools.rna_tools_lib.get_version(currfn='', verbose=False)[source]

Get version of the tool based on state of the git repository. Return version. If currfn is empty, then the path is ‘.’. Hmm.. I think it will work. We will see. The version is not printed! https://github.com/m4rx9/curr_version/

rna_tools.rna_tools_lib.replace_chain(struc_fn, insert_fn, chain_id)[source]

Replace chain of the main file (struc_fn) with some new chain (insert_fn) of given chain id.

Parameters:
  • struc_fn (str) – path to the main PDB file
  • insert_fn (str) – path to the file that will be injected in into the main PDB file
  • chain_id (str) – chain that will be inserted into the main PDB file
Returns:

text in the PDB format

Return type:

string

rna_tools.rna_tools_lib.sort_strings(l)[source]

Sort the given list in the way that humans expect. http://blog.codinghorror.com/sorting-for-humans-natural-sort-order/

PDB Edit Bfactor/Occupancy

rna_pdb_edit_occupancy_bfactor.py - edit occupancy or bfactor in PDB file.

Example:

rna_pdb_edit_occupancy_bfactor.py --occupancy --select A:1-40,B:1-22 \
                                 --set-to 0 \
                                 19_Bujnicki_Human_4_rpr_n0-000001.pdb


rna_pdb_edit_occupancy_bfactor.py --occupancy \
                                  --select A:1-2 \
                                  --select-atoms P+C4\' \
                                  --set-to 10 \
                                  -o test_data/3w3s_homologymodel_out.PD
                                  --set-not-selected-to 8
                                  test_data/3w3s_homologymodel.pdb

usage: rna_pdb_edit_occupancy_bfactor.py [-h] (--bfactor | --occupancy)
                                         [--select SELECT] [--set-to SET_TO]
                                         [--set-not-selected-to SET_NOT_SELECTED_TO]
                                         [-o OUTPUT] [--verbose]
                                         [--select-atoms SELECT_ATOMS]
                                         file
Positional arguments:
file file
Options:
--bfactor=False
 set bfactor
--occupancy=False
 set occupancy
--select get chain, e.g A:1-10, works also for multiple chainse.g A:1-40,B:1-22
--set-to=1 set value to, default is 1
--set-not-selected-to=0
 set value to, default is 0
-o, --output file output
--verbose=False
 be verbose
--select-atoms select only given atomscan be only one atom, e.g. Por more, use ' for prims, e.g. P+C4'
rna_tools.tools.rna_pdb_edit_occupancy_bfactor.rna_pdb_edit_occupancy_bfactor.edit_occupancy_of_pdb(txt, pdb, pdb_out, bfactor, occupancy, set_to, set_not_selected_to, select_atoms, v=False)[source]

Change ouccupancy or bfactor of pdb file.

Load the structure, and first set everything to be set_not_selected_to and then set selected to sel_to.

Parameters:
  • txt (str) – A:1-10, selection, what to change
  • pdb (str) – filename to read as an input
  • pdb_out (str) – filename to save an output
  • bfactor (bool) – if edit bfactor
  • occupancy (bool) – if edit occupancy
  • set_to (float) – set to this value, if within selection
  • set_not_selected_to (float) – set to this value, if not within selection
  • select_atoms (str) – P, P+C4’, use + as a separator
  • v (bool) – be verbose
Returns:

if OK, save an output to pdb_out

Return type:

bool

Warning

this function requires BioPython

Add chain to a file

Example:

./rna_add_chain.py -c X ../../input/1msy_rnakbmd_decoy999_clx_noChain.pdb     > ../../output/1msy_rnakbmd_decoy999_clx_noChain_Xchain.pdb

From:

ATOM      1  O5'   U     1      42.778  25.208  46.287  1.00  0.00
ATOM      2  C5'   U     1      42.780  26.630  45.876  1.00  0.00
ATOM      3  C4'   U     1      42.080  27.526  46.956  1.00  0.00
ATOM      4  O4'   U     1      43.013  28.044  47.963  1.00  0.00
ATOM      5  C1'   U     1      42.706  29.395  48.257  1.00  0.00
ATOM      6  N1    U     1      43.857  30.305  47.703  1.00  0.00
ATOM      7  C6    U     1      45.057  29.857  47.308  1.00  0.00
ATOM      8  C5    U     1      46.025  30.676  46.763  1.00  0.00
ATOM      9  C4    U     1      45.720  32.110  46.702  1.00  0.00
ATOM     10  O4    U     1      46.444  32.975  46.256  1.00  0.00

to:

ATOM      1  O5'   U X   1      42.778  25.208  46.287  1.00  0.00
ATOM      2  C5'   U X   1      42.780  26.630  45.876  1.00  0.00
ATOM      3  C4'   U X   1      42.080  27.526  46.956  1.00  0.00
ATOM      4  O4'   U X   1      43.013  28.044  47.963  1.00  0.00
ATOM      5  C1'   U X   1      42.706  29.395  48.257  1.00  0.00
ATOM      6  N1    U X   1      43.857  30.305  47.703  1.00  0.00
ATOM      7  C6    U X   1      45.057  29.857  47.308  1.00  0.00
ATOM      8  C5    U X   1      46.025  30.676  46.763  1.00  0.00
ATOM      9  C4    U X   1      45.720  32.110  46.702  1.00  0.00
ATOM     10  O4    U X   1      46.444  32.975  46.256  1.00  0.00
rna_tools.tools.misc.rna_add_chain.get_parser()[source]
usage: rna_add_chain [-h] [-c CHAIN] file
Positional arguments:
file file
Options:
-c, --chain a new chain, e.g. A

Measure distance between atoms

This is a quick and dirty method of comparison two RNA structures (stored in pdb files). It measures the distance between the relevan atoms (C4’) for nucleotides defined as “x” in the sequence alignment.

author: F. Stefaniak, modified by A. Zyla, supervision of mmagnus

usage: pdbs_measure_atom_dists [-h] [-v] seqid1 seqid2 alignfn pdbfn1 pdbfn2
Positional arguments:
seqid1 seq1 id in the alignemnt
seqid2 seq2 id in the alignemnt
alignfn alignemnt in the Fasta format
pdbfn1 pdb file1
pdbfn2 pdb file2
Options:
-v=False, --verbose=False
 increase output verbosity

This is a quick and dirty method of comparison two RNA structures (stored in pdb files). It measures the distance between the relevan atoms (C4’) for nucleotides defined as “x” in the sequence alignment.

author: F. Stefaniak, modified by A. Zyla, supervision of mmagnus

rna_tools.tools.pdbs_measure_atom_dists.pdbs_measure_atom_dists.find_core(seq_with_gaps1, seq_with_gaps2)[source]

.

Parameters:
  • seq_with_gaps1 (str) – a sequence 1 from the alignment
  • seq_with_gaps1 – a sequence 2 from the alignment

Usage:

>>> find_core('GUUCAG-------------------UGAC-', 'CUUCGCAGCCAUUGCACUCCGGCUGCGAUG')
'xxxxxx-------------------xxxx-'
Returns:core=”xxxxxx——————-xxxx-“
rna_tools.tools.pdbs_measure_atom_dists.pdbs_measure_atom_dists.get_parser()[source]
rna_tools.tools.pdbs_measure_atom_dists.pdbs_measure_atom_dists.get_seq(alignfn, seqid)[source]

Get seq from an alignment with gaps.

Parameters:
  • alignfn (str) – a path to an alignment
  • seqid (str) – seq id in an alignment

Usage:

>>> get_seq('test_data/ALN_OBJ1_OBJ2.fa', 'obj1')
SeqRecord(seq=SeqRecord(seq=Seq('GUUCAG-------------------UGAC-', SingleLetterAlphabet()), id='obj1', name='obj1', description='obj1', dbxrefs=[]), id='<unknown id>', name='<unknown name>', description='<unknown description>', dbxrefs=[])
Returns:SeqRecord
rna_tools.tools.pdbs_measure_atom_dists.pdbs_measure_atom_dists.map_coords_atom(structure)[source]

.

Args: structure (pdb): PDB Biopython object: with a pdb structure

Returns:a list of coords for atoms structure1realNumber: a list of residues
Return type:struct1dict
rna_tools.tools.pdbs_measure_atom_dists.pdbs_measure_atom_dists.open_pdb(pdbfn)[source]

Open pdb with Biopython.

Parameters:pdbfn1 (str) – a path to a pdb structure
Returns:with a pdb structure
Return type:PDB Biopython object