Previous Up Next

class Segment



module segment

The documentation is here.

Instances of this class are used for Partition class, but it may be useful to handle them.

A Segment is made of

Construction

__init__
Optional keywords:
beg=d
begin position is d (default: 0);
end=f
end position is f (default: 0);
val=v
value is v (default:0).
str=l
descriptor numbers are a copy of list l (default: []);
mot=m
descriptor is string m (default: "");


read_str
builds from a string in specific format; returns True if parsing is ok, False otherwise;
copy
returns a copy of this Segment.

Handling

g_deb
gets the first position;
g_fin
gets the last position;
g_num
gets the list of descriptors numbers;
g_word
gets the string of the pattern;
g_val
gets the value;
deb
returns the first position;
fin
returns the last position;
num
returns the list of descriptors numbers;
word
returns the string of the pattern;
val
returns the value;
__len__
returns the length of the Segment, ie fin-deb+1.

Input-Output

Specific format is:
description
<begin-end>sequence_of_descriptors_numbers:value:descriptor_pattern
 
   if sequence_of_descriptors_numbers is empty, it is not output
   if value is zero, it is not output
   if descriptor_pattern is empty, it is not output
examples
<0-123>1,2:-5.0:+{A(-1)CG}T
<5-3922>:0.45:
<87-332>1::
__str__
outputs in specific format;
abr
outputs in specific format, without the descriptor pattern.

Previous Up Next