OUTPUT BUFFER:
Structure instproc new args { my instvar NomAtm NomRes NmrRes ChnIdn AtmXYZ AtmBQ Sequence set nom [lindex $args 0] if {[file extension $nom] eq ""} { set chn [lindex $args 1] set Llignes [RecupereUnFichierSurWeb $nom] } else { set Llignes [LesLignesDuFichier $nom] } my _DecortiqueUnPdbObject $Llignes $nom my _PDBSetup my _ExtraitSecStrucDuPDB ${nom}_${chn} my _RemplitLeSQL return } Structure instproc _RemplitLeSQL {} { my instvar NmrRes NomRes NomAtm AtmXYZ ChnIdn AtmBQ Size global OrdTmpDir Defauts set db "[self]DB" set nmdb "[file join $OrdTmpDir [pid]_[string range [self] 2 end].db]" sqlite3 "$db" "$nmdb" $db eval {begin transaction} set cdef [set Defauts(CoulVariable)] set c 0 set i 0 set j 0 $db eval {create table chaines(i INTEGER PRIMARY KEY, nom TEXT, type TEXT)} $db eval {create table residues(i INTEGER PRIMARY KEY, rnom TEXT, rnmr TEXT, chaine INTEGER)} $db eval {create table atomes(i INTEGER PRIMARY KEY, anom TEXT,x REAL, y REAL, z REAL, b REAL, q REAL, residue INTEGER)} $db eval {create table objetinit(i INTEGER PRIMARY KEY, currsel integer, ribbon integer, ribcol text, catrace integer, cacol text, atomes integer, atmcol text, picked integer, label text, residue integer)} foreach n $ChnIdn { $db eval "insert into chaines values ($c, '$n', 'protein')" {} set Lra [set NomRes($n)] set Lrn [set NmrRes($n)] set LLa [set NomAtm($n)] set LLx [set AtmXYZ($n)] set LLb [set AtmBQ($n)] foreach ra $Lra rn $Lrn La $LLa Lx $LLx Lb $LLb { set dbrn [format "%08s" $rn] $db eval "insert into residues values($i, '$ra', '$dbrn', $c)" foreach a $La p $Lx f $Lb { lassign $p x y z lassign $f b q set label "[string trim $a] [AutreCodeLuc ${ra}] ${rn}${n}" $db eval "insert into atomes values($j, '$a', $x, $y, $z, $b, $q, $i)" $db eval "insert into objetinit values ($j, 0, 0, '$cdef', 0, '$cdef', 0, '[CouleurDeAtome $a]', 0, '$label', $i)" incr j } incr i } incr c } $db eval {commit} my _Dimensions return } Structure instproc _Dimensions {} { my instvar Size set db "[self]DB" lassign [$db eval {select min(x),min(y),min(z) from atomes}] Size(xmin) Size(ymin) Size(zmin) lassign [$db eval {select max(x),max(y),max(z) from atomes}] Size(xmax) Size(ymax) Size(zmax) set Size(xc) [expr {($Size(xmin)+$Size(xmax))/2.}] set Size(yc) [expr {($Size(ymin)+$Size(ymax))/2.}] set Size(zc) [expr {($Size(zmin)+$Size(zmax))/2.}] set Size(Rad) [expr {sqrt( \ ($Size(xmax)-$Size(xmin))**2 + \ ($Size(ymax)-$Size(ymin))**2 + \ ($Size(zmax)-$Size(zmin))**2) \ / 2.}] return } Structure instproc _DecortiqueUnPdbObject {Llignes pdbid} { my instvar Header Site my instvar ChnIdn NomRes NmrRes AtmXYZ AtmBQ NomAtm set lignesPDB [ExtraitLignesAtomesDuPDB $Llignes] set Header [ExtraitHeadDuPDB $Llignes] if {$lignesPDB == -1} {return 0} # Traite chaines apres chaines set Vraia 0 set Lter [lsearch -regexp -all $lignesPDB {^TER}] set Lter [linsert $Lter 0 "0"] set Lter [linsert $Lter end "end"] set LterAr [lrange $Lter 1 end] set d [lindex $Lter 0] foreach f $LterAr { set deb $d set fin $f if {$deb != 0} {incr deb} if {$fin ne "end"} {incr fin -1} set LLignesChn [lrange $lignesPDB $deb $fin] set Yaa [my _LectureDeChainePdbObject $LLignesChn] if {$Yaa} {set Vraia 1} set d $f } set lsite [ExtraitSiteActifDuPDB $Header] if {$lsite != {}} {set Site $lsite} # d'apres nicolas G , test d'existence de 'a' if {! $Vraia && "a" ni $ChnIdn} { set c [lindex $ChnIdn 0] foreach n {AtmXYZ AtmBQ NomAtm NomRes NmrRes} { set ${n}(a) [set ${n}($c)] } set ChnIdn [linsert $ChnIdn 0 "a"] } return 1 } Structure instproc _LectureDeChainePdbObject {LesLignes} { my instvar NomAtm NomRes NmrRes ChnIdn AtmXYZ AtmBQ Sequence if {! [info exists ChnIdn]} { set LdesC {} } else { set LdesC [set ChnIdn] } set Vraia 0 set ChaineCourant -1 set NomResCourant "" set ResiduCourant -999 set AlterLocRes "" set CC "" set PremRes 1 set Latmn {} set Latmx {} set Latmb {} foreach ligne $LesLignes { set ee " $ligne" set AtomName [string range $ee 13 16] # set AlterLocRes [string index $ee 17] set ResidueName [string range $ee 18 20] set ChainIdent [string range $ee 22 22] if {$ChainIdent eq "a"} {set Vraia 1} if {$ChainIdent eq " "} {set ChainIdent "a"} scan [string range $ee 23 27] "%s" ResidueNumber scan [string range $ee 31 54] "%8f%8f%8f" x y z set AtomXYZ [list $x $y $z] scan [string range $ee 55 66] "%6f%6f" q b set AtomBQ [list $b $q] set attmp [string trim $AtomName] if {[string index $attmp 0] eq "H"} {continue} if {[regexp {^[0-9]H} $attmp]} {continue} if {$ChainIdent in $LdesC} {continue} # if {$AlterLocRes ne ""} {continue} if {$ResiduCourant == -999} { set ResiduCourant $ResidueNumber set NomRes1L [AutreCodeLuc $ResidueName] set CC $ChainIdent } if {$ResidueNumber != $ResiduCourant} { set NomRes1L [AutreCodeLuc $ResidueName] if {$NomResCourant ne "XXX"} { lappend NomRes($CC) $NomResCourant lappend NmrRes($CC) $ResiduCourant lappend NomAtm($CC) $Latmn lappend AtmXYZ($CC) $Latmx lappend AtmBQ($CC) $Latmb set Latmn {} set Latmx {} set Latmb {} } if {$ChainIdent ne $ChaineCourant} { lappend ChnIdn $ChainIdent set ChaineCourant $ChainIdent set CC $ChainIdent } } lappend Latmx $AtomXYZ lappend Latmb $AtomBQ lappend Latmn $AtomName set ResiduCourant $ResidueNumber set NomResCourant $NomRes1L } # lappend ChnIdn $CC if {$NomResCourant ne "XXX"} { lappend NomRes($CC) $NomResCourant lappend NmrRes($CC) $ResiduCourant lappend NomAtm($CC) $Latmn lappend AtmXYZ($CC) $Latmx lappend AtmBQ($CC) $Latmb } return $Vraia } Structure instproc _PDBSetup {} { my instvar NmrRes NomRes ChnIdn EqResType Header my instvar ResSel ResCol my instvar DictDesObjets global Defauts set EqResType [dict create] foreach c $ChnIdn { foreach e [set NmrRes($c)] a [set NomRes($c)] { set ResSel($c,$e) 0 set ResCol($c,$e) [set Defauts(CoulVariable)] set res [AutreCodeLuc $a] dict lappend EqResType "$res" "$c,$e" } } # set DictDesObjets {} dict set DictDesObjets Index 0 return } Structure instproc _ExtraitSecStrucDuPDB {mol} { my instvar NomAtm NomRes NmrRes ChnIdn AtmXYZ AtmBQ Sequence SSBin SecStr Header set MolId [DonneIdDeAccessPDB $mol] set chn [DonneChainDeAccessPDB $mol] if {$chn eq ""} {set chn "a"} global Sequences set SeqAlignee [set Sequences(PDB_$mol)] set ssbh [string repeat "0" [string length $SeqAlignee]] set ssbs [string repeat "0" [string length $SeqAlignee]] # Numerotation format PDB commence a 1 et tcl commence a 0. # Rajoute un blanc pour avoir la meme coherence de format set LesLignes $Header set SStmp {} foreach l $LesLignes { set t [string range $l 0 4] switch $t { "HELIX" {set lhelix [LitHelixDansPDB $l $chn]} "SHEET" {set lhelix [LitSheetDansPDB $l $chn]} "TURN " {set lhelix [LitTurnDansPDB $l $chn]} default {continue} } if {$lhelix eq "PasBon"} {continue} set ss [OteLesBlancsEnTrop $lhelix] DecortiqueSS $ss Elmt NomChnDep NomResDep NomResFin Rmk set LesBornes [CorrespondancePDBAli $MolId $NomChnDep $NomResDep $NomResFin $SeqAlignee] foreach {DebAli FinAli} $LesBornes {} if {$DebAli == -9999 || $FinAli == -9999} {continue} lappend SStmp $ss incr DebAli -1 switch $Elmt { "Alpha" { set ssbh [MetDesUnsDansSS $ssbh $DebAli [expr $FinAli - 1]] } "Sheet" { set ssbs [MetDesUnsDansSS $ssbs $DebAli [expr $FinAli - 1]] } } } set SStmp [lsort -integer -index 4 $SStmp] set SStmp [CombleSSParCoil $SStmp $MolId $chn] set SecStr($chn) $SStmp lappend SSBin(helix) $ssbh lappend SSBin(sheet) $ssbs return } Structure instproc _Center {} { my instvar Size return [list $Size(xc) $Size(yc) $Size(zc)] } Structure instproc _Radius {} { my instvar Size return $Size(Rad) } Structure instproc _chains {} { my instvar ChnIdn return [lrange $ChnIdn 1 end] } Structure instproc _resname {args} { my instvar NomRes if {! [llength $args]} { puts "Error ! num args" return } if {"-code3l" in $args} {set 3lcode 1} {set 3lcode 0} set i [lsearch $args "-chain"] if {$i == -1} { puts "Error ! no >>-chain<< card !" return } set c [lindex $args [expr {$i+1}]] if {! [info exists NomRes($c)]} { puts "Error ! Chain >>$c<< does not exists" return } if {! $3lcode} { return [set NomRes($c)] } else { foreach a [set NomRes($c)] { lappend res [AutreCodeLuc $a] } return $res } } Structure instproc _resnumber {args} { my instvar NmrRes if {! [llength $args]} { puts "Error ! num args" return } set i [lsearch $args "-chain"] if {$i == -1} { puts "Error ! no >>-chain<< card !" return } set c [lindex $args [expr {$i+1}]] if {! [info exists NomRes($c)]} { puts "Error ! Chain >>$c<< does not exists" return } return [set NmrRes($chn)] } Structure instproc _selcolor {col} { my instvar ResSel ResCol foreach e [array names ResSel] { if {[set ResSel($e)]} {set ResCol($e) $col} } return } Structure instproc _select {args} { my instvar NomAtm NomRes NmrRes ChnIdn AtmXYZ AtmBQ my instvar Sequence SSBin SecStr Header global Defauts if {! [llength $args]} { puts "Error ! num args" return } if {[llength $args] == 1 && $args eq "all"} { foreach e [array names ResSel] { set ResSel($e) 1 } return } if {[llength $args] == 1 && $args eq "none"} { foreach e [array names ResSel] { set ResSel($e) 0 set ResCol($e) [set Defauts(CoulVariable)] } return } # Si pas de cle chain , alors toutes les chaines if {[lsearch $args "chain"] == -1} { set ChnSel -1 } set LExp $args # Si parentheses, traie d'abord interne if {[lsearch $args "("] != -1} { set LExp [_DecoupeParParenthese $args] } set rep [my _TraiteExp $LExp] set i 0 foreach v $ChnIdn { foreach n [set NmrRes($v)] { set ResSel($v,$n) [lindex $rep $i] incr i } } return } Structure instproc _DecoupeParParenthese {l} { set LO [lreverse [lsearch -all $l "\("]] set LF [lreverse [lsearch -all $l "\)"]] if {! [info exists DSel]} {set DSel [dict create]} set comp 0 foreach o $LO f $LF { set exp [lrange $l [expr {$o+1}] [expr {$f-1}]] set res [my _TraiteExp $exp] dict set DSel tmp${comp} $res set l [lreplace $l $o $f "tdict" tmp${comp}] incr comp } return $l } Structure instproc _Mult {a b op} { foreach x $a y $b { if {$op eq "and"} { lappend res [expr {$x & $y}] } else { lappend res [expr {$x | $y}] } } return $res } Structure instproc _TraiteExp {exp} { set Lelt {} foreach e $exp { if {$e eq "and" || $e eq "or"} { lappend LHow $e lappend Lexp $Lelt set Lelt {} } else { lappend Lelt $e } } lappend Lexp $Lelt set init 0 set i 0 foreach x $Lexp { set RS [my _ExecSel $x] if {! $init} { set init 1 set tmp $RS } else { set tmp [my _Mult $RS $tmp [lindex $LHow $i]] incr i } } return $tmp } Structure instproc _ExecSel {sel} { my instvar ResSel NomRes NmrRes ChnIdn EqResType set what [string tolower [lindex $sel 0]] switch -regexp -- $what { "chain" { set c [lindex $sel 1] foreach e [array names ResSel "$c,*"] { set ResSel($e) 1 } set res [list] foreach v [set ChnIdn] { if {$v eq $c} {set s 1} {set s 0} set n [llength [set NomRes($v)]] set res [concat $res [lrepeat $n $s]] } return $res } "resid" { foreach e [array names ResSel] { set ResSel($e) 0 } set v [lindex $sel 1] set Lx [split $v ","] foreach x $Lx { if {[regexp {:} $x]} { lappend Lix [split $x ":"] } else { lappend Lix [list $x $x] } } foreach v [set ChnIdn] { foreach e $Lix { foreach {d f} $e {} for {set i $d} {$i <= $f} {incr i} { set x "$v,$i" set ResSel($x) 1 } } } foreach c [set ChnIdn] { foreach r [set NmrRes($c)] { lappend res [set ResSel($c,$r)] } } return $res } "ala|cys|asp|glu|phe|gly|his|ile|lys|leu|met|asn|pro|gln|arg|ser|thr|val|trp|tyr" { # variable EqResType set AA [string toupper $what] set Li [dict get [set EqResType] $AA] foreach c [set ChnIdn] { foreach r [set NmrRes($c)] { if {"$c,$r" in $Li} {set s 1} {set s 0} lappend res $s } } return $res } "tdict" { variable DSel set key [lindex $sel 1] set res [dict get [set DSel] $key] return $res } default { puts "keyword not found : $what" return } } return } proc _CombleSSParCoil {{lss {} } molid chn} { variable SecStr variable NmrRes set LesRes [set NmrRes($chn)] set 1ResPDB [lindex $LesRes 0] set DResPDB [lindex $LesRes end] set df {} foreach s $lss { foreach {Elt a z e Nm1 r Nm2 t q} $s {} lappend df [list $Nm1 $Nm2] } if {$df == {}} { lappend df "Coil xxx xxx $chn $1ResPDB xxx $DResPDB xxx" return $df } set 1ResSS [lindex [lindex $df 0] 0] if {$1ResPDB - $1ResSS < 0} { lappend lss "Coil xxx xxx $chn $1ResPDB xxx [expr {$1ResSS-1}]" } set debc [_NextResDuPdb $name [lindex [lindex $df 0] 1] $chn $molid] foreach cpl [lrange $df 1 end] { set finc [_PreviousResDuPdb $name [lindex $cpl 0] $chn $molid] if {$finc-$debc >= 0} { lappend lss "Coil xxx xxx $chn $debc xxx $finc xxx" } set debc [_NextResDuPdb $name [lindex $cpl 1] $chn $molid] } if {$debc ne ""} { if {$DResPDB - $debc >= 0} { lappend lss "Coil xxx xxx $chn $debc xxx $DResPDB xxx" } } return [lsort -integer -index 4 $lss] } proc _NextResDuPdb {name res chn mol} { variable NmrRes set ires [lsearch [set NmrRes($chn)] $res] set deb [lindex [set NmrRes($chn)] [expr {$ires+1}]] return $deb } proc _PreviousResDuPdb {name res chn mol} { variable NmrRes set ires [lsearch [set NmrRes($chn)] $res] set fin [lindex [set NmrRes($chn)] [expr {$ires-1}]] return $fin } Structure instproc _NewObj objname { my instvar DictDesObjets if {[dict exists $DictDesObjets $objname]} { puts "Error ! Object >>$objname<< already exists !" return } set ix [dict get $DictDesObjets Index] dict set DictDesObjets $objname $ix incr ix dict set DictDesObjets Index $ix my instvar $objname dict set $objname OOn 1 dict set $objname globj -1 dict set $objname FlagRib 0 dict set $objname FlagCat 0 dict set $objname FlagAtm 0 set db "[self]DB" $db eval "create table $objname as select * from objetinit" my _select none return } Structure instproc atomes {obj} { my instvar ResSel ResCol $obj dict set $obj atomes [array get ResSel] dict set $obj atmcol [array get ResCol] set val [dict get [set $obj] atomes] set db "[self]DB" $db eval {begin transaction} foreach {i v} $val { lassign [split $i ,] c n set Nn [format "%08s" $n] set ix [$db eval "select r.i from chaines as c , residues as r where r.chaine=c.i and r.rnmr='$Nn' and c.nom='$c'"] $db eval "update $obj set atomes=$v where residue=$ix" } $db eval {commit} dict set $obj FlagAtm 1 return } Structure instproc catrace {obj} { my instvar ResSel ResCol $obj dict set $obj catrace [array get ResSel] dict set $obj cacol [array get ResCol] set val [dict get [set $obj] catrace] set db "[self]DB" $db eval {begin transaction} foreach {i v} $val { lassign [split $i ,] c n set Nn [format "%08s" $n] set ix [$db eval "select r.i from chaines as c , residues as r where r.chaine=c.i and r.rnmr='$Nn' and c.nom='$c'"] $db eval "update $obj set catrace=$v, ribbon=0 where residue=$ix" } $db eval {commit} dict set $obj FlagRib 0 dict set $obj FlagCat 1 return } Structure instproc ribbons {obj} { my instvar ResSel ResCol $obj dict set $obj ribbon [array get ResSel] dict set $obj ribcol [array get ResCol] set val [dict get [set $obj] ribbon] set db "[self]DB" $db eval {begin transaction} foreach {i v} $val { lassign [split $i ,] c n set Nn [format "%08s" $n] set ix [$db eval "select r.i from chaines as c , residues as r where r.chaine=c.i and r.rnmr='$Nn' and c.nom='$c'"] $db eval "update $obj set ribbon=$v, catrace=0 where residue=$ix" } $db eval {commit} dict set $obj FlagRib 1 dict set $obj FlagCat 0 return } Structure instproc _dellist {obj} { my instvar $obj glDeleteLists [dict get [set $obj] globj] 1 dict set $obj globj -1 return } Structure instproc GLListDe {type} { set obj "${type}[string range [self] 2 end]" my instvar $obj return [dict get [set $obj] ribobj] } Structure instproc _ListeObjets {} { my instvar DictDesObjets set l [dict keys $DictDesObjets] foreach e $l { if {$e eq "Index"} {continue} lappend Le $e } return $Le } Structure instproc _EtatDeObjet {obj} { my instvar $obj return [dict get [set $obj] OOn] } Structure instproc ObjetOff {obj} { my instvar $obj dict set $obj OOn 0 return } Structure instproc ObjetOn {obj} { my instvar $obj dict set $obj OOn 1 return } Structure instproc Ind2Obj i { my instvar DictDesObjets lassign [dict filter $DictDesObjets value $i] obj i return $obj } Structure instproc ClearPicked {obj} { set db "[self]DB" $db eval {update $obj set picked=0} return } Structure instproc AddPicked {obj v} { set db "[self]DB" $db eval "update $obj set picked=1 where i=$v" return } Structure instproc _drawatomes obj { my instvar $obj if {! [dict get [set $obj] FlagAtm]} {return} set res [dict get [set $obj] atmvec] lassign $res Li Lx La Ln # on ne trace pas la chaine principale si on est # en ribbon ou catrace (flag cp) if {[dict get [set $obj] FlagRib] || [dict get [set $obj] FlagCat]} { use_light set cp 0 set QObj [gluNewQuadric] gluQuadricDrawStyle $QObj GLU_FILL gluQuadricNormals $QObj GLU_SMOOTH } else { dont_use_light set cp 1 set QObj "" } glInitNames glPushName 0 if {$cp} { set first 1 set colN [CouleurDeAtome "N"] set colCA [CouleurDeAtome "C"] set colC ${colCA} set colO [CouleurDeAtome "O"] } foreach ri $Li rx $Lx rn $La n $Ln { set n [AutreCodeLuc $n] if {$cp} { # Trace N-CA CA-C C-O TraceLiaison $QObj [lindex $rx 0] [lindex $rx 1] ${colN} ${colCA} $cp [lindex $ri 0] [lindex $ri 1] TraceLiaison $QObj [lindex $rx 1] [lindex $rx 2] ${colCA} ${colC} $cp [lindex $ri 1] [lindex $ri 2] TraceLiaison $QObj [lindex $rx 2] [lindex $rx 3] ${colC} ${colO} $cp [lindex $ri 2] [lindex $ri 3] } if {$n ne "GLY"} { TraceLiaison $QObj [lindex $rx 1] [lindex $rx 4] [CouleurDeAtome " CA "] [CouleurDeAtome " CB "] $cp [lindex $ri 1] [lindex $ri 4] if {$n ne "ALA"} { set Lb1 [lrange $rx 4 end-1] set Ll1 [lrange $rn 4 end-1] set Li1 [lrange $ri 4 end-1] set i 5 foreach a1 $Lb1 l1 $Ll1 i1 $Li1 { set Lb2 [lrange $rx $i end] set Ll2 [lrange $rn $i end] set Li2 [lrange $ri $i end] foreach a2 $Lb2 l2 $Ll2 i2 $Li2 { if {[Dist2 $a1 $a2] <= 3.8025} { TraceLiaison $QObj $a1 $a2 [CouleurDeAtome $l1] [CouleurDeAtome $l2] $cp ${i1} ${i2} } } incr i } } } if {$cp} { if {$first} { set first 0 } else { TraceLiaison $QObj [lindex $rx 0] $Cx ${colN} ${colC} $cp [lindex $ri 0] $Deri } set Cx [lindex $rx 2] set Deri [lindex $ri 2] } } return } Structure instproc _drawribbon obj { my instvar $obj if {! [dict get [set $obj] FlagRib]} {return} set LesVecs [dict get [set $obj] ribvec] if {1} { use_light glBegin GL_TRIANGLES foreach {v1 v2 v3} $LesVecs { glNormal3fv $v1 # light_color3f {*}$v2 glColor3fv $v2 glVertex3fv $v3 } glEnd } else { dont_use_light set n 0 foreach {n1 c1 v1 n2 c2 v2 n3 c3 v3} $LesVecs { # puts "c1 $c1" # puts "c2 $c2" # puts "c3 $c3" puts "n1 $n1" puts "n2 $n2" puts "n3 $n3\n" if {0} { glColor3fv {0.4 0.4 1.0} glBegin GL_LINES glVertex3fv $v1 glVertex3fv $n1 glEnd glBegin GL_LINES glVertex3fv $v2 glVertex3fv $n2 glEnd glBegin GL_LINES glVertex3fv $v3 glVertex3fv $n3 glEnd } glColor3fv {1.0 1.0 0.0} glBegin GL_LINES glVertex3fv $v1 glVertex3fv $v2 glEnd glBegin GL_LINES glVertex3fv $v1 glVertex3fv $v3 glEnd glBegin GL_LINES glVertex3fv $v2 glVertex3fv $v3 glEnd incr n if {$n > 20} {break} } } return } Structure instproc _drawcatrace obj { my instvar $obj if {! [dict get [set $obj] FlagCat]} {return} set LesCols [dict get [set $obj] catcol] lassign [dict get [set $obj] catvec] Li LesVecs set C1 [lrange $LesCols 0 end-1] set C2 [lrange $LesCols 1 end] set L1 [lrange $LesVecs 0 end-1] set L2 [lrange $LesVecs 1 end] set I1 [lrange $Li 0 end-1] set I2 [lrange $Li 1 end] dont_use_light glInitNames glPushName 0 foreach c1 $C1 c2 $C2 v1 $L1 v2 $L2 i1 $I1 i2 $I2 { TraceLiaison "" $v1 $v2 $c1 $c2 1 $i1 $i2 } return } Structure instproc AtomXYZ v { set db "[self]DB" set Lv [$db eval "select x, y, z from atomes where i=$v"] return $Lv } Structure instproc _ClearIDs {} { foreach o [my _ListeObjets] { my _ClearObjIDs $o } return } Structure instproc _ClearObjIDs {obj} { set db "[self]DB" $db eval {update $obj set picked=0} return } Structure instproc _mapfeat {obj f} { global TabSF Defauts StrucAVoir my instvar $obj set db "[self]DB" set nom [string range [self] 2 end] if {$f eq "None"} { set c [set Defauts(CoulVariable)] $db eval "update $obj set atmcol='$c', ribcol='$c', cacol='$c'" return } set i [lsearch -regexp $StrucAVoir $nom] set nomf [BonAccess [lindex $StrucAVoir $i]] if {! [info exists TabSF($nomf,$f)]} {return} $db eval {begin transaction} set fCons [regexp "^Cons" $f] foreach e [set TabSF($nomf,$f)] { DecortiqueUneFeature $e dg fg col score note set dg [expr {$dg-1}] set fg [expr {$fg-1}] set deb [CorrespondanceGenPDB $nomf $dg] set fin [CorrespondanceGenPDB $nomf $fg] if {$fCons && $col eq "black"} {set col white} set c [CouleurO2Ordali $col] set fdeb [format "%08s" $deb] set ffin [format "%08s" $fin] set Li [$db eval "select o.i from $obj as o, residues as r where (r.rnmr >= '$fdeb' and r.rnmr <= '$ffin') and o.residue=r.i"] $db eval "update $obj set atmcol='$c', ribcol='$c', cacol='$c' where i in ([join $Li ,])" } $db eval {commit} return } Structure instproc _Labels obj { my instvar $obj set db "[self]DB" set Lx {} set Ll {} set Lv [$db eval "select a.x, a.y, a.z, o.label from atomes as a, $obj as o where a.i=o.i and o.picked=1"] foreach {x y z l} $Lv { lappend Lx [list $x $y $z] lappend Ll $l } return [list $Lx $Ll] } Structure instproc _Display {} { my instvar DictDesObjets set LObj [dict keys $DictDesObjets] foreach obj $LObj { if {$obj eq "Index"} {continue} my instvar $obj if {! [my _EtatDeObjet $obj]} {continue} if {[dict get [set $obj] globj] != -1} { glCallList [dict get [set $obj] globj] } else { set list [glGenLists 1] dict set $obj globj $list glNewList $list GL_COMPILE_AND_EXECUTE puts "_draw pour $obj" my _drawribbon $obj my _drawcatrace $obj my _drawatomes $obj glEndList } lassign [my _Labels $obj] Lx Lt AfficheLabels $Lx $Lt glFlush } return } Structure instproc _render {obj} { my instvar $obj DictDesObjets global HashPDB set mx [set HashPDB([string range [self] 2 end])] set ox [dict get $DictDesObjets $obj] set db "[self]DB" if {[dict get [set $obj] FlagRib]} { set Lv [$db eval "select a.i,a.x,a.y,a.z,o.ribcol from atomes as a , $obj as o where o.i=a.i and a.anom=' CA ' and o.ribbon=1"] foreach {i x y z c} $Lv { lappend Li [format "%d%03d%02d" $i $mx $ox] lappend Lcol [RGBDeLaTkCol $c] lappend Lca [list $x $y $z] } $db eval "select a.x,a.y,a.z from atomes as a , $obj as o where o.i=a.i and a.anom=' C ' and o.ribbon=1" {lappend Lc [list $x $y $z]} $db eval "select a.x,a.y,a.z from atomes as a , $obj as o where o.i=a.i and a.anom=' O ' and o.ribbon=1" {lappend Lo [list $x $y $z]} set LesVecs [CheminRibbon $Lca $Lc $Lo $Lcol] dict set $obj ribvec $LesVecs } if {[dict get [set $obj] FlagCat]} { set Lv [$db eval "select a.residue,o.cacol,a.x,a.y,a.z from atomes as a , $obj as o where o.i=a.i and a.anom=' CA ' and o.catrace=1"] foreach {i c x y z} $Lv { lappend Li [format "%d%03d%02d" $i $mx $ox] lappend Lca [list $x $y $z] lappend Lcol [RGBDeLaTkCol $c] } dict set $obj catvec [list $Li $Lca] dict set $obj catcol $Lcol } if {[dict get [set $obj] FlagAtm]} { if {[dict get [set $obj] FlagRib] || [dict get [set $obj] FlagCat]} { set pexp "and (a.anom!=' N ' or a.anom!=' CA ' or a.anom!=' C ' or a.anom!=' O ') " } else { set pexp "" } set Lr [$db eval "select r.i, r.rnom from residues as r , $obj as o where o.atomes=1 and r.i=o.residue"] foreach {i r} $Lr {lappend Nl [list $i $r]} set Lr [lsort -index 0 -integer -unique $Nl] foreach e $Lr { lassign $e r s set Lv [$db eval "select a.i,a.x,a.y,a.z,a.anom from atomes as a , $obj as o where o.i=a.i and o.atomes=1 and o.residue=$r $pexp"] set Lxyz {} set Lnm {} set Lli {} foreach {i x y z a} $Lv { set xyz [list $x $y $z] lappend Lxyz $xyz lappend Lnm $a lappend Lli [format "%d%03d%02d" $i $mx $ox] } lappend LX $Lxyz lappend LA $Lnm lappend Ln $s lappend Li $Lli } dict set $obj atmvec [list $Li $LX $LA $Ln] } return } proc Tag2MolObjAtm i { global HashPDB set x [expr {[string length $i]-5}] scan $i "%0${x}d%03d%02d" atm imol iobj set mol [set HashPDB($imol)] set obj [$mol Ind2Obj $iobj] return [list $mol $obj $atm] }