Home
Tutorials
Concepts
Secondary Structure
FAQ
Commands
Python

Download
Installing
Examples
Contact

Online Submission

AMU Homepage

Commands



How to start?

Once ModeRNA is installed properly, all of the commands below are available. They can be used by:

  • Writing commands into a script and activating it by
    python my_script.py
  • Opening a shell by typing
    python
    and entering commands interactively.

In both cases, the first command has to be:

from moderna import *

Example files


add_all_modifications

add_all_modifications(template, alignment, model)

Adds all modifications that occur in the target sequence, and are not present in the template.

Arguments:
  • Template object
  • Alignment object
  • RnaModel object

add_all_modifications(t,a,m)

add_modification

add_modification(residue, modification_name, model=None, residue_number=None)

Adds a modification to a single residue. An RNAModel can be given optionally. If this is given, the modified residue is subsequently copied to it.

Note that deoxynucleotides count as modified bases as well.

Arguments:
  • residue from a Template or RNAModel object
  • modification name (abbreviated as e.g. 'm6Am', 'm1G', 'm3U', 'mnm5s2U')
  • model (optional; if this is given, the residue is copied)
  • residue position in model (optional; by default the residue number is kept)

# add a 2-methyl-Guanosine in position 63.
m  = load_model('1QF6_B_tRNA.pdb', 'B')
add_modification(m['63'], 'm2G')

add_pair_to_base

add_pair_to_base(model, anchor_id, new_id=None, new_sequence=None)

Adds Watson-Crick paired second strand to single nucleotide.

Arguments:
  • RNAModel object
  • Identifier of residue to which a new base pair will be added
  • New identifier for second strand
  • New sequence for second strand

add_pair_to_base(m, '2', '20', 'C')

analyze_geometry

analyze_geometry(struc, file_name=None)

Analyses geometry of a structure. Checks whether all angles and bonds length values are close to reference values determined from the PDB. Writes the result of the analysis to log file or to an output file when specified.

Arguments:
  • RNAModel object
  • Name of an output file

t = load_template('1QF6_B_tRNA.pdb', 'B')
analyze_geometry(t)

apply_alignment

apply_alignment(template, alignment, model)

Applies all operations on single bases that are in an alignment: Copying identical residues, exchanging mismatches, adding modifications, and removing modifications. As a result, all these residues are copied into a model (which may be empty). For gaps in the alignment, nothing is done.

Arguments:
  • Template object
  • Alignment object
  • RNAModel object

apply_alignment(t,a,m)

apply_all_indels

apply_all_indels(alignment, model)

Finds and inserts the best fragment candidate for each gap region in the alignment. This command can be used to fill in gaps automatically. The procedure automatically retrieves the 20 best fitting candidates from the fragment database, checks whether they produce any clashes upon insertion, and inserts the best scoring candidate.

It depends, however on
  • gaps being shorter than 17 bases.

System Message: WARNING/2 (<string>, line 11)

Bullet list ends without a blank line; unexpected unindent.

(if longer a database of fragments up to 100 nt is available)

Arguments:
  • Alignment object
  • RnaModel object

apply_all_indels(a,m)

apply_indel

apply_indel(model, res5_number, res3_number, sequence)

Finds the best fitting fragment between two residues, and inserts it into the model. The procedure automatically retrieves the 20 best fitting candidates from the fragment database, checks whether they produce any clashes upon insertion, and inserts the best scoring candidate.

Arguments:
  • RNAmodel object
  • number of the residue on the 5' end of the fragment
  • number of the residue on the 3' end of the fragment
  • sequence of the fragment (not including the two residues specified above).

# prepare a model
t = load_template('1QF6_B_tRNA.pdb', 'B')
m = create_model()
copy_some_residues(t['31':'35']+t['38':'42'],m)

# Find the best fitting fragment for the missing two
apply_indel(m, '35', '38', 'CA')

apply_missing_ends

apply_missing_ends(alignment, model)

Attaches an extended fragment of structure at both the 5' and 3' ends of the target, where there is no corresponding part in the template.

Arguments:
  • Alignment object
  • model

apply_missing_ends(a, m)

change_sequence

change_sequence(struc, sequence)

Changes the entire sequence of the given structure object, exchanging all nucleotides that differ.

Arguments:
  • Structure object (RnaModel or Template)
  • sequence

change_sequence(m, 'AGCUAGCU')

clean_structure

clean_structure(structure, write_structure=False)

Eliminates features that may cause problems during modeling from a template or model structure:
  • water molecules, ions, amino acids, and unidentified residues are deleted.
  • old atom names are replaced (C1* becomes C1', O1P becomes OP1).
  • missing phosphate groups are added (also adds the OP3 atom for these)
  • reports whether the chain is continuous.

In case some feature cannot be fixed (e.g. chain discontinuity) this is written to the logfile. It is recommended to include such features in the alignment ('.' characters for strange residues, and '_' for backbone breaks).

Arguments:
  • Stucture object (RnaModel or Template)
  • True/False - whether structure should be written to a PDB file (optional)

# cleaning up a loaded template:
# removes water, ions, amino acids, and unknown residues
# replaces O1P and O2P in atom names by OP1 and OP2
# replaces * in atom names by '
clean_structure(t)

copy_identical_residues

copy_identical_residues(template, alignment, model, strict=True, modifications=True)

Copies all bases identical identical in the alignment from the template structure to a model. The residue numbers do not change.

Arguments:
  • Template object
  • Alignment object
  • RnaModel object
  • strict=1 complains and stops on any problem encountered (default); strict=0 goes on if single residues fail to be copied
  • modifications=0 does not copy modified bases; modifications=1 is default.

copy_identical_residues(t,a,m)
copy_identical_residues(t,a,m,strict=0)
copy_identical_residues(t,a,m,modifications=0)

copy_single_residue

copy_single_residue(residue, model, new_number=None, strict=True)

Copies a single residue into the model. The residue can be taken from a Template, or another RnaModel.

Residues are specified by their PDB residue number in quotes and square brackets, e.g. template['5']. eventually accompanied by the insertion letter (abbreviated as number). By default, the number of the residue is kept, but it can be given optionally.

Arguments:
  • Residue from a Template or RnaModel
  • RnaModel object
  • new residue number in the model (optional)
  • strict=1 complains when a residue with the given number exists already (default); strict=0 copies anyway

copy_single_residue(t['3'],m)
copy_single_residue(t['5A'],m)
copy_single_residue(t['3'],m,'15')
copy_single_residue(m['5A'],m,'100')
copy_single_residue(t['3'],m,'3B',strict=0)

copy_some_residues

copy_some_residues(residue_list, model, new_numbers=None, strict=True)

Copies a set of residues into the model. The residues can be taken from a Template, or another RnaModel.

Residues are specified by enumerating their numbers in the PDB files, or specifying a range of numbers (by 'num1':'num2'). By default, the numbers of the residues are kept, but they can be given optionally. Note that all residue numbers in ModeRNA have to be quoted.

Arguments:
  • List of residues from a Template or RnaModel
  • RnaModel object
  • List of new residue numbers in the model (optional)
  • strict=1 complains when a residue with the given number exists already (default); strict=0 copies anyway

copy_some_residue(t['3':'5'],m)
copy_some_residue(t['3':'5A'],m)
copy_some_residue([t['3'],t['7'],t['8']],m)
copy_some_residue([t['3'],t['7']],m,new_numbers=['100','101'])
copy_some_residue(t['3':'12'],m,strict=0)

create_fragment

create_fragment(pdb_path, anchor5=None, anchor3=None, chain_name='A', sequence=None)

To insert small pieces of custom PDB structures into models, fragments can be used. This command loads a fragment, and defines one or two connection points, to which the fragment will be inserted by superposition. It returns a ModernaFragment object.

To add a ModernaFragment object to a model, the insert_fragment command should be used. The scenarios for adding either involve superposition of a single residue with the model on the 5' end of the fragment, or on the 3' end, or both.

Arguments:
  • path to pdb file with the fragment
  • residue to which the 5' end of the fragment will be superimposed
  • residue to which the 3' end of the fragment will be superimposed
  • chain name of the fragment in the file (optional; A by default)
  • sequence that should be modeled onto the fragment upon insertion (optional; the sequence should not include the 1-2 anchor residues, it therefore has to be shorter than the fragment)

f = create_fragment('single_strand.pdb',anchor5=m['20'])
f = create_fragment('single_strand.pdb', chain_name='A', anchor3=m['1'])
f = create_fragment('hairpin.pdb', anchor5=m['12'], anchor3=m['15'])
f = create_fragment('hairpin.pdb', anchor5=m['12'], anchor3=m['15'], sequence='AG')

create_model

create_model(template=None, alignment=None, model_chain_name=None)

Creates a RNA structure model. Produces a RnaModel object that can be saved in a variable (see example).

If no arguments are given, an empty RNAModel is created. If both a Template and an Alignment are given as arguments, the complete model is built automatically. The chain id that the model should have can be specified optionally.

Arguments:
  • Template object (optional)
  • Alignment object (optional)
  • chain id of the model to be built

m = create_model()
m = create_model(model_chain_name='K')
m = create_model(t,a)
m = create_model(t,a,model_chain_name='K')

delete_residue

delete_residue(residue_number, model)

Removes a residue from a RNAModel object.

Arguments:
  • residue identifier e.g. '1', '6', '6A'
  • RnaModel object

delete_residue('6',m)

examine_structure

examine_structure(structure)

Checks whether the given structure has any features that may cause any problems during the modeling process. The user needs to give a structure object, and optionally a name of the file the report is written to.

Arguments:
  • Stucture object
  • name of logfile (optional)

# examine a loaded template for irregularities:
examine_structure(t)
examine_structure(t,'logfile.log')

exchange_mismatches

exchange_mismatches(template, alignment, model)

Exchanges the bases for all standard base mismatches in an alignment. This applies all exchanges of one standard base by another. Modified bases are not changed (use the apply_alignment command for that).

Arguments:
  • Template object
  • Alignment object
  • RnaModel object

exchange_mismatches(t,a,m)

exchange_single_base

exchange_single_base(residue, new_name, model=None, new_number=None)

Exchanges standard RNA bases in a residue. This can be used to modify residues already in a model, or to exchange and copy them in one step, if an RnaModel is given. It is also possible to modify the template this way!

The residue number does not change by default, but a new one can be given.

Arguments:
  • Residues from a Template or RnaModel
  • Abbreviation of the new base ('A', 'G', 'C' or 'U')
  • RnaModel object (optional)
  • New residue number in the model (optional)

exchange_single_base(m['3'],'C')
exchange_single_base(t['3'],'G',m)
exchange_single_base(t['3'],'G',m,new_number='5A')
exchange_single_base(t['3'],'G') # modifies the template!

exchange_some_bases

exchange_some_bases(residue_list, new_names, model=None, new_numbers=None)

Exchanges standard RNA bases in a set of residues. This can be used to modify residues already in a model, or to exchange and copy them in one step, if a RNAModel is given. It is also possible to modify the template this way!

The residue numbers are not changed by default, but a list of new one can be given.

Arguments:
  • Residues from a Template or RnaModel
  • List of names of the new bases ('A', 'G', 'C' or 'U')
  • RnaModel object (optional)
  • New residue number in the model

exchange_some_bases(m['3':'5'],['C','U','G'])
exchange_some_bases(t['3':'5'],['C','U','G'],m)
exchange_some_bases([t['3'],t['10']],['A','G'],m,['103','106'])
exchange_some_bases(t['3':'5'],['C','U','G']) # modifies the template!

extend_helix

extend_helix(model, anchor5_id, anchor3_id, new_sequence=None)

Makes a helix longer by adding A-type RNA Watson-Crick base pairs. A helix of any size may be added to the model. A helix may be added at the end or inside an already existing helix.

Arguments:
  • Template or RnaModel
  • Identifier of the residue on the 5' side to which helix will be added
  • Identifier of the residue on the 3' side to which helix will be added
  • Helix sequence as Sequence obiect e.g. Sequence('AAAA_UUUU')

extend_helix(m, '2', '37', 'CGAA_UUCG')

find_clashes

find_clashes(residues)

Detects interatomic clashes (overlapping atom VdW radii) between atoms from two distinct residues. As input, a template, a model or a list of residues is taken.

Returns a list of clashing residue pairs. If no clashes are detected, the list is empty.

Arguments:
  • list of residues or ModernaStructure object

find_clashes(m)
find_clashes([m['5'], m['6'], m['7']])
pairs = find_clashes(m)

find_fragment

find_fragment(model, res5_number, res3_number, sequence, number_of_candidates=20, secstruc=None)

Searches fragment candidate structures that fit between two given residues. Produces a list of fragments candidate objects. The fragment search sorts candidates according to the geometrical fit of their backbones.

As an optional argument, a secondary structure can be specified in dot-bracket format. This restricts the found fragment candidates to those having exactly the same Watson-Crick pairs.

Arguments:
  • RnaModel object
  • number of the residue at the 5' end of the fragment
  • number of the residue at the 3' end of the fragment
  • sequence of the fragment to be inserted (not including the two residues above)
  • number of candidate fragments to be returned (default=20)
  • secondary structure of the fragment in dot-bracket format (optional).

candidates = find_fragment(m, '7', '12', 'AGCU', 20)
insert_fragment(m, candidates[0])

find_modifications

find_modifications(structure)

Reports all modified nucleotides that occur in a structure loaded or created with ModeRNA (models, templates).

This command returns all modified residues as a Python dictionary.
{'1':<res>, '6': <res>, '6a': <res>, ...}
Arguments:
  • RnaModel or Template object

# find modifications in any structure file
t = load_template('1QF6_B_tRNA.pdb', 'B')
print find_modifications(t)

fix_backbone

fix_backbone(structure)

Fixes interrupted backbones between adjacent residues.

This function either examines the backbone of all nt in a structure (and repairs them if broken), or only does this for the two residues specified. For repairing, first only the phosphate and adjacent oxygens are remodeled. In case this fails, the FCCD Loop Closing Algorithm (Boomsma/Hamelryck 2005) is used for the entire O3'..C4' segment. If the two residues are far from each other or oriented in a weird angle, the result will be awkward.

Arguments:
  • RnaModel object
  • residue number on the 5' side of the broken backbone (optional).
  • residue number on the 3' side of the broken backbone (optional).

m = load_model('broken_bb.pdb','A')
print m.get_sequence()

# check and fix the entire model
fix_backbone(m)
print m.get_sequence()

# check and fix the connection between residues 4 and 5
fix_backbone(m, '4', '5')

get_base_pairs

get_base_pairs(structure)

Returns a dictionary where keys are residues numbers and values are tuples which each one contains: - residue number interacting with the key-residue - interaction type

Arguments:
  • ModernaStructure object (template or model).

bp = get_base_pairs(struc)
print bp

get_secstruc

get_secstruc(structure)

Retrieves the dot-bracket secondary structure from the coordinates of a structure (template or model). Base pairs (only Watson-Crick pairings AU and GC, and GU Wobble pairs) are indicated by round brackets, all other residues by dots.

Arguments:
  • structure - a Template or RNAModel object

get_secstruc(t)
ss = get_secstruc(m)

get_sequence

get_sequence(structure)

Retrieves the one-letter-sequence from the coordinates of a structure (template or model). In the sequence, standard RNA bases are denoted by upper case letters, DNA bases by lowercase. For many modifications, one-letter ASCII abbreviations exist (according to McCloskey). All nucleotides that do not have a one-letter abbreviation are represented by the x letter. Nucleotides that cannot be recognized (e.g. base missing) are represented by the '.' character.

For determining the sequence, the residues are processed according to their numbers. If an unusually long bond is found anywhere in the backbone between two bases, an additional "_" symbol is inserted in the sequence to mark this discontinuity.

Also see http://www.genesilico.pl/modomics

Arguments:
  • structure - a Template or RnaModel object

get_sequence(t)
seq = get_sequence(m)

insert_fragment

insert_fragment(model, fragment)

Inserts a fragment object into the model. The model should be the same object, from which the two anchor residues were defined when the fragment was created. (See also documentation of the create_fragment/find_fragment functions.)

Arguments:
  • RnaModel object
  • ModernaFragment or LirHit object

insert_fragment(m,f)

insert_two_strand_fragment

insert_2D_fragment(model, anchor5_id, anchor3_id, anchor5_upper_id, anchor3_upper_id, frag_anchor5_id, frag_anchor3_id, frag_anchor5_upper_id, frag_anchor3_upper_id, fragment_file, chain_name='A')

Inserts a given 2D fragment between two pairs of indicated residues. Requires to indicate connecting residues from both model (4) and fragment (4).

Arguments:
  • model - RNAModel object
  • anchor5_id - anchor residue in the model on the 5' side of the fragment.
  • anchor3_id - anchor residue in the model on the 3' side of the fragment.
  • anchor5_upper_id - anchor residue in the model on the 5' side of the middle part of the fragment.
  • anchor3_upper_id - anchor residue in the model on the 3' side of the middle part of the fragment.
  • frag_anchor5_id - anchor residue in the fragment on the 5' side of the fragment.
  • frag_anchor3_id - anchor residue in the fragment on the 3' side of the fragment.
  • frag_anchor5_upper_id - anchor residue in the fragment on the 5' side of the middle part of the fragment.
  • frag_anchor3_upper_id - anchor residue in the fragment on the 3' side of the middle part of the fragment.
  • fragment_file - name of the fragment PDB file
  • chain_name - chain ID (default: 'A')

insert_two_strand_fragment(m, '2', '37', '5', '34',    '101', '120', '107', '114', 'my_fragment.pdb', 'A')
    # fragment candidates returned by find_fragment go as well
    insert_fragment(m, candidates[2])

load_alignment

load_alignment(file_path)

Loads a sequence alignment from a FASTA file. Produces an Alignment object that can be saved in a variable.

ModeRNA expects, that the alignment file contains exactly two sequences. The first is for the target for which the model is to be built, the second for the structural template.

Standard RNA bases should be written in upper case (ACGU). Standard DNA bases should be written in lower case (acgt). For modified bases, see the 'concepts' section of the manual.

Arguments:
  • path+filename of a FASTA file

a = load_alignment('alignment_1F1T.fasta')

load_model

load_model(file_path, chain_name='A', data_type='file', template=None, alignment=None)

Loads a structure model that has been built previously, or any PDB struture that is then to be modified. Produces a RnaModel object that can be saved in a variable. Each model in ModeRNA contains only one chain. Multi-chain structures can be modeled by using more than one Template/Alignment/RNAModel at a time.

By default, RNAModels are created by reading files. They can also be created from BioPython PDB objects (precisely Bio.PDB.Structure.Structure and Bio.PDB.Chain.Chain objects)

Arguments:
  • path+filename of a PDB structure file; or a Structure or Chain object from BioPython.
  • chain id (by default 'A')
  • data type ('file' by default; if set to 'structure' or 'chain', Bio.PDB objects are read)
  • Template object to be used for this model (optional)
  • Alignment object to be used for this model (optional)

m = load_model('1F1T.pdb')
m = load_model('1F1T.pdb','A')
m = load_model(biopy_struc, data_type='structure')
m = load_model(biopy_struc[0].child_list[0], data_type='chain')

load_template

load_template(file_path, chain_name='A')

Loads a template structure from a PDB file. Produces a Template object that can be saved in a variable.

Each template in ModeRNA has only one chain. By default, the chain with id 'A' is loaded. Another chain id can be specified optionally

Arguments:
  • path+filename of a PDB structure file
  • chain id (by default 'A')

t = load_template('1F1T.pdb')
t = load_template('1F1T.pdb','A')

match_alignment_with_model

match_alignment_with_model(alignment, model)

Checks, if the sequence of a model structure is equal to the first sequence in the alignment. Writes an according message and returns True or False.

Both sequences also count as equal if one has modified nucleotides, and the other the corresponding unmodified nucleotides in the same position, or if one of the sequences contains the wildcard symbol '.'. Thus, the sequence "AGU" is equal to both "A7Y" and "A.U".

Arguments:
  • Alignment object
  • RnaModel object

match_alignment_with_model(a,m)
boolean = match_alignment_with_model(a,m)

match_template_with_alignment

match_template_with_alignment(template, alignment)

Checks, if the sequence of the template structure is equal to the second sequence in the alignment. Writes an according message and returns True or False. Small inconsistencies between both sequences, e.g. backbone breaks, or missing modification symbols are corrected automatically in the alignment, and changes are reported in the logfile.

Both sequences also count as equal if one has modified nucleotides, and the other the corresponding unmodified nucleotides in the same position, or if one of the sequences contains the wildcard symbol '.'. Thus, the sequence "AGU" is equal to both "A7Y" and "A.U".

Arguments:
  • Template object
  • Alignment object

match_template_with_alignment(t,a)
boolean = match_template_with_alignment(t,a)

remove_all_modifications

remove_all_modifications(model)

Removes all base modifications from a given model. The nucleotides are transformed into standard bases from which the modifications originated.

Arguments:
  • RnaModel object

remove_all_modifications(m)

remove_mismatching_modifications

remove_mismatching_modifications(template, alignment, model)

Removes all nucleotide modifications that occur in the template, and are not present in the target sequence. The nucleotides are transformed into standard bases from which the modifications originated.

Arguments:
  • Template object
  • Alignment object
  • RnaModel object

remove_mismatching_modifications(t,a,m)

remove_modification

remove_modification(residue, model=None, new_number=None)

Removes base modifications from a single residue. The nucleotide is transformed into the standard base from which the modification originated. A RnaModel can be given optionally. If this is given, the modified residue is subsequently copied to it.

Note that desoxynucleotides count as modified bases as well.

Arguments:
  • residue from a Template or RnaModel object
  • RnaModel object (optional)
  • new residue number after copying (optional)

remove_modification(m['5'])
remove_modification(t['5'], m)
remove_modification(t['5'], m, '5A')

renumber_chain

renumber_chain(struc, start_id)

Changes numeration of residues in the chain. Starts with the given identifier. The new numeration is continuous.

Arguments:
  • RnaModel or ModernaStructure object
  • identifier for first residue

renumber_chain(m,'1')

rotate_chi

rotate_chi(residue, angle=90)

Rotates a base in a given nucleotide around the glycosidic bond (the chi torsion angle, between C1' and N1/N9 atoms).

Arguments:
  • residue (from a template or model)
  • angle in degrees

rotate_chi(m['5'], 90)

shrink_helix

shrink_helix(model, anchor5_id, anchor3_id, anchor5_upper_id, anchor3_upper_id)

Makes helix shorter - cuts out a helix fragment between given residues from the model.

Arguments:
  • Template or RnaModel
  • anchor5 - residue id on the 5' side belonging to the first base pair that will remain
  • anchor3 - residue id on the 3' side belonging to the first base pair that will remain
  • anchor5_upper - residue id on the 5' side belonging to the pair that will end up next to the first.
  • anchor3_upper - residue id on the 3' side belonging to the pair that will end up next to the first.

shrink_helix(m, '2', '37', '5', '34')

write_fragment_candidates

write_fragment_candidates(fragment_candidates, output_directory='fragment_candidates')

Writes a list of fragment candidates to a set of PDB files. The candidates are numbered according to the geometrical fit of their backbones.

Arguments:
  • fragment candidates list (obtained by the find_fragment command)
  • output directory name

candidates = find_fragment(m, '35', '38', 'CA', 20)
write_fragment_candidates(candidates, 'my_candidates')

write_logfile

write_logfile(logfile_name='moderna.log')

Writes a text file with all log messages that ModeRNA generated up to that moment. The log messages in the memory are cleared afterwards. When ModeRNA terminates, any remaining messages will be written to 'moderna.log'

Arguments:
  • name of the log file (optional; by default moderna.log)

write_logfile()
write_logfile('log.txt')

write_model

write_model(model, pdb_file_name='moderna_model.pdb')

Writes a model to a PDB file. The residues in the file are sorted. All residues keep their numbers as last assigned.

Arguments:
  • Structure object (model or template)
  • name of the PDB file (optional; by default moderna_model.pdb)

write_model(m)
write_model(m, 'output.pdb')
write_model(m, 'output.pdb', 'log.txt')

write_secstruc

write_secstruc(model, file_name='secstruc.vienna')

Writes secondary struture to a vienna file.

Arguments:
  • Structure object (model or template)
  • name of the vienna file (optional; by default secstruc.vienna)

m = load_model('1F1T.pdb','A')
write_secstruc(m, '1F1T_secondary_structure.vienna')

Valid HTML 4.01!