module Ligand: sig end
Assocext
.type t
This data structure is not thread safe.
exception Illegal_character
create
below.val create : string -> t
Illegal_character
if a
character appears in the string which can not be part of a ligand.
For instance, ^
and $
can not appear in ligands. FIXME: For now,
anyway.val get_string : t -> string
type interval
Assocext.interval
.val get_interval_length : interval -> int
exception Overlapping_intervals
compare_intervals
when the intervals
provided overlap.val compare_intervals : interval -> interval -> int
compare i1 i2
returns -1 if i1
precedes i2
on the ligand, 1
if i1
follows i2
and 0 if they're equal. FIXME: Do error checking
too, as in if they overlap but are not equal?type frag
val get_interval : frag -> interval
frag
type.val contains_end : interval -> bool
val contains_begin : interval -> bool
exception Stale_frag
Stale_frag
.val get_whole : frag -> t
Stale_frag
will
be raised.val get_frag_list : t -> frag list
val get_active_interval_list : t -> interval list
exception Out_of_bounds
exception Empty
val first : t -> frag
val last : t -> frag
val next_frag : frag -> frag
val prev_frag : frag -> frag
val iter : (frag -> unit) -> t -> unit
module Matcher: sig end
exception Unable_to_bind
exception Illegal_interval
val bind : t -> interval -> frag
bind l i
attempts to bind the ligand l
from i.start
to
i.start + i.len - 1
. The result is the newly bound frag. If the
interval is already bound (fully or partially), exception
Unable_to_bind
will be raised. If the range is illegal,
Illegal_interval
will be raised.val check : t -> interval -> bool
bind
above would perform, but does
not bind anything. Returns true
if binding would be successful, or
false
otherwise. If the interval is illegal, raise
Illegal_interval
.exception Invalid_frag
val release : frag -> unit
Invalid_frag
if the frag is stale or otherwise not
registered.val replace : frag -> string -> unit
Invalid_frag
. The extremities are
unaffected by a replacement.type whichside =
| |
LeftSplit |
|||
| |
RightSplit |
(* | Returned by | *) |
type apportf = frag -> whichside * frag
split
.val split : frag ->
int -> (t * frag) * (t * frag) * apportf
split f pos
splits a ligand into two parts. Precisely, the
ligand is split at position pos
of frag f
(note that we can only
split a bound ligand). The result is a structure of the form (l1,
f1), (l2, f2), apportf
, where l1
and l2
are the new ligands, left
and right of the split respectively, f1
and f2
are the frags which
correspond to the original split frag, which are such that f1
is
bound to the end of the ligand l1
and f2
is bound to the beginning
of the ligand l2
, and apportf
is a function which maps any bound
frag on the original ligand to a frag on either of the resulting split
frags.type joinf = whichside * frag -> frag
join
.val join : frag -> frag -> (t * frag) * joinf
join f1 f2
joins two ligands into one. More precisely, f1
must be a tail frag on a ligand l1
and f2
a start frag on a ligand
l2
. The result (l, f), joinf
of join is a single ligand, with a
new frag f
which corresponds to the join of f1
and f2
. The
returned function joinf
is used to map each original bound frag to a
frag on the resulting joined ligand.val collapse_interval : interval -> int * int
collapse_interval i
returns (start, length)
, where the start
and length
parameters correspond to the accounting introduced by the
original string from which the ligand was created. This is a lossy
operation, as, for instance, the ligand terminals are simply
forgotten.val basic_interval : t -> int -> int -> interval
basic_interval start length
creates an interval based on the
original string.val get_interval_string : t -> interval -> string
get_interval_string l i
returns the base string associated to
the interval i
in the ligand l
. It is equal to the empty string
if the length of the interval is zero.val get_frag_string : frag -> string