forgi 2.0.0 documentation

«  forgi.threedee.model.similarity module   ::   Contents   ::   forgi.threedee.model.transform_cg module  »

forgi.threedee.model.stats module

class forgi.threedee.model.stats.AngleStat(stat_type='angle', pdb_name='', dim1=0, dim2=0, u=0, v=0, t=0, r1=0, u1=0, v1=0, ang_type='x', define=[], seq='', vres={})[source]

Bases: future.types.newobject.newobject

Class for storing an individual statistic about inter-helical angles.

deviation_from(stat2)[source]

How much does the other stat differ from this stat?

Parameters:stat2 – Another AngleStat
Returns:A 4-tuple: The positional deviation in Angstrom, and 3 absolute angular deviations in radians. The angular deviations are u, v and t
get_angle()[source]

Return the angle between the two connected stems.

is_similar_to(stat2, position_cutoff=4, angular_cutoff=None)[source]

Returns True, if theAngleStat is similar (according to the specified cutoff) to the other Angle Stat.

Parameters:
  • position_cutoff – in angstrom
  • angular_cutoff – in radians. If not given, uses the position cutoff as a value in degrees
orientation_params()[source]

Return a tuple containing the parameters which specify the orientation of one stem with respect to another.

Returns:(u, v)
parse_line(line)[source]
position_params()[source]

Return a tuple containing the parameters which specify the position of one stem with respect to another.

Returns:(r1, u1, v1)
twist_params()[source]

Returns a tuple containing the parameters which specify the difference in twist between two stems.

:return (u, v, t)

class forgi.threedee.model.stats.ClusteredAngleStats(filename)[source]

Bases: future.types.newobject.newobject

A collection of clustered angle_stats. Whenever stats for a certain key are retrieved, only one (randomly choosen) representative per cluster is returned.

Requires a clustered angle stats file (created by fess/scripts/cluster_stats.py). The file should look like this:

‘ # Cluster 0 for (1, 1, -1): angle RS_1788_S_000008_A 1 1 1.520877 1.837257 -1.380352 11.237569 0.867246 2.057771 1 19 19 30 30 UCG CAA # Cluster 1 for (1, 1, -1): angle RS_1140_S_000002_A 1 1 1.563667 1.869580 -0.967966 16.241881 0.896602 2.177000 -1 13 13 24 24 ACG CUU angle RS_1183_S_000008_A 1 1 1.533551 1.914482 -1.108396 15.780723 0.829850 2.255556 -1 4 4 46 46 UAG CAG ‘

Parameters:filename – The filename of the clustered angle stats file.
cluster_of(stat)[source]
get_angle_stat_dims(dim0, dim1, ang_type)[source]

Returns a list of pairs,`(dist, key)` ordered by increasing distance of the key to the query key.

Parameters:
  • dim1 – dim1 of the query key
  • dim2 – dim2 of the query key
  • ang_type – angle_type of the query key.
keys()[source]
lookup_stat(stat)[source]
class forgi.threedee.model.stats.ConformationStats(stats_file, clustered_angle_stats_file=None)[source]

Bases: future.types.newobject.newobject

constrain_stats(constraint_file)[source]

Constrain the statistics for certain regions of the molecule. This is created for use with the JAR3D annotations for loop regions.

Parameters:constraint_file – A file containing the allowed statistics for a particular loop.
Returns:Nothing
sample_stats(bg, elem, min_entries=10)[source]

Return a set of statistics compatible with this element.

Parameters:
  • bg – The graph representation we’re using.
  • elem – The name of the element
Returns:

A list of compatible statistics

class forgi.threedee.model.stats.ConstructionStats[source]

Bases: future.types.newobject.newobject

angle_stats = None
conf_stats = None
fiveprime_stats = None
loop_stats = None
stem_stats = None
threeprime_stats = None
class forgi.threedee.model.stats.FilteredConformationStats(stats_file, filter_filename=None, filter_prob=1)[source]

Bases: forgi.threedee.model.stats.ConformationStats

Parameters:filter_prob – Return the filtered stats with this probability, else all stats. Default=1 (100%)
from_file(filename)[source]

Read the statistics in from a file, with the following formatting:

sampled i3 1X8W_A 4 27 31 101 104 ""
sampled i2 3U5F_6 4 1348 1348 1365 1367 "cWW AG or UU"
sampled i2 2QBG_B 4 1013 1014 1103 1103 "cWW AG or UU"
sample_stats(bg, elem)[source]
class forgi.threedee.model.stats.LoopStat(line='', s_type='loop')[source]

Bases: future.types.newobject.newobject

Class for storing the individual statistics about loops.

phys_length: The length between the start and the centroid of the loop.

parse_line(line)[source]

Parse a line containing statistics about the shape of a stem.

Parameters:line – The line from the statistics file.
class forgi.threedee.model.stats.RandomAngleStats(discrete_angle_stats)[source]

Bases: future.types.newobject.newobject

Store all of the angle stats.

create_random_function(data)[source]

Create a function that returns a random value for each column in the statistics.

Parameters:stats – A table containing n rows and m columns
Returns:A function returning m random values with a maximum and minimum no greater than the largest and least values in that column, respectively.
make_random(discrete_angle_stats)[source]

Create a set of statistsics that is random in each direction.

The maximum and minimum u and v values will be taken from the discrete statistics.

sample_stats(dims)[source]

Sample a set of statistics.

Parameters:dims – The dimensions of the bulge for which to sample.
class forgi.threedee.model.stats.StemStat(line='')[source]

Bases: future.types.newobject.newobject

Class for storing the individual statistics about helices.

Each stem will be defined by its base pair length. Two parameters are associated with each base pair length:

phys_length: The physical length of such a helix twist_angle: The angle between its two twist segments

parse_line(line)[source]

Parse a line containing statistics about the shape of a stem.

Parameters:line – The line from the statistics file.
forgi.threedee.model.stats.get_angle_stat_dims(s1, s2, angle_type, min_entries=1)[source]

Return a list of tuples which indicate the dimensions for which angle stats are avilable.

Parameters:
  • s1 – The first size
  • s2 – The second size
  • angle_type – The type of the angle.
  • min_entries – The minimum number of stats that have to be available
forgi.threedee.model.stats.get_angle_stats(filename, refresh=False)[source]

Load the statistics about inter the helix-helix orientations from a file.

The file format should be as follows:

angle pdb_name dim1 dim2 r u v t r1 u1 v1 s1b s2b

Where the parameters are as follows:

  • angle: identifier for a type of statistics… should always just be ‘angle’
  • pdb_name: the name of the pdb file these statistics came from
  • dim1: the smaller dimension of the bulge
  • dim2: the larger dimension of the bulge
  • u: the polar angle of the orientation of the 2nd stem
  • v: the azimuth of the orientation of the 2nd stem
  • t: the orientation of the twist of the second stem
  • r1: the distance of the start of the 2nd stem helix from the end of the 1st
    stem helix
  • u1: the polar angle of the separation vector of the two helices
  • v1: the azimuth of the separation vector of the two helices
  • s1b: The side of the first stem closest to the bulge
  • s2b: The side of the second stem closest to the bulge

The azimuth is always defined with respect to the coordinate system defined by the stem1 helix axis vector and it’s twist vector (the one adjacent to the bulge element).

forgi.threedee.model.stats.get_conformation_stats(stats_file, angle_stats_file=None)[source]
forgi.threedee.model.stats.get_fiveprime_stats(filename, refresh=False)[source]

Load the statistics from the file.

format:

fiveprime pdb_name bp_length phys_length

Parameters:filename – The name of the file.
forgi.threedee.model.stats.get_loop_stats(filename, refresh=False)[source]

Load the statistics from the file.

format:

loop pdb_name bp_length phys_length

Parameters:filename – The name of the file.
forgi.threedee.model.stats.get_one_d_stat_dims(d, stats, min_entries=1)[source]
forgi.threedee.model.stats.get_stem_stats(filename, refresh=False)[source]

Load the statistics from the file.

format:

stem pdb_name bp_length phys_length twist_angle

Parameters:filename – The name of the file.
forgi.threedee.model.stats.get_threeprime_stats(filename, refresh=False)[source]

Load the statistics from the file.

format:

threeprime pdb_name bp_length phys_length

Parameters:filename – The name of the file.
forgi.threedee.model.stats.set_conformation_stats(conf_stats)[source]

«  forgi.threedee.model.similarity module   ::   Contents   ::   forgi.threedee.model.transform_cg module  »