RNAsketch.py: A small module containing all the important helpers and functions for all major RNAdesign operations.
RNAsketch.adaptive_walk_fixed(dg, design, objective_function=<function calculate_objective>, number=1000, mode='sample_clocal', avoid_motifs=None, white_positions=None, progress=False)[source]¶Takes a Design object and does a adaptive walk optimization with a fixed amount of move steps.
| Parameters: |
|
|---|---|
| Returns: | Optimization score reached for the final sequence |
| Returns: | Number of samples neccessary to reach this result |
RNAsketch.adaptive_walk_optimization(dg, design, objective_function=<function calculate_objective>, stop=1000, mode='sample', avoid_motifs=None, white_positions=None, progress=False)[source]¶Takes a Design object and does a adaptive walk optimization of this sequence.
| Parameters: |
|
|---|---|
| Returns: | Optimization score reached for the final sequence |
| Returns: | Number of samples neccessary to reach this result |
RNAsketch.calculate_objective(design, weight=0.5)[source]¶Calculates the objective function given a Design object containing the designed sequence and input structures. objective function (3 seqs): (eos(1)+eos(2)+eos(3) - 3 * gibbs) / number_of_structures + weight * (eos(1)-eos(2))^2 + (eos(1)-eos(3))^2 + (eos(2)-eos(3))^2) * 2 / (number_of_structures * (number_of_structures-1))
| Parameters: |
|
|---|---|
| Returns: | score calculated by the objective function |
RNAsketch.calculate_objective_1(design)[source]¶Calculates the objective function given a Design object containing the designed sequence and input structures. objective function (3 seqs): (eos(1)+eos(2)+eos(3) - 3 * gibbs) / number_of_structures
| Parameters: | design (Object of type Design) – Design object containing the sequence and structures |
|---|---|
| Returns: | score calculated by the objective function |
RNAsketch.calculate_objective_2(design)[source]¶Calculates the objective function given a Design object containing the designed sequence and input structures. objective function (3 seqs): abs(eos(1)-eos(2)) + abs(eos(1)-eos(3)) + abs(eos(2)-eos(3))) * 2 / (number_of_structures * (number_of_structures-1))
| Parameters: | design – Design object containing the sequence and structures |
|---|---|
| Returns: | score calculated by the objective function |
RNAsketch.calculate_objective_2_squared(design)[source]¶Calculates the objective function given a Design object containing the designed sequence and input structures. objective function (3 seqs): (eos(1)-eos(2))^2 + (eos(1)-eos(3))^2 + (eos(2)-eos(3))^2) * 2 / (number_of_structures * (number_of_structures-1))
| Parameters: | design – Design object containing the sequence and structures |
|---|---|
| Returns: | score calculated by the objective function |
RNAsketch.constraint_generation_optimization(dg, design, objective_function=<function calculate_objective>, stop=1000, mode='sample', num_neg_constraints=100, max_eos_diff=0, avoid_motifs=None, white_positions=None, progress=False)[source]¶Takes a Design object and does a constraint generation optimization of this sequence.
| Parameters: |
|
|---|---|
| Returns: | Optimization score reached for the final sequence |
| Returns: | Number of samples neccessary to reach this result |
RNAsketch.get_graph_properties(dg)[source]¶Takes a RNAdesign DependencyGraph Object and constructs a dicionary with all the calculated properties.
| Parameters: | dg – RNAdesign DependencyGraph object |
|---|---|
| Returns: | properties - Dictionary containing all the graph properties |
RNAsketch.read_inp_file(filename)[source]¶Reads a file in .inp format and returns all neccessary information
| Parameters: | filename – Filename of the file to read |
|---|---|
| Returns: | structures - List of structures in dot-bracket notation |
| Returns: | constraint - Sequence constraint |
| Returns: | sequence - Start sequence |
RNAsketch.read_input(content)[source]¶Reads some input and returns all neccessary information in the right container. Input is a string, lines separated by linebreaks. Content might be structures, a sequence constraint and a start sequence
| Parameters: | filename – Filename of the file to read |
|---|---|
| Returns: | structures - List of structures in dot-bracket notation |
| Returns: | constraint - Sequence constraint |
| Returns: | sequence - Start sequence |
RNAsketch.read_input_additions(content)[source]¶Reads some input and returns all neccessary information in the right container. Input is a string, lines separated by linebreaks. Content might be structures, a sequence constraint and a start sequence. Additional information for the structural states can be provided with any separator ;,: or whitespaces after the structure.
| Parameters: | filename – Filename of the file to read |
|---|---|
| Returns: | structures - List of structures in dot-bracket notation |
| Returns: | constraint - Sequence constraint |
| Returns: | sequence - Start sequence |
| Returns: | additions - List of additional information after the structures |
RNAsketch.sample_count_unique_solutions(solution_space_size, sample_size)[source]¶Calculates the expectancy value of how many time it is necessary to draw a solution to gain a unique set of solutions with the given sample size
| Parameters: |
|
|---|---|
| Returns: | Expectancy value of how many times to draw from the solution space to gain this unique set |
RNAsketch.sample_sequence(dg, design, mode, sample_steps=1, avoid_motifs=None, white_positions=None)[source]¶This function samples a sequence with the given mode from the dependency graph object and writes it into the design object
| Parameters: |
|
|---|---|
| Returns: | mut_nos is the solution space we drew from |
| Returns: | sample_count is how many times we sampled a solution from the dependency graph object (important for revert later) |
RNAsketch.simulated_annealing_optimization(dg, design, objective_function=<function calculate_objective>, temperature_gradient=None, cooling_step=50, mode='sample', avoid_motifs=None, white_positions=None, progress=False)[source]¶Takes a Design object and does a simulated annealing optimization of this sequence.
| Parameters: |
|
|---|---|
| Returns: | Optimization score reached for the final sequence |
| Returns: | Number of samples neccessary to reach this result |