4 Usage of Lexique and Parti_simp
We give several examples of Lexique, to show how use its
specific syntax. These examples
are used on the DNA sequence of λ−phage, in file
lambda.seq, which is known to show strong
signals of segmentation [Chu92, Chu89, Gué00].
In connection with Lexique, we give examples of computation and
manipulation of partitionnings.

We load the sequence.
import sequence
s=sequence.Sequence(fic="lambda.seq")
 We want to part this sequence such that a segment is described
by a letter, and its value is the number of occurences of this
letter.
print s.alpha()
import lexique
lx1=lexique.Lexique()
lx1.read_str('0:a 1:c 2:g 3:t')
print lx1
import parti_simp
ps1=parti_simp.Parti_simp()
ps1.mpp(s,lx1,100)
 We draw the evennumbered partitions.
ps1.filter(lambda x: len(x)%2==0).draw_nf("lambda1.ps")
 We cluster the segments described by c or g, and
the ones described by a or t, and sort the new
Parti_simp following the number of segments. We draw the
20 first partitions of this new Parti_simp.
ps2=ps1.group([[1,2],[0,3]])
ps2.sort()
ps2[:20].draw_nf("lambda1_cg.ps",seg=[1,2])
 We want to partition on comparing the occurences in c
and g versus the ones in a and t.
lx2=lexique.Lexique(str="0:+(cg) 1:+(at)")
ps2=parti_simp.Parti_simp()
ps2.mpp(s,lx2,20)
ps2[:20].draw_nf("lambda2_cg.ps",num=1)