OUTPUT BUFFER:
#!/usr/local/bin/wish global LignesCoul set LignesCoul "ILMV white magenta RK white blue FYW white red DE white forestgreen Q black green P white black G black orange HN black cyan STAC white darkviolet " ######### # Cinfigure tags for 20 amino acids # almost taken from ordali proc ConfTag {} { global wt wlog global LignesCoul set conftag [split $LignesCoul "\n"] set nb 0 foreach c $conftag { foreach {n f b} $c {} $wt tag configure "Tag$n" -foreground $f -background $b incr nb } $wlog insert end "\nConfigure $nb tags" return } ########## # Data generation proc JunkData {strl} { global data global nlines global wlog set s1 "....MQCPGFACEDFT...........AE...SPATL....QMAR.....TKD.M.F.LSN.................SDLKFMSDFG..SDFSDFMKLITHDKSAMPWNA...............................MFM...G....LPR...SDFSMDKFMQSDFQKLMPAIQREALSDFQA...THQKSDFLQMTIQYTQC" set s2 [string repeat $s1 10] set seq1 "[string range $s2 0 [expr $strl-1]]\n" set lseq [expr [string length $seq1] -1] set nlet [regsub -all {[ACDEFGHIKLMNPQRSTVWY]} $seq1 "" tmp] set data "[string repeat $seq1 $nlines]" $wlog insert end "\nnbr of lines $nlines" $wlog insert end "\nlines of $lseq characters" $wlog insert end "\n$nlet of them are tagged" return $data } proc TagText {} { global wt wlog set ntag 0 set laa [list STAC ILMV DE Q G P HN FYW RH] set y 1 foreach s [split [$wt get 1.0 end]`"\n"] { set lchar [split $s ""] foreach a $laa { set frg "[join [split $a ""] "|"]" set lidx [lsearch -all -regexp $lchar "$frg"] incr ntag [llength $lidx] if {[string equal $lidx ""]} {continue} set ltag {} foreach start $lidx { lappend ltag $y.$start $y.[expr $start+1] } eval $wt tag add Tag$a $ltag } incr y } $wlog insert end "\nnbr of tags : $ntag" return } # trash window test ... no grid , nothing ... proc InitWindow {} { global wt wlog set WdHt 50 set WdWd 120 set wt .f3.t set wx .f3.sx set wy .f3.sy frame .f3 text .f3.t -font "Courier 10 bold" -wrap none \ -yscrollcommand [list $wy set] \ -xscrollcommand [list $wx set] \ -height $WdHt \ -width $WdWd scrollbar .f3.sy -command "$wt yview" scrollbar .f3.sx -command "$wt xview" \ -orient horizontal pack .f3.sy -side right -fill y -expand 1 pack .f3.sx -side bottom -fill x pack .f3.t -expand 1 -fill both pack .f3 -side top set wlog .wlog.t toplevel .wlog text .wlog.t -font "courier 16 bold" pack .wlog.t $wlog insert end "\nwidth : $WdWd" $wlog insert end "\nheight: $WdHt" $wlog insert end "\n" return } proc delete1 {} { global wt $wt delete 1.0 end return } proc delete2 {pq} { global nlines wt set nl $nlines while {$nl >= $pq} { $wt delete 1.0 $pq.end incr nl -$pq } $wt delete 1.0 end return } proc FillW1 {} { global data global wt wbout ConfTag $wt insert end $data TagText $wt see 100.400 return } proc FillW2 {} { global data global wt wbout $wt insert end $data TagText ConfTag $wt see 100.400 return } ######### ######### # Main # # Parameters are : # - nbr of lines : nlines # - string length : strl (up to 2000) # ########## global wt wlog global data set nlines 600 set strl 3000 InitWindow $wt configure -foreground white -background "#303030303030" JunkData $strl puts "[time {FillW1} 1]" delete2 10 puts "[time {FillW2} 1]" exit foreach nlines {200 400 600} { foreach strl {500 1000 2000 3000} { foreach i {1 2 3} { FillW $wlog insert end "\n1 delete by bunch of lines" $wlog insert end "\n[time {delete2 10} 1]" FillW $wt tag delete [$wt tag names] $wlog insert end "\n2 delete tags first" $wlog insert end "\ndelete by bunch of lines" $wlog insert end "\n[time {delete2 10} 1]" FillW $wlog insert end "\n3 delete all lines" $wlog insert end "\n[time {delete1} 1]" FillW $wt tag delete [$wt tag names] $wlog insert end "\n4 delete first tags then all lines" $wlog insert end "\n[time {delete1} 1]" puts "[$wlog get 1.0 end]" set fn [file join "h:/ordali" "lulu_${i}_${nlines}_${strl}.log"] set foo [open $fn w] puts $foo [$wlog get 1.0 end] close $foo $wlog delete 1.0 end update } } } exit ########### la fin des haricots ##############