Classes

RNAsketch.Design

Design.py: Class as wrapper for ViennaRNA and Nupack functions to design an RNA molecule This implements the core class which holds all the states of a riboswitch

class RNAsketch.Design.Design(structures, sequence='')[source]

Bases: object

Design contains all neccessary information to generate a RNA device or to return a solution. It is used as a container between the different functions.

Parameters:
  • structures – RNA secondary structure string in dot-bracket notation
  • sequence – RNA sequence string in IUPAC notation [AUGC]
classtype
ensemble_defect
Returns:Dict of ensemble defect values of all states with state names as keys
eos
Returns:Dict of energy of structure values of all states with state names as keys
eos_diff_mfe
Returns:Dict of energy of structure to MFE difference values of all states with state names as keys
eos_reached_mfe
Returns:Dict of booleans telling if the energy of struct equals the mfe energy of all states with state names as keys
length
Returns:Length of the designed sequence
mfe_energy
Returns:Dict of mfe values of all states with state names as keys
mfe_structure
Returns:Dict of mfe structures of all states with state names as keys
newState(key, struct, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Creates a new state of the given subclass.

Parameters:
  • key – Name of the state (string)
  • struct – Dot-bracket notation of a structure input
  • temperature – Temperature for the folding predictions of this state (default: 37.0 degree celsius)
  • ligand – List specifying the ligand binding-pocket and energy, e.g. for Theophylline [“GAUACCAG&CCCUUGGCAGC”,”(…((((&)…)))…)”,-9.22]
  • constraint – specify a hard constraint string
  • enforce_constraint – boolean if we should enforce constraints
number_of_structures
Returns:Number of uniq structures of all states
pf_energy
Returns:Dict of partition function energy values of all states with state names as keys
pf_structure
Returns:Dict of partition function consensus structures of all states with state names as keys
pos
Returns:Dict of probability of structure values of all states with state names as keys
sequence
Returns:Sequence of this design object
structures
Returns:List containing the structures of all states
write_csv(separator=';')[source]

Generates a csv version of all values of this design separated by the given separator

Parameters:separator – separator for the values
Returns:string containing all values of this design separated by the given separator
write_csv_header(separator=';')[source]

Generates a csv header for all values of this design separated by the given separator

Parameters:separator – separator for the values
Returns:string containing a csv header for this design separated by the given separator
write_out(score=0)[source]

Generates a nice human readable version of all values of this design

Parameters:score – optimization score for this design
Returns:string containing a nicely formatted version of all design values
RNAsketch.Design.get_Design(structures, sequence, package, temperature=None)[source]

Convenience function to build and return the right Design object

Parameters:
  • structures – RNA secondary structure string in dot-brackete notation
  • sequence – RNA sequence string in IUPAC notation [AUGC]
  • package – String specifying the folding energy evaluation package (‘nupack’, ‘vrna’, ‘pkiss’, ‘hotknots’)
  • temperature – Temperature for the folding predictions in degree celsius (default: 37.0)
class RNAsketch.Design.hotknotsDesign(structures, sequence='')[source]

Bases: RNAsketch.Design.Design

classtype
newState(key, struct, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Creates a new state of the given subclass.

Parameters:
  • key – Name of the state (string)
  • struct – Dot-bracket notation of a structure input
  • temperature – Temperature for the folding predictions of this state (default: 37.0 degree celsius)
  • ligand – List specifying the ligand binding-pocket and energy, e.g. for Theophylline [“GAUACCAG&CCCUUGGCAGC”,”(…((((&)…)))…)”,-9.22]
  • constraint – specify a hard constraint string
  • enforce_constraint – boolean if we should enforce constraints
class RNAsketch.Design.nupackDesign(structures, sequence='')[source]

Bases: RNAsketch.Design.Design

classtype
newState(key, struct, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Creates a new state of the given subclass.

Parameters:
  • key – Name of the state (string)
  • struct – Dot-bracket notation of a structure input
  • temperature – Temperature for the folding predictions of this state (default: 37.0 degree celsius)
  • ligand – List specifying the ligand binding-pocket and energy, e.g. for Theophylline [“GAUACCAG&CCCUUGGCAGC”,”(…((((&)…)))…)”,-9.22]
  • constraint – specify a hard constraint string
  • enforce_constraint – boolean if we should enforce constraints
class RNAsketch.Design.pkissDesign(structures, sequence='')[source]

Bases: RNAsketch.Design.Design

classtype
newState(key, struct, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Creates a new state of the given subclass.

Parameters:
  • key – Name of the state (string)
  • struct – Dot-bracket notation of a structure input
  • temperature – Temperature for the folding predictions of this state (default: 37.0 degree celsius)
  • ligand – List specifying the ligand binding-pocket and energy, e.g. for Theophylline [“GAUACCAG&CCCUUGGCAGC”,”(…((((&)…)))…)”,-9.22]
  • constraint – specify a hard constraint string
  • enforce_constraint – boolean if we should enforce constraints
class RNAsketch.Design.vrnaDesign(structures, sequence='')[source]

Bases: RNAsketch.Design.Design

classtype
newState(key, struct, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Creates a new state of the given subclass.

Parameters:
  • key – Name of the state (string)
  • struct – Dot-bracket notation of a structure input
  • temperature – Temperature for the folding predictions of this state (default: 37.0 degree celsius)
  • ligand – List specifying the ligand binding-pocket and energy, e.g. for Theophylline [“GAUACCAG&CCCUUGGCAGC”,”(…((((&)…)))…)”,-9.22]
  • constraint – specify a hard constraint string
  • enforce_constraint – boolean if we should enforce constraints

RNAsketch.State

State.py: Class as wrapper for ViennaRNA and Nupack functions to design an RNA molecule. This implements the various states of a riboswitch.

class RNAsketch.State.State(parent, structure=None, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Bases: object

State object holds structure, ligand, constraints and calculates all values for this state.

Parameters:
  • structure – Dot-bracket structure string
  • parent – Parent Design object
classtype
constraint
Returns:Structural constraint of this state (hard constraint)
cut_points
Returns:List containing the positions of the cut points (& or +) in the sequence
enforce_constraint
Returns:Boolean whether to enforce the hard constraint or not
ensemble_defect
Returns:Ensemble defect value given all the properties of this state (constraints, temperature,…)
eos
Returns:Energy of structure given all the properties of this state (constraints, temperature,…)
eos_diff_mfe
Returns:Energy difference of structure to mfe given all the properties of this state (constraints, temperature,…)
eos_reached_mfe
Returns:Boolean defining whether the eos reached the mfe energy
length
Returns:Length of the design sequence if available, otherwise of the stuctural input
ligand
Returns:Ligand binding definitions for this state; List with sequence pattern, structure pattern and binding energy (soft constraint)
mfe_energy
Returns:MFE value given all the properties of this state (constraints, temperature,…)
mfe_structure
Returns:MFE structure given all the properties of this state (constraints, temperature,…)
multifold
Returns:Number of cut points to specify if it is a cofold or multifold problem
pf_energy

In case of a dimer cofold calculation with viennarna, the function returns the energy of true hybrid states only.

Returns:Partition function energy value given all the properties of this state (constraints, temperature,…)
pf_structure
Returns:Partition function consensus structure given all the properties of this state (constraints, temperature,…)
pos
Returns:Probability of structure given all the properties of this state (constraints, temperature,…)
reset()[source]
structure
Returns:Dot-bracket structure as constraint for this state
temperature
Returns:Temperature of this state
RNAsketch.State.add_cuts(input, cut_points)[source]

Takes a string and add back the cut point characters at the positions stored in the cut points list

Parameters:input – string without cut point characters
Returns:string containing cut point characters
RNAsketch.State.create_bp_table(structure)[source]

Takes a structure in dot bracket notation and returns a base pair table. Unpaired positions are -1, otherwise the index of the adjacent bracket is listed

Parameters:structure – string with dot-bracket notation of the strcture
Return bpt:base pair table
class RNAsketch.State.hotknotsState(parent, structure=None, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Bases: RNAsketch.State.State

classtype
class RNAsketch.State.nupackState(parent, structure=None, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Bases: RNAsketch.State.State

classtype
class RNAsketch.State.pKissState(parent, structure=None, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Bases: RNAsketch.State.State

classtype
RNAsketch.State.remove_cuts(input)[source]

Takes a string and removes all cut characters (+&) from this string

Parameters:input – string containing cut point characters
Returns:string without cut point characters
class RNAsketch.State.vrnaState(parent, structure=None, temperature=37.0, ligand=None, constraint=None, enforce_constraint=False)[source]

Bases: RNAsketch.State.State

classtype

RNAsketch.RNAStructure

class RNAsketch.Structure.RNAStructure(dotbracket)[source]

Bases: object

RNAStructure object to handle RNA secondary structures. Holds a pairtable internally to operate on.

Parameters:dotbracket – Dot-bracket notation of the RNA secondary structure as string
hasLonelyPairs()[source]

Returns a boolean whether the structure has lonely pairs

Returns:boolean
removeLonelyPairs()[source]

Returns a dotbracket string without lonely pairs.

Returns:structure string in dot-bracket notation without any lonely pairs
resolvePKs()[source]

Removes any pseudoknots from the structure. Pseudoknotted base-pairs are missing in the returned structure!

Returns:list of pseudoknot-free structure strings in dot-bracket notation

RNAsketch.RPSampler

class RNAsketch.RNARedPrintSampler.RPSampler(structures, constraint='', model='nussinov', weights=[], gcweight=1, temperature=37.0, stacksize=1000, StopConstruct=False, RedPrintFolder=None, debug=False)[source]

Bases: object

RPSampler is a python wrapper for RNARedPrint and implements a similar interface to the RNAblueprint DependencyGraphMT object.

Parameters:
  • structures – List of Dot-bracket structure strings
  • constraint – Sequence constraints in IUPACK notation
  • model – String specifying the model, can be ‘uniform’, ‘nussinov’, ‘basepairs’ or ‘stacking’
  • weights – List of integers specifying the boltzmann weight for the target structures, range in ]0, +infinity]
  • gcweight – Integer specifying the GC-weight, ]0, +infinity]
  • temperature – Temperature for the folding predictions (default: 37.0 degree celsius)
  • stacksize – Size of one sequence sampling batch (default: 1000 sequences)
  • StopConstruct – Bool specifying if we want to benchmark the construction time. Measured time can be obtained from construction_time after construction (default: False)
  • RedPrintFolder – Location of the RNARedPrint project folder (default: ‘./RNARedPrint/’)
  • debug – Bool to print debug statements (default: False)
dump_new_stack()[source]

Draws a sample from RNARedPrint and returns the list of generated sequences at once. The variable stacksize specifies the amount of sequences.

Returns:List of RNA sequence strings
gcweight

Integer specifying the GC-weight, ]0, +infinity]

get_sequence()[source]

Get the sampled sequence as a string.

Returns:RNA Sequence string in IUPACK notation
model

String specifying the sampling model.

Returns:string, can be ‘uniform’, ‘nussinov’, ‘basepairs’ or ‘stacking’
revert_sequence(amount)[source]

Compatibility to the DependencyGraphMT object, does nothing internally.

sample()[source]

Sample a new sequence.

Returns:Returns 0 for compatibility to DependencyGraphMT.
sample_clocal()[source]

Compatibility to the DependencyGraphMT object, calls sample() internally.

sample_plocal()[source]

Compatibility to the DependencyGraphMT object, calls sample() internally.

set_history_size(size)[source]

Compatibility to the DependencyGraphMT object, does nothing internally.

set_sequence(seq)[source]

Compatibility to the DependencyGraphMT object, does nothing internally.

weights

List of integers specifying the boltzmann weight for the target structures, range in ]0, +infinity]