#rR gscope_dessins.tcl proc ClassFromIdSvg {{Source ""} {Destin ""} {LesIdAClasser ""} {LesIdAGarder ""}} { #rR Extrats all id='a b c d' and if one appears in more than 1 element it become class='b" #rR If more than 1 remains in id in an element, the first one becomes id and all other become class if {$Destin==""} { set Destin "GetText" } if {[regexp " " $Source]} { set Texte $Source } elseif {[file exists $Source]} { set Texte [ContenuDuFichier $Source] } else { set Texte [ContenuDuFichier $Source] ; #rR a completer } foreach IdAClasser $LesIdAClasser { set AClasser($IdAClasser) 1 } foreach IdAGarder $LesIdAGarder { set AGarder($IdAGarder) 1 } set LesTagsVus {} set iReste 0 while {[set iCourant [string first " id='" $Texte $iReste]]>0} { if { ! [regexp {^ id='([^']+)'} [string range $Texte $iCourant end] Match Tags]} { set iReste [expr $iCourant + 1] ; continue } regsub -all {[ \n\t]+} $Tags " " Tags set LesTags [split [string trim $Tags " "]] foreach Tag $LesTags { incr NbUse($Tag) lappend LesTagsVus $Tag } set iReste [expr $iCourant + 1] } set LesTagsVus [lsort -unique $LesTagsVus] foreach Tag $LesTagsVus { if {$NbUse($Tag)==1 || [info exists AGarder($Tag)]} { continue } lappend LesIdAClasser $Tag set AClasser($Tag) 1 } set iReste 0 while {[set iCourant [string first " id='" $Texte $iReste]]>0} { if { ! [regexp {^ id='([^']+)'} [string range $Texte $iCourant end] Match Tags]} { set iReste [expr $iCourant + 1] ; continue } regsub -all {[ \n\t]+} $Tags " " Tags set LesTags [split [string trim $Tags " "]] set LesId {} set LesCl {} set FousToutEnClasse 0 foreach Tag $LesTags { if {[info exists AClasser($Tag)]} { lappend LesCl $Tag } else { lappend LesId $Tag set FousToutEnClasse 1 } } set Ids [join $LesId " "] set Cls [join $LesCl " "] set TextIdCl "" if {$Ids!=""} { append TextIdCl " id='$Ids'" } if {$Cls!=""} { append TextIdCl " class='$Cls'" } set D $iCourant set F [expr $iCourant + [string length $Match] - 1] set Texte [string replace $Texte $D $F $TextIdCl] set iReste $F } if {$Destin=="GetText"} { return $Texte } return [Sauve $Texte dans $Destin] } proc ReParDefaut {{Type ""}} { #rR on modifie les noms des repertoires msf blastp ... pour en avoir avec extension et un lien qui leur pointe dessus #rR tout ca parce que Gscope travaille avec les defauts msf, blastp if {$Type==""} { FaireLire "Please enter the directory type for which you want to change the default (blastp, msf, etc.)" set Type [ChoixParmi [list "blastp" "blastn" "tblastn" "msf" "Other"]] if {$Type==""} { return "" } if {$Type=="Other"} { set Type [Entre ""] } if {$Type==""} { return "" } return [ReParDefaut $Type] } NousAllonsAuBoulot [RepertoireDuGenome] set LesExistants [glob -nocomplain "$Type*"] set i [lsearch $LesExistants "aliinout"] if {$i>=0} { set LesExistants [lreplace $LesExistants $i $i] } if {$LesExistants=={}} { if {[OuiOuNon "Do I create $Type (I'll ask you later for an extension)"]} { file mkdir $Type OnRevientDuBoulot return [ReParDefaut $Type] } return {} } set LesDirs {} set Target "" foreach D $LesExistants { if {$D!=$Type && [file isdirectory $D]} { lappend LesDirs $D } if {$D==$Type && [file type $D]=="link"} { set Target [file readlink $D] } } set Existants [join $LesDirs "\n"] if {$Target!=""} { append Existants "\n$Type -> $Target" } set YaNuDir 0 set YaNu 0 foreach D $LesExistants { if {$D==$Type} { set YaNu 1 if {[file type $D]!="link" && [file isdirectory $D]} { if {[OuiOuNon "$Existants\n$D\n $D is a directory do you want to add an extension"]} { set Ext [Entre ".[Date]"] while {$Ext=="" && ! [OuiOuNon "We keep it without extension"]} { set Ext [Entre ".[Date]"] } if {$Ext!=""} { file rename $D "$D$Ext" OnRevientDuBoulot return [ReParDefaut $Type] } } set YaNuDir 1 break OnRevientDuBoulot return "$Existants\n$Type" } if {[file type $D]=="link"} { set Target [file readlink $D] if {[OuiOuNon "$D links to $Target\n Do you want to change it"]} { set NewTarget [ChoixParmi $LesDirs] if {$NewTarget!=""} { file delete $D file link $D $NewTarget OnRevientDuBoulot return [ReParDefaut $Type] } } break } set YaNu 0 FaireLire "$D is not a directory and not a link. Please correct it. I'll skip it" } } if {$YaNu} { while {[OuiOuNon "Do you want to create another directory with an extension"]} { set Ext [Entre ".[Date]"] if {$Ext==""} { continue } set NewDir "$Type$Ext" if {[file exists $NewDir]} { FaireLire "$NewDir already exists ..." ; continue } file mkdir $NewDir OnRevientDuBoulot return [ReParDefaut $Type] } set E $Existants if {$YaNuDir} { append E $Type } OnRevientDuBoulot return $E } while {[OuiOuNon "There is no directory or link named $Type ; Do we create a link ?"]} { set NewTarget [ChoixParmi $LesDirs] while {$NewTarget==""} { if {[OuiOuNon "Do we stop ?"]} { OnRevientDuBoulot return $Existants } set NewTarget [ChoixParmi $LesDirs] } file link $Type $NewTarget OnRevientDuBoulot return [ReParDefaut $Type] } if {[OuiOuNon "Do you want to create a directory named $Type"]} { file mkdir $Type OnRevientDuBoulot return [ReParDefaut $Type] } OnRevientDuBoulot return $Existants } proc DefinirLaCouleurAuLancement K { if {[OnTraiteUnGenome]} { #RedefinirLaCouleur $K "NombreDeCopainsDansBlast" RedefinirLaCouleur $K "SuivantLaFrame" RedefinirLaCouleurDuLinge $K "BiaisEnGC" RedefinirLeFard $K "BiaisEnGC" } elseif {[OnTraiteUneCollection]} { RedefinirLeFard $K "NombreDeCopainsDansBlast" RedefinirLaCouleurDuLinge $K "NombreDeCopainsDansBlast" if {[OnTraiteDesCDNAs]} { if {[file exists "[RepertoireDuGenome]/polyJENESAISPLUSQUOIxxxxxxxxxxxxxxxxxxx"]} { RedefinirLaCouleur $K "PolyLocalization" RedefinirLaCouleurDuLinge $K "RepeatMasker" RedefinirLeFard $K "NombreDeCopainsDansBlast" } else { RedefinirLaCouleur $K "NombreDeCopainsDansBlast" RedefinirLaCouleurDuLinge $K "NombreDeCopainsDansBlast" RedefinirLeFard $K "NombreDeCopainsDansBlast" } } elseif {[OnTraiteDesCDS]} { RedefinirLaCouleur $K "NombreDeCopainsDansBlast" RedefinirLaCouleurDuLinge $K "PolyLocalization" RedefinirLeFard $K "MDScore" } else { if {[OnTraite ScerFlo]} { RedefinirLaCouleur $K "NombreDeCopainsDansBlast" RedefinirLaCouleurDuLinge $K "Rejected" } if {[PreFixe]=="SY"} { RedefinirLaCouleur $K "Classes" } if {[PreFixe]=="RIB"} { RedefinirLaCouleur $K "PhylumOrtho" } if {[PreFixe]=="PEROX"} { RedefinirLaCouleur $K "CompareSeqWithQuery" } if {[PreFixe]=="COR"} { RedefinirLaCouleur $K "PhylumOrtho" } if {[regexp "Droso" [RepertoireDuGenome]]} { RedefinirLaCouleur $K "NombreDeCopainsDansBlast" } if {[OnTraiteBalibase]} { RedefinirLaCouleur $K "Balibase" } if {[PreFixe]=="BSD"} { RedefinirLaCouleur $K "Famille" } if {[regexp Tparva [RepertoireDuGenome]]} { # RedefinirLaCouleurDuLinge $K "ScerevisiaePfalciparum" # RedefinirLaCouleur $K "NombreDeCopainsDansBlast" RedefinirLaCouleurDuLinge $K "ScerevisiaeTbrucei" RedefinirLaCouleur $K "NombreDeCopainsDansBlast" } } } } proc TestStudent {} { Student "a b c d e" "x y z" } proc Student {L1 {L2 {}}} { if {$L2=={}} { FaireLire "Splitter la liste en 2" set L12 $L1 set L1 [MorceauxChoisis $L12] set L2 [ListsComplement $L12 $L1] } Espionne "Je compare $L1 - $L2" return } proc TestMDScore {} { foreach Nom [ListeDesPABs] { set MD [MDScore $Nom] set Couleur [QuelInterval $MD [LesSeuilsMDScore] [LesSeuilsMDScore "CouleurMerci"]] set Signif [QuelInterval $MD [LesSeuilsMDScore] [LesSeuilsMDScore "SignificationMerci"]] Espionne "$Nom $MD $Couleur $Signif" } } proc DetecteLesMauvaisOrganismes Fichier { foreach Ligne [LesLignesDuFichier $Fichier] { if {[regexp -nocase { [a-z]+ } $Ligne Match]} { Espionne "$Match [string range $Ligne 0 40]" } } exit } proc SB {} { set w .toto toplevel $w set S $w.sb scrollbar $S -command {Espionne} pack $S } proc HsapiensGeneDefLoc {Query {Quoi ""}} { global HsapiensGeneDefLoc global GscopeDir set QUOI [string toupper [string index $Quoi 0]] set QUERY [string toupper $Query] if {$QUOI=="" && [regexp " " $Query]} { set QUOI G } if {$QUOI=="" && ! [regexp " " $Query]} { set QUOI D } if {[regexp "LISTEGN" $QUERY]} { set QUOI "G" } if {[regexp "LISTEDEF" $QUERY]} { set QUOI "D" } if {[info exists HsapiensGeneDefLoc($QUERY,$QUOI)]} {return [set HsapiensGeneDefLoc($QUERY,$QUOI)]} if {[info exists HsapiensGeneDefLoc] && $Quoi!="ChooseDef"} { return "" } if {[info exists HsapiensGeneDefLoc] && $Quoi=="ChooseDef"} { set LesPossibles {} set LesPossiblesAvecGn {} set LesClefs [split $Query " "] foreach Def $HsapiensGeneDefLoc(LISTEDEF,D) { set TousSontLa 1 foreach Clef $LesClefs { if { ! [regexp -nocase $Clef $Def]} { set TousSontLa 0 ; break } } if {$TousSontLa} { set DEF [string toupper $Def] lappend LesPossiblesAvecGn "[set HsapiensGeneDefLoc($DEF,G)] $Def" lappend LesPossibles $Def } } set Bonne [ChoixParmiJoli $LesPossibles "" $LesPossiblesAvecGn] return [HsapiensGeneDefLoc $Bonne G] } foreach Ligne [LesLignesDuFichier "$GscopeDir/gscope_hs_gn_def_loc.txt"] { if {[regexp "^Symbol" $Ligne]} { continue } while {[regsub -all { |\t} $Ligne " " Ligne]} {} set Ligne [string trim $Ligne] set LesMots [split $Ligne " "] set Gn [lindex $LesMots 0] set PMID [lindex $LesMots end] if {[regexp {^[0-9]{5,}$} $PMID]} { set LaDefLoc [lrange $LesMots 1 end-1] } else { set LaDefLoc [lrange $LesMots 1 end] set PMID "" } set Loc [lindex $LaDefLoc end] if {[regexp {^(X|Y|[0-9]{1,2})[pq]} $Loc] \ || [regexp "reserved" $Loc] \ || [regexp {^[0-9]+$} $Loc]} { set Def [join [lrange $LaDefLoc 0 end-1] " "] } else { set Loc "" set Def [join [lrange $LaDefLoc 0 end] " "] } set DEF [string toupper $Def] set GN [string toupper $Gn] set HsapiensGeneDefLoc($GN,D) $Def set HsapiensGeneDefLoc($GN,L) $Loc set HsapiensGeneDefLoc($DEF,G) $GN lappend HsapiensGeneDefLoc(LISTEGN,G) $Gn lappend HsapiensGeneDefLoc(LISTEDEF,D) $Def } return [HsapiensGeneDefLoc $Query $Quoi] } proc AfficheMsfFamily Nom { global RepertoireDuGenome set Famille [NomDeFamille $Nom] if {$Famille=="UnknownFamily"} { return "" } set Fichier "$RepertoireDuGenome/msffamily/$Famille.msf" if { ! [file exists $Fichier]} { return "" } return [AfficheFichier $Fichier "GrandeLargeurAvecEtudeMSF"] } proc ComptonsLesSolitaires {} { foreach Nom [ListeDesPABs] { set nCops [NombreDeCopainsDansBlast $Nom] set Report [StartCodonReport $Nom "Couleur"] } } proc ComptonsLesStartCodon {} { set RW 0 set RWseul 0 set Rg 0 set RR 0 set RG 0 set GW 0 set GWseul 0 set Gg 0 set GR 0 set GG 0 set Rmodifs 0 set Rpile 0 set T 0 set TB 0 set TM 0 set N 0 foreach Nom [ListeDesPABs] { set NorMD [MDScore $Nom] set nCops [NombreDeCopainsDansBlast $Nom] set Etendu [GeneEtendu $Nom "Color"] set Report [StartCodonReport $Nom "Couleur"] if {$Report=="orange"} { set Report "red" } if { $Etendu=="red" && $Report=="white" } { incr RW } if { $Etendu=="red" && $Report=="white" && $nCops < 3} { incr RWseul } if { $Etendu=="red" && $Report=="grey" } { incr Rg } if { $Etendu=="green" && $Report=="white"} { incr GW } if { $Etendu=="green" && $Report=="white" && $nCops < 3} { incr GWseul } if { $Etendu=="green" && $Report=="grey" } { incr Gg } if {$Report=="red" || $Report=="green"} { incr T if {$NorMD>0.4} { incr TB } else { incr TM } } if { $Etendu=="red" && $Report=="red" } { incr RR set OldBornes [GeneEtendu $Nom "Old"] scan $OldBornes "%s %d %d %s" OldNom OldDebut OldFin OldOrient set Debut [Box $Nom debut] set Fin [Box $Nom fin] set Orient [Box $Nom orient] set Diff [expr ($Fin - $Debut) - ($OldFin -$OldDebut)] set Rapport [StartCodonReport $Nom "Rapport"] scan $Rapport "%s %s" Signif CodonsProposes regexp {[MVL]([0-9]+)} $CodonsProposes Match Pos set Ecart [expr abs($Pos - $Diff/3 - 1)] if { $Ecart == 0} { incr Rpile } else { lappend LesEcarts [list $Ecart [MDScore $Nom]] } } if { $Etendu=="red" && $Report=="green"} { incr RG } if { $Etendu=="green" && $Report=="red" } { incr GR } if { $Etendu=="green" && $Report=="green"} { incr GG } incr N } EspionneL [lsort -index 0 -integer $LesEcarts] Espionne "$N $RW $RWseul $Rg $RR $RG $GW $GWseul $Gg $GR $GG $Rmodifs $Rpile $T $TB $TM" exit } proc OverlapDeUn {} { FaireLire "Attention, ne marche que si les ORFs sont tries" set OldNom "" set OldFin -999 set OldOrient X foreach Nom [ListeDesPABs] { set Debut [Box $Nom debut] set Fin [Box $Nom fin] set Orient [Box $Nom orient] if {$Orient=="R"} { continue } set D [expr $Debut - 0] set F [expr $Debut + 0] if {$OldOrient==$Orient && [expr $Debut == $OldFin -3]} { set Seq [BoutADN [expr $Debut] [expr $Debut+3] $Orient] Espionne "$OldNom $Nom $Seq" } set OldNom $Nom set OldFin $Fin set OldOrient $Orient } exit } proc CorrigeAnabaenaNostoc {} { global RepertoireDuGenome set LesBonnes {} foreach Ligne [LesLignesDuFichier "$RepertoireDuGenome/fiches/orthoblastp"] { regsub -all {Anabaena_sp\.} $Ligne "Anabaena_sp. Nostoc_sp." Bonne lappend LesBonnes $Bonne } Espionne [SauveLesLignes $LesBonnes dans "$RepertoireDuGenome/fiches/orthoblastp.mieux"] set LesBonnes {} foreach Ligne [LesLignesDuFichier "$RepertoireDuGenome/fiches/ooblastp"] { regsub -all "ASP nsp " $Ligne "ASP NSP " Bonne lappend LesBonnes $Bonne } Espionne [SauveLesLignes $LesBonnes dans "$RepertoireDuGenome/fiches/ooblastp.mieux"] set LesBonnes {} foreach Ligne [LesLignesDuFichier "$RepertoireDuGenome/fiches/ootblastn"] { regsub -all "asp NSP " $Ligne "ASP NSP " Bonne lappend LesBonnes $Bonne } Espionne [SauveLesLignes $LesBonnes dans "$RepertoireDuGenome/fiches/ootblastn.mieux"] exit } proc VerifieOrthoBlastP {} { global RepertoireDuGenome foreach Ligne [LesLignesDuFichier "$RepertoireDuGenome/fiches/orthoblastp"] { scan $Ligne "%s" Nom regsub {RIB[0-9]+ } $Ligne "" Accesses if {[regexp {[A-Z][a-z]+ } $Accesses Match]} { Espionne "$Nom $Match" ; continue ; Espionne $Ligne } } } proc LesOrganismesOrthologues {Nom {Prog "DbClustal"} {PA "Presents"} {Format "Complet"}} { set Oo "" if {$Prog=="TBlastN"} { set Oo [ORGAorgaDesTBlastNs $Nom $PA] } if {$Prog=="BlastP"} { set Oo [ORGAorgaDesBlastPs $Nom $PA] } if {$Prog=="DbClustal"} { set Oo [ORGAorgaDesMSFs $Nom $PA] } regsub -all { {2,}} $Oo " " Oo set Inconnu [Glossaire "" $Format] set LesOrganismesOrthologues {} foreach Orga [split $Oo " "] { if {$Format=="Court"} { set Organisme $Orga } else { set Organisme [Glossaire $Orga $Format] } if {$Organisme=="" || $Organisme==$Inconnu || $Organisme=="iinc" } { continue } lappend LesOrganismesOrthologues $Organisme } return $LesOrganismesOrthologues } proc VerticalNames TexteDesORGAorga { foreach Orga [split $TexteDesORGAorga " "] { set Orga [string totitle $Orga] append Orga "..." lappend L0 [string index $Orga 0] lappend L1 [string index $Orga 1] lappend L2 [string index $Orga 2] lappend L3 [string index $Orga 3] } return " O [join $L0 ""]\ \n r [join $L1 ""]\ \n g [join $L2 ""]\ \n a [join $L3 ""]" } proc DismissToutesLesFenetres {} { global LesFenetresDePAB set Force "" if {[OuiOuNon "DO I destroy all windows without confirmation ?"]} { set Force "Force" } foreach Nom [array names LesFenetresDePAB] { DismissToutCePAB $Nom $Force } } proc RACtoTFA Fichier { global ADN TDN RAC global NotreOS if { ! [info exists ADN]} { ChargeADNetTDNetRAC } set TFA [SequenceFormatTFA [string range $RAC 1 end] "$NotreOS reverse and complement" "nucbrut"] Espionne [Sauve $TFA dans $Fichier] exit } proc Devoile {K X Y {EffaceOuNOuAction "end-1"}} { global RepertoireDuGenome set EffaceOuN $EffaceOuNOuAction set Efface $EffaceOuN if {[regexp {end|[0-9]+|GenScan} $EffaceOuN]} { set N $EffaceOuN set Efface "" } regsub ".canvas" $K ".message" M catch {destroy $M} if {$Efface!=""} { return "" } set x [$K canvasx $X] set y [$K canvasy $Y] set x $X set y $Y set Id [$K find withtag current] set MesTags [$K gettags $Id] if {$EffaceOuNOuAction=="GenScan"} { set BornesEtChroContigPro [lindex $MesTags end-1] scan $BornesEtChroContigPro "%d %d %s %s %s" D F S ChroContig Prot set Fenetre [AfficheGenscanDuContig $ChroContig] Illumine "^ *$Prot\\." $Fenetre Illumine "_$Prot\\|" $Fenetre return $Fenetre } set Texte [lindex $MesTags $N] message $M -borderwidth 3 -font {Courier 8} -relief raise -width 800 -text $Texte -background "lightyellow" -foreground "black" place $M -x $x -y [expr $y-20] -anchor w return $M } proc TkH {} { global GscopeDir # NouveauPack set w [AfficheFichier "$GscopeDir/gscope.tcl"] QueFontLesBoutonsDe $w EspionneL [$w.frame.list get 0 end] } proc NouveauPack {} { proc pack args { return } } proc CanvaDuRectangleDegrade {} { set K [UnCanva 500 500 500 500 EtY] RectangleDegrade $K 200 200 300 400 0.3 0.7 return $K } proc RectangleDegrade {K X1 Y1 X2 Y2 UnPeu Passion {Orient ""} {N ""}} { if {$Orient==""} { set Orient "X" } if {$N==""} { set N 256 } if {$N < 1} { set N 1 } set PasC [expr 1.*($Passion-$UnPeu)/$N] set PasX [expr 1.*($X2-$X1)/$N] set PasY [expr 1.*($Y2-$Y1)/$N] set Xd $X1 set Xf $X2 set Yd $Y1 set Yf $Y2 set LesIds {} foreach i [NombresEntre 0 [expr $N - 1]] { if {$Orient=="X"} { set Xd [expr $X1+$i*$PasX] set Xf [expr $Xd+$PasX] } if {$Orient=="Y"} { set Yd [expr $Y1+$i*$PasY] set Yf [expr $Yd+$PasY] } set Couleur [Nuance [expr $UnPeu + $i*$PasC] $UnPeu $Passion] set Id [$K create rectangle $Xd $Yd $Xf $Yf -fill $Couleur -outline $Couleur ] lappend LesIds $Id } return $LesIds } proc GrapheVecItem Fichier { foreach XYZP [VecItem $Fichier] { foreach {x y z pl} $XYZP { Espionne $XYZP lappend LesX $x lappend LesY $y } Graphe $LesX $LesY } } proc VecItem Fichier { if { ! [file exists $Fichier]} { return {} } set LesXYZP {} foreach Ligne [LesLignesDuFichier $Fichier] { if { ! [regexp -nocase {[a-z0-9;]} $Ligne]} { continue } if { [regexp -nocase {^\#} $Ligne]} { continue } if {[regexp {;} $Ligne] || [regexp {\:=} $Ligne]} { if {[info exists XYZP]} { lappend LesXYZP $XYZP unset XYZP } } if {[regexp {;} $Ligne]} { continue } if {[regexp {\:=} $Ligne]} { regsub {\:=} $Ligne " " Ligne scan $Ligne "%s %s %s" Objet MotVec ItemOuDots if { ! [regexp -nocase "vec" $MotVec]} { FaireLire "$Ligne is wrong" } set Item [regexp -nocase "^item" $ItemOuDots] set Dots [regexp -nocase "^dots" $ItemOuDots] set XYZP {} set y 0.0 continue } regsub -all {[\t\,]} $Ligne " " Ligne set y [expr $y+1] set z 0.0 scan $Ligne "%s %f %f %f" PL x y z set PL [string tolower $PL] if {$Item} { lappend XYZP $z $y $x $PL } if {$Dots} { lappend XYZP $x $y $z p lappend XYZP $x $y $z l } } return $LesXYZP } proc CouleurParTypeEtNom {TypeDeCouleur Nom K} { global RepertoireDuGenome global CouleurDuFond global LesORFsEnOverlap global CodonPreference CodonPreferenceMini CodonPreferenceMaxi global CouleurDeFrame SignificationCouleurDeFrame global CouleurDuCodonStart SignificationCouleurDuCodonStart global CouleurFiabiliteFonction SignificationCouleurFiabiliteFonction global CouleurDeLaSuperClasse SignificationCouleurDeLaSuperClasse global TasTamis if {[regexp "GLIMMER" $Nom]} { return $CouleurDuFond } if { $TypeDeCouleur=="ClassesFonctionnelles" && ! [info exists CouleurDeLaSuperClasse]} { set CouleurDeLaSuperClasse(Hy) "yellow" set CouleurDeLaSuperClasse(NC) "green" set CouleurDeLaSuperClasse(CP) "blue" set CouleurDeLaSuperClasse(Tl) "orange" set CouleurDeLaSuperClasse(RT) "red" set CouleurDeLaSuperClasse(CE) "blue" set CouleurDeLaSuperClasse(Me) "green" set CouleurDeLaSuperClasse(tR) "black" set CouleurDeLaSuperClasse(RR) "black" set CouleurDeLaSuperClasse(IG) $CouleurDuFond foreach {SC ValCouleurDeLaSuperClasse} [array get CouleurDeLaSuperClasse] { if {[info exists SignificationCouleurDeLaSuperClasse($ValCouleurDeLaSuperClasse)]} { append SignificationCouleurDeLaSuperClasse($ValCouleurDeLaSuperClasse) "or $SC" } else { set SignificationCouleurDeLaSuperClasse($ValCouleurDeLaSuperClasse) "SuperClass $SC" } } } if { $TypeDeCouleur=="FiabiliteFonction" && ! [info exists CouleurFiabiliteFonction]} { set CouleurFiabiliteFonction(0) "white" set CouleurFiabiliteFonction(1) "skyblue" set CouleurFiabiliteFonction(2) "skyblue" set CouleurFiabiliteFonction(3) "green" set CouleurFiabiliteFonction(4) "green" set CouleurFiabiliteFonction(5) "yellow" set CouleurFiabiliteFonction(6) "yellow" set CouleurFiabiliteFonction(7) "orange" set CouleurFiabiliteFonction(8) "orange" set CouleurFiabiliteFonction(9) "red" set CouleurFiabiliteFonction(-1) "white" } if { $TypeDeCouleur=="SuivantLaFrame" && ! [info exists CouleurDeFrame] } { set CouleurDeFrame(a) "blue" set CouleurDeFrame(b) "white" set CouleurDeFrame(c) "red" set CouleurDeFrame(d) "yellow" set CouleurDeFrame(e) "orange" set CouleurDeFrame(f) "green" set CouleurDeFrame(T) "brown" set CouleurDeFrame(t) "brown" set CouleurDeFrame(N) "purple" set CouleurDeFrame(n) "purple" set CouleurDeFrame(Z) "grey" set CouleurDeFrame(z) "grey" foreach {F ValCouleurDeFrame} [array get CouleurDeFrame] { if {[info exists SignificationCouleurDeFrame($ValCouleurDeFrame)]} { append SignificationCouleurDeFrame($ValCouleurDeFrame) "or $F" } else { set SignificationCouleurDeFrame($ValCouleurDeFrame) "Frame $F" } } } if { ! [info exists CouleurDuCodonStart]} { set CouleurDuCodonStart(ATG) "green" set CouleurDuCodonStart(GTG) "yellow" set CouleurDuCodonStart(TTG) "orange" set CouleurDuCodonStart(Anormal) "red" set CouleurDuCodonStart(OK) "lightgreen" set CouleurDuCodonStart(Probleme) "white" set CouleurDuCodonStart(Inconnu) "grey" foreach {CS ValCouleurDuCodonStart} [array get CouleurDuCodonStart] { set SignificationCouleurDuCodonStart($ValCouleurDuCodonStart) "StartCodon $CS" } } switch "Coloration_$TypeDeCouleur" { "Coloration_WithXColumn" { # 1.0 if {[WithXColumn $Nom]} { set Couleur "green" } else { set Couleur "lightblue" } SetSignification $K green "Contains a column of XMotif" SetSignification $K lighblue "No full column" } "Coloration_XMotif" { # 1.0 set Couleur [HasXMotif $Nom Color] SetSignification $K green "Contains XMotif" SetSignification $K lighblue "No XMotif" } "Coloration_XMotif16S" { # 1.0 set Couleur [HasXMotif16S $Nom Color] SetSignification $K green "Contains XMotif from ARN16S" SetSignification $K lighblue "No XMotif from ARN16S" } "Coloration_Transcriptional_Units" { # 1.0 set Couleur [TU $Nom Color] SetSignification $K color "According to Trandcriptional Units" } "Coloration_FromTamis" { # 9.99 noWeb set Couleur "grey" if {[info exists TasTamis($Nom)]} { set Couleur "green" } if {[info exists TasTamis(FromTamis)]} { SetSignification $K green "Ok in tamis [set TasTamis(FromTamis)]" SetSignification $K grey "No in tamis [set TasTamis(FromTamis)]" } } "Coloration_Taxonomy" { # 1.0 noWeb set Couleur "white" set Taxo [Taxonomy $Nom] if {[regexp "Virus" $Taxo]} { set Couleur "darkgrey" ; SetSignification $K darkgrey "Virus"} if {[regexp "Bacteria" $Taxo]} { set Couleur "yellow" ; SetSignification $K yellow "Bacteria"} if {[regexp "Archae" $Taxo]} { set Couleur "blue" ; SetSignification $K blue "Archae"} if {[regexp "Eukaryota" $Taxo]} { set Couleur "pink" ; SetSignification $K pink "Eukaryota"} if {[regexp "Metazoa" $Taxo]} { set Couleur "red" ; SetSignification $K red "Metazoa"} if {[regexp "Nematoda" $Taxo]} { set Couleur "orange" ; SetSignification $K orange "Nematoda"} if {[regexp "Arthropoda" $Taxo]} { set Couleur "purple" ; SetSignification $K purple "Arthropoda"} if {[regexp "sapiens" $Taxo]} { set Couleur "green" ; SetSignification $K green "Human"} if {[regexp "musculus" $Taxo]} { set Couleur "cyan" ; SetSignification $K cyan "Mouse"} if {[regexp "Xenopus" $Taxo]} { set Couleur "brown" ; SetSignification $K brown "Xenopus"} if {[regexp "elegans" $Taxo]} { set Couleur "lightgreen" ; SetSignification $K lightgreen "C.elegans"} } "Coloration_Outlier" { # 1.1 Web set Couleur "white" set OutlierScore [OutlierScore $Nom] scan $OutlierScore "%s" OutlierScore if { $OutlierScore==""} { set OutlierScore -9 } if { [expr $OutlierScore < -9 ] } { set Couleur "green" } if { [expr -9 <= $OutlierScore] && [expr $OutlierScore < -1 ] } { set Couleur "yellow" } if { [expr -1 <= $OutlierScore] && [expr $OutlierScore < 1 ] } { set Couleur "orange" } if { [expr 1 <= $OutlierScore] && [expr $OutlierScore < 99 ] } { set Couleur "red" } if { [expr 99 <= $OutlierScore] } { set Couleur "lightblue" } SetSignification $K white "Not yet available" SetSignification $K green "Outlier better at least e10" SetSignification $K yellow "Outlier with equal expect" SetSignification $K red "Reference better than Outlier" SetSignification $K skyblue "No outlier or reference in the blast" } "Coloration_Balibase" { # 1.1 noWeb set Couleur "white" set Classe [ExtraitInfo $Nom "RV"] if {[regexp "11" $Classe]} { set Couleur "red" } if {[regexp "12" $Classe]} { set Couleur "orange" } if {[regexp "20" $Classe]} { set Couleur "yellow" } if {[regexp "30" $Classe]} { set Couleur "skyblue" } if {[regexp "40" $Classe]} { set Couleur "blue" } if {[regexp "50" $Classe]} { set Couleur "purple" } SetSignification $K red "Class Ref1v1" SetSignification $K orange "Class Ref1v2" SetSignification $K yellow "Class Ref2" SetSignification $K skyblue "Class Ref3" SetSignification $K blue "Class Ref4" SetSignification $K purple "Class Ref5" } "Coloration_CheckCompletion" { # 1.1 noWeb set Couleur [CheckCompletion $Nom Color] SetSignification $K $Couleur [GeneEtendu $Nom Signification] } "Coloration_Rejected" { # 1.1 noWeb set Couleur "white" set Reject [ExtraitInfo $Nom "Rejected:"] if {$Reject!=""} { set Couleur "green" } if {[regexp "NoRejected" $Reject]} { set Couleur "red" } SetSignification $K red "NoRejected" SetSignification $K green "Rejected" SetSignification $K green "Not yet annotated" } "Coloration_ScerevisiaeEhistolica" { # 1.1 noWeb set Couleur "green" set Sc [ExtraitInfo $Nom "Reciproc1_blastpSc:"] set Eh [ExtraitInfo $Nom "Reciproc1_blastpEhistolica:"] if { [regexp "^No" $Sc] && [regexp "^No" $Eh]} { set Couleur "yellow" } if { [regexp "^No" $Sc] && ! [regexp "^No" $Eh]} { set Couleur "blue" } if { ! [regexp "^No" $Sc] && [regexp "^No" $Eh]} { set Couleur "red" } if { ! [regexp "^No" $Sc] && ! [regexp "^No" $Eh]} { set Couleur "green" } SetSignification $K yellow "-Sc -Eh" SetSignification $K blue "-Sc +Eh" SetSignification $K red "+Sc -Eh" SetSignification $K green "+Sc +Eh" } "Coloration_ScerevisiaeTbrucei" { # 1.1 noWeb set Couleur "green" set Sc [ExtraitInfo $Nom "Reciproc1_blastpSc:"] set Tb [ExtraitInfo $Nom "Reciproc_blastpTbrucei:"] if { [regexp "^No" $Sc] && [regexp "^No" $Tb]} { set Couleur "yellow" } if { [regexp "^No" $Sc] && ! [regexp "^No" $Tb]} { set Couleur "blue" } if { ! [regexp "^No" $Sc] && [regexp "^No" $Tb]} { set Couleur "red" } if { ! [regexp "^No" $Sc] && ! [regexp "^No" $Tb]} { set Couleur "green" } SetSignification $K yellow "-Sc -Tb" SetSignification $K blue "-Sc +Tb" SetSignification $K red "+Sc -Tb" SetSignification $K green "+Sc +Tb" } "Coloration_ScerevisiaePfalciparum" { # 1.1 noWeb set Couleur "green" set Sc [ExtraitInfo $Nom "Reciproc1_blastpSc:"] set Pf [ExtraitInfo $Nom "Reciproc_blastpPfalciparum:"] if { [regexp "^No" $Sc] && [regexp "^No" $Pf]} { set Couleur "yellow" } if { [regexp "^No" $Sc] && ! [regexp "^No" $Pf]} { set Couleur "blue" } if { ! [regexp "^No" $Sc] && [regexp "^No" $Pf]} { set Couleur "red" } if { ! [regexp "^No" $Sc] && ! [regexp "^No" $Pf]} { set Couleur "green" } SetSignification $K yellow "-Sc -Pf" SetSignification $K blue "-Sc +Pf" SetSignification $K red "+Sc -Pf" SetSignification $K green "+Sc +Pf" } "Coloration_ReciprocTbrucei" { # 1.1 noWeb set Couleur "green" set Reciproc [ExtraitInfo $Nom "Reciproc_blastpTbrucei:"] if {[regexp "NoBlastFile" $Reciproc]} { set Couleur "white" } if {[regexp "NoHitFound" $Reciproc]} { set Couleur "grey" } if {[regexp "NoSequenceFor" $Reciproc]} { set Couleur "lightgrey" } if {[regexp "NoBlastResultFor" $Reciproc]} { set Couleur "orange" } if {[regexp "NoReciprocalHitFor" $Reciproc]} { set Couleur "red" } SetSignification $K green "ReciprocExists" SetSignification $K white "NoBlastFile" SetSignification $K grey "NoHitFound" SetSignification $K lightgrey "NoSequenceFor" SetSignification $K orange "NoBlastResultFor" SetSignification $K red "NoReciprocalHitFor" } "Coloration_ReciprocPfalciparum" { # 1.1 noWeb set Couleur "green" set Reciproc [ExtraitInfo $Nom "Reciproc_blastpPfalciparum:"] if {[regexp "NoBlastFile" $Reciproc]} { set Couleur "white" } if {[regexp "NoHitFound" $Reciproc]} { set Couleur "grey" } if {[regexp "NoSequenceFor" $Reciproc]} { set Couleur "lightgrey" } if {[regexp "NoBlastResultFor" $Reciproc]} { set Couleur "orange" } if {[regexp "NoReciprocalHitFor" $Reciproc]} { set Couleur "red" } SetSignification $K green "ReciprocExists" SetSignification $K white "NoBlastFile" SetSignification $K grey "NoHitFound" SetSignification $K lightgrey "NoSequenceFor" SetSignification $K orange "NoBlastResultFor" SetSignification $K red "NoReciprocalHitFor" } "Coloration_Famille" { # 1.1 noWeb set Couleur "white" set Famille [ExtraitInfo $Nom "Famille:"] if {[regexp "P62" $Famille]} { set Couleur "green" } if {[regexp "DOS" $Famille]} { set Couleur "yellow" } if {[regexp "SAP" $Famille]} { set Couleur "red" } if {[regexp "Other" $Famille]} { set Couleur "grey" } SetSignification $K green "Famille P62" SetSignification $K yellow "Famille DOS" SetSignification $K red "Famille SAP" SetSignification $K grey "Famille Other" } "Coloration_Classes" { # 1.1 noWeb set Couleur "white" set Classe [ExtraitInfo $Nom "Class"] if {[regexp "1a" $Classe]} { set Couleur "red" } if {[regexp "1b" $Classe]} { set Couleur "orange" } if {[regexp "1c" $Classe]} { set Couleur "yellow" } if {[regexp "2a" $Classe]} { set Couleur "skyblue" } if {[regexp "2b" $Classe]} { set Couleur "blue" } if {[regexp "2c" $Classe]} { set Couleur "purple" } SetSignification $K red "Class 1a" SetSignification $K orange "Class 1b" SetSignification $K yellow "Class 1c" SetSignification $K skyblue "Class 2a" SetSignification $K blue "Class 2b" SetSignification $K purple "Class 2c" } "NoColoration_ContigsAlternes" { # 1.2 noWeb set Couleur "grey" scan [ContigDuPAB $Nom] "%s" Contig if {[regexp {[02468]$} $Contig]} { set Couleur "white" } if {[regexp {[13579]$} $Contig]} { set Couleur "black" } SetSignification $K white "Contig even" SetSignification $K black "Contig odd" SetSignification $K grey "Contig unknown" } "Coloration_DifferentialDisplay" { # 1.8 noWeb set Couleur [DifferentialDisplay $Nom Color] SetSignification $K $Couleur [DifferentialDisplay $Nom Signification] } "Coloration_GeneEtendu" { # 2.1 noWeb set Couleur [GeneEtendu $Nom Color] SetSignification $K $Couleur [GeneEtendu $Nom Signification] } "Coloration_SuivantLaFrame" { # 2.2 set Couleur [set CouleurDeFrame([Box $Nom frame])] SetSignification $K $Couleur [set SignificationCouleurDeFrame($Couleur)] } "Coloration_CodonStartMVL" { # 2.3 if {[info exists CouleurDuCodonStart([NucDuCodonStart $Nom])]} { set Couleur $CouleurDuCodonStart([NucDuCodonStart $Nom]) } else { Warne "Codon anormal en $Nom" set Couleur $CouleurDuCodonStart(Anormal) } SetSignification $K $Couleur [set SignificationCouleurDuCodonStart($Couleur)] } "Coloration_BiaisEnGC" { # 2.4 set GC [CompositionEn GC $Nom] if { $GC == "" } { set Couleur "white" SetSignification $K $Couleur "GC skew no value" } else { set Couleur [QuelInterval $GC [LesSeuilsGC] [CouleursDuRougeAuBleu 5]] set Signif [QuelInterval $GC [LesSeuilsGC] [LesSeuilsGC "SignificationMerci"]] SetSignification $K $Couleur $Signif } } "Coloration_Overlap" { # 2.5 if { [Fantome $Nom] } { set Couleur $CouleurDuFond SetSignification $K $Couleur "Overlap Fantome" } else { set Couleur "green" SetSignification $K $Couleur "No overlap" set Olap [Overlap $Nom] regsub -all {Overlap\: *} $Olap "/" Olap if { $Olap != "" && $Olap != "/" } { if {[regexp "I begin" $Olap]} { set Couleur "red" SetSignification $K $Couleur "Overlap of more than 4 bases" } if {[regexp "/1 bases. I begin" $Olap]} { set Couleur "orange" SetSignification $K $Couleur "Overlap 1 base (as taAtg or tgAtg or taGtg)" } if {[regexp "/4 bases. I begin" $Olap]} { set Couleur "yellow" SetSignification $K $Couleur "Overlap 4 bases (as aTGa or gTGa or tTGa)" } if {[regexp "I am in" $Olap]} { set Couleur "blue" SetSignification $K $Couleur "Full overlaped" } } } } "Coloration_ShineDalgarno" { # 2.6 switch -regexp [ShineDalgarno $Nom] { "^bons" { set Couleur "green" SetSignification $K $Couleur "With ShineDalgarno" } "^mets" { set Couleur "yellow" SetSignification $K $Couleur "ShineDalgarno if you change StartCodon" } "^loin" { set Couleur "orange" SetSignification $K $Couleur "Far ShineDalgarno" } "^sans" { set Couleur "red" SetSignification $K $Couleur "NoShineDalgarno" } default { set Couleur $CouleurDuFond } } } "NoColoration_CodonPreference" { if { ! [info exists CodonPreference] } { ChargeCodonPreference } if { ! [info exists CodonPreference($Nom)] } { set Couleur $CouleurDuFond SetSignification $K $Couleur "CodonPreference no value" } else { set Preference [set CodonPreference($Nom)] set ValeurEntre0et1 [expr ($Preference-$CodonPreferenceMini) / ($CodonPreferenceMaxi-$CodonPreferenceMini)] set Couleur [Nuance $ValeurEntre0et1] } SetSignification $K $Couleur "CodonPreference [setCodonPreference($Nom)]" } "NoColoration_TrogStatus" { set Couleur "grey" set Status [TrogStatus $Nom] if {[regexp -- "^0" $Status]} { set Couleur "red" } if {[regexp -- "^1" $Status]} { set Couleur "yellow" } if {[regexp -- "^2" $Status]} { set Couleur "green" } if {[regexp -- "-1" $Status]} { set Couleur "grey" } SetSignification $K red "TrogStatus Loss" SetSignification $K yellow "TrogStatus FalseOrthologue" SetSignification $K green "TrogStatus TrueOrthologue" SetSignification $K grey "TrogStatus NoOrthologue" } "Coloration_RepeatMasker" { # 3.2 noWeb set Couleur [QuelMask $Nom "ColorPlease"] SetSignification $K $Couleur [QuelMask $Nom] } "Coloration_RepeatMRM" { # 3.21 noWeb set Couleur [QuelMaskMRM $Nom "ColorPlease"] SetSignification $K $Couleur [QuelMaskMRM $Nom] } "Coloration_PolyLocalization" { # 3.5 noWeb set Couleur [PolyLocalise $Nom "ColorPlease"] SetSignification $K $Couleur [PolyLocalise $Nom] } "Coloration_OverlapAffymetrix" { # 3.6 noWeb if {[WithOverlapAffymetrix $Nom]} { set Couleur "green" SetSignification $K $Couleur "Affymetrix overlap" } else { set Couleur "grey" SetSignification $K $Couleur "No Affymetrix overlap" } } "Coloration_CompareSeqWithQuery" { # 3.7 set FichierTFA "[RepertoireDuGenome]/prottfa/$Nom" set AutreRep "[RepertoireDuGenome]/prottfainitial" set MS [MemesSequencesDansFichiersTFA $FichierTFA $AutreRep "Pourquoi"] set Couleur "black" regexp {\(([a-z]+)\)} $MS Match Couleur SetSignification $K $Couleur "$MS" } "Coloration_NombreDeCopainsDansBlast" { # 4.1 CouleurAuNombreDeCopainsDansBlast SetAllSignification $K set Couleur [CouleurAuNombreDeCopainsDansBlast [NombreDeCopainsDansBlast $Nom]] } "Coloration_HitMultiple" { # 4.2 set HitMultiple [HitMultiple $Nom] if {$HitMultiple=={}} { set Couleur "green" SetSignification $K "green" "No Multiple Hit" } else { if {[regexp "FS no" [ExtraitInfo $Nom "EP"]]} { set Couleur "yellow" SetSignification $K "yellow" "With Multiple Hit without Frameshift" } else { set Couleur "red" SetSignification $K "red" "With Multiple Hit and Frameshift" } } } "Coloration_PDBstructures" { # 4.3 set Couleur "white" set n [WithPDB $Nom] if {29 < $n } { set Couleur "red" } if { 9 < $n && $n <= 29 } { set Couleur "orange" } if { 5 < $n && $n <= 9 } { set Couleur "yellow" } if { 1 < $n && $n <= 5 } { set Couleur "green" } if { 0 < $n && $n <= 1 } { set Couleur "blue" } if { $n <= 0 } { set Couleur "grey" } SetSignification $K red "known PDB structures 29 < n" SetSignification $K orange "known PDB structures 9 < n && n <= 29 " SetSignification $K yellow "known PDB structures 5 < n && n <= 9 " SetSignification $K green "known PDB structures 1 < n && n <= 5 " SetSignification $K blue "known PDB structures 0 < n && n <= 1 " SetSignification $K grey "known PDB structures n == 0 " SetSignification $K white "known PDB structures no value" } "Coloration_PDBDansGroupes" { # 4.3 set Couleur [NombreDePDBDansGroupes $Nom "couleur"] SetSignification $K $Couleur [NombreDePDBDansGroupes $Nom "signification"] } "Coloration_NumberOfParalogues" { # 4.8 set nPara [llength [ParaloguesDe $Nom]] if {$nPara<=0} { set Couleur "blue" SetSignification $K $Couleur "$nPara paralogues" } elseif {$nPara==1} { set Couleur "yellow" SetSignification $K $Couleur "$nPara paralogues" } elseif {$nPara<=3} { set Couleur "green" SetSignification $K $Couleur "2 <= nParalogues <= 3" } elseif {$nPara<=8} { set Couleur "orange" SetSignification $K $Couleur "4 <= nParalogues <= 8" } else { set Couleur "red" SetSignification $K $Couleur "9 <= nParalogues" } } "Coloration_ProttfaFileExists" { # 4.9 set TheRep "prottfa" if {[file exists "$RepertoireDuGenome/$TheRep/$Nom"]} { set Couleur "green" SetSignification $K $Couleur "file exists in $TheRep" } else { set Couleur "red" SetSignification $K $Couleur "file does not exist in $TheRep" } } "Coloration_MSFParaloguesExiste" { # 4.9 if {[file exists "$RepertoireDuGenome/msfparalogues/$Nom"]} { set Couleur "green" SetSignification $K $Couleur "Paralog exist" } else { set Couleur "blue" SetSignification $K $Couleur "Paralog no" } } "Coloration_AnchorsCount" { # 5.1 noWeb set AC [AnchorsCount $Nom] set AC "$AC.0" set Couleur [QuelInterval $AC [LesSeuilsAC] [LesSeuilsAC "CouleurMerci"]] set Signif [QuelInterval $AC [LesSeuilsAC] [LesSeuilsAC "SignificationMerci"]] SetSignification $K $Couleur $Signif } "Coloration_MDScore" { # 5.1 set MD [MDScore $Nom] set Couleur [QuelInterval $MD [LesSeuilsMDScore] [LesSeuilsMDScore "CouleurMerci"]] set Signif [QuelInterval $MD [LesSeuilsMDScore] [LesSeuilsMDScore "SignificationMerci"]] SetSignification $K $Couleur $Signif } "Coloration_WithKegg" { # 5.9 if {[AvecKegg $Nom]=="Yes"} { set Couleur "green" SetSignification $K $Couleur "Kegg information is available" } if {[AvecKegg $Nom]=="Nothing"} { set Couleur "red" SetSignification $K $Couleur "No Kegg was found" } if {[AvecKegg $Nom]=="NotAvailable"} { set Couleur "grey" SetSignification $K $Couleur "No Kegg not yet processed" } } "Coloration_HomologDetectionAgreement" { # 6.1 set Couleur [HomologDetectionAgreement $Nom "Color"] SetSignification $K $Couleur [HomologDetectionAgreement $Nom "Signif"] } "Coloration_PresenceAndAbsenceMSF" { # 6.2 if {[PresenceEtAbsenceDesGenomesComplets $Nom "MSF"]} { set Couleur "green" SetSignification $K $Couleur "Present" } else { set Couleur "grey" SetSignification $K $Couleur "Absent" } } "Coloration_PresenceAndAbsenceBlastP" { # 6.3 if {[PresenceEtAbsenceDesGenomesComplets $Nom "BlastP"]} { set Couleur "green" SetSignification $K $Couleur "Present" } else { set Couleur "grey" SetSignification $K $Couleur "Absent" } } "Coloration_PresenceAndAbsenceTBlastN" { # 6.4 if {[PresenceEtAbsenceDesGenomesComplets $Nom "TBlastN"]} { set Couleur "green" SetSignification $K $Couleur "Present" } else { set Couleur "grey" SetSignification $K $Couleur "Absent" } } "Coloration_TaxoSpecif" { # 6.45 set Couleur [TaxoSpecif $Nom "color"] SetSignification $K $Couleur [TaxoSpecif $Nom "signification"] } "Coloration_SameClusterXHda" { # 6.5 noWeb set Couleur [ColorationDesClustersXHdaDesNomsPiques $Nom "Couleur"] SetSignification $K $Couleur [ColorationDesClustersXHdaDesNomsPiques $Nom "Signif"] } "Coloration_PhylumOrtho" { # 6.6 set Couleur "lightgrey" set BAE [PhylumsOrthologues $Nom] if {[regexp "BAE" $BAE]} { set Couleur "white" } if {[regexp "BAe" $BAE]} { set Couleur "green" } if {[regexp "BaE" $BAE]} { set Couleur "orange" } if {[regexp "Bae" $BAE]} { set Couleur "yellow" } if {[regexp "bAE" $BAE]} { set Couleur "purple" } if {[regexp "bAe" $BAE]} { set Couleur "blue" } if {[regexp "baE" $BAE]} { set Couleur "red" } if {[regexp "bae" $BAE]} { set Couleur "grey" } SetSignification $K white "BAE high all phylums" SetSignification $K green "BAe low Eukaryota" SetSignification $K orange "BaE low Archaea" SetSignification $K yellow "Bae Bacteria" SetSignification $K purple "bAE low Bacteria" SetSignification $K blue "bAe high Archaea" SetSignification $K red "baE high Eukariota" SetSignification $K grey "bae low all phylums" SetSignification $K lightgrey "bae no value" } "Coloration_NearestOrganismsHit" { # 6.5 set Couleur "lightgrey" set NOH [NearestOrganismsHit $Nom] if {$NOH==0} { set Couleur "red" } if {$NOH==1} { set Couleur "green" } if {$NOH==2} { set Couleur "blue" } SetSignification $K green "Hit in nearest organisms" SetSignification $K red "No hit found in nearest organisms" SetSignification $K blue "No hit at all" SetSignification $K lightgrey "No value" } "Coloration_OperonsHomologues" { # 6.5 set N [CompteDesOrganismesAyantMemeOperon $Nom] if { $N == 0 } { set Couleur "grey" SetSignification $K $Couleur "ClusterMaintenance Zero" } else { set Couleur [QuelInterval $N [LesSeuilsOperonsHomologues] [CouleursDuBleuAuRouge 5]] set Signif [QuelInterval $N [LesSeuilsOperonsHomologues] [LesSeuilsOperonsHomologues "SignificationMerci"]] SetSignification $K $Couleur $Signif } } "Coloration_DeletedStart" { # 7.1 noWeb if {[DeletedStart $Nom]} { set Couleur "red" SetSignification $K $Couleur "PossibleDeletedStart" } else { set Couleur "green" SetSignification $K $Couleur "No information about start" } } "Coloration_CodonStartOK" { # 7.1 noWeb set Couleur $CouleurDuCodonStart(Inconnu) if {[regexp -nocase "OK" [CodonStart $Nom]] } { set Couleur $CouleurDuCodonStart(OK) } if {[regexp -nocase "Problem" [CodonStart $Nom]] } { set Couleur $CouleurDuCodonStart(Probleme) } SetSignification $K $Couleur [set SignificationCouleurDuCodonStart($Couleur)] } "Coloration_StartCodonColor" { # 7.1 set Couleur [StartCodonReport $Nom "Couleur"] SetSignification $K $Couleur [StartCodonReport $Nom "Signification"] } "Coloration_DiffBlaAli" { # 7.2 set Couleur "white" set DBA [DiffBlaAli $Nom] if {[regexp "^No" $DBA]} { set Couleur "grey" } if {[regexp "^Same" $DBA]} { set Couleur "green" } if {[regexp "^Close" $DBA]} { set Couleur "orange" } if {[regexp "^Different" $DBA]} { set Couleur "red" } SetSignification $K red "Blast vs DbClustal Different" SetSignification $K orange "Blast vs DbClustal Close" SetSignification $K green "Blast vs DbClustal same" SetSignification $K grey "Blast vs DbClustal no alignment" SetSignification $K white "Blast vs DbClustal no value" } "Coloration_Target" { # 7.3 set Target [ExtraitInfo $Nom "Target"] if {$Target==""} { set Couleur "grey" SetSignification $K $Couleur "No Target information available" } else { if {[regexp -nocase "OK" $Target]} { set Couleur "green" SetSignification $K $Couleur "Target OK" } else { set Couleur "lightblue" SetSignification $K $Couleur "not selected as target" } } } "Coloration_CAIecol" { # 7.3 set x [CAI $Nom] if { $x == "" } { set Couleur "white" SetSignification $K $Couleur "CAI no value" } else { set Couleur [QuelInterval $x [LesSeuilsCAI] [CouleursDuRougeAuBleu 5]] set Signif [QuelInterval $x [LesSeuilsCAI] [LesSeuilsCAI "SignificationMerci"]] SetSignification $K $Couleur $Signif } } "Coloration_HydrophobicIndex" { # 7.4 set Couleur "white" set H [Hydrophobicity $Nom "Hydro"] if { $H <= 0.85 } { set Couleur "yellow" } if { 0.85 < $H } { set Couleur "blue" } SetSignification $K yellow "HydrophobicIndex less than 0.85" SetSignification $K blue "HydrophobicIndex more than 0.85" SetSignification $K white "HydrophobicIndex no value" } "Coloration_HydrophobicHelices" { # 7.5 set Couleur "white" set nH [Hydrophobicity $Nom "nHelices"] if { $nH > 7 } { set Couleur "red" } if { $nH == 7 } { set Couleur "orange" } if { $nH == 6 } { set Couleur "yellow" } if { $nH == 5 } { set Couleur "yellow" } if { $nH == 4 } { set Couleur "green" } if { $nH == 3 } { set Couleur "skyblue" } if { $nH == 2 } { set Couleur "skyblue" } if { $nH == 1 } { set Couleur "skyblue" } if { $nH == 0 } { set Couleur "blue" } SetSignification $K red "HydrophobicHelices 8, and more" SetSignification $K orange "HydrophobicHelices 7" SetSignification $K yellow "HydrophobicHelices 5, 6" SetSignification $K green "HydrophobicHelices 4" SetSignification $K skyblue "HydrophobicHelices 1, 2, 3" SetSignification $K blue "HydrophobicHelices 0" SetSignification $K white "HydrophobicHelices no value" } "Coloration_FiabiliteFonction" { # 9.7 noWeb set FF [FiabiliteFonction $Nom] if { ! [regexp {[0-9]} $FF] } { set Couleur [set CouleurFiabiliteFonction(-1)] SetSignification $K $Couleur "Function reliability bad value" } else { scan $FF "%d" Valeur if { [info exists Valeur] && \ [info exists CouleurFiabiliteFonction($Valeur)] } { set Couleur [set CouleurFiabiliteFonction($Valeur)] SetSignification $K $Couleur "Function reliability $FF" } else { Warne "Code FiabiliteFonction $FF pour $Nom incomprehensible" set Couleur [set CouleurFiabiliteFonction(-1)] SetSignification $K $Couleur "Function reliability bad value" } } } "NoColoration_LesCas" { if {[Fantome $Nom]} { set Couleur $CouleurDuFond } elseif {[regexp "CasNonConnu" [Cas $Nom]]} { set Couleur "white" } elseif {[regexp {^1} [Cas $Nom]]} { set Couleur "black" } elseif {[regexp {1$} [Cas $Nom]]} { set Couleur "red" } elseif {[regexp {1,0$} [Cas $Nom]]} { set Couleur "orange" } elseif {[regexp {1,0,0$} [Cas $Nom]]} { set Couleur "yellow" } else { set Couleur "green" } } "Coloration_PhyloFolle" { # 6.8 noWeb if {[Fantome $Nom]} { set Couleur $CouleurDuFond SetSignification $K $Couleur "no Phylo : Fantome" } elseif {[PhyloFolle $Nom] == 1} { set Couleur "red" SetSignification $K $Couleur "Phylo crazy" } elseif {[PhyloFolle $Nom] == -1} { set Couleur "white" SetSignification $K $Couleur "Phylo no value" } else { set Couleur "green" SetSignification $K $Couleur "Phylo normal" } } "Coloration_ClassesFonctionnelles" { # 9.9 noWeb set SC [SuperClasse [ClasseFonctionnelle $Nom]] if {[info exists CouleurDeLaSuperClasse($SC)]} { set Couleur [set CouleurDeLaSuperClasse($SC)] SetSignification $K $Couleur "Functional class $SC" } else { set Couleur $CouleurDuFond SetSignification $K $Couleur "Functional class no value" } } "NoColoration_InfoExiste" { # 9.3 noWeb if { [file exists "$RepertoireDuGenome/infos/$Nom"] } { if {[regexp "[PreFixe]" $Nom]} { set Couleur "skyblue" SetSignification $K $Couleur "Info file exists for this [PreFixe]" } else { switch -regexp $Nom { "TROU" { set Couleur "grey" SetSignification $K $Couleur "Info file exists for this InterGenicRegion" } "TRNA" { set Couleur "purple" SetSignification $K $Couleur "Info file exists for this TRNA" } "ARN" { set Couleur "brown" SetSignification $K $Couleur "Info file exists for this ARN" } default { FaireLire "pas de couleur affectee a $Nom InfoExiste" } } } } else { set Couleur "red" SetSignification $K $Couleur "Info file does'nt exists." } } default { set Couleur "black" } } return $Couleur } proc PiqueArc {K X Y {Efface ""}} { global RepertoireDuGenome set x [$K canvasx $X] set y [$K canvasy $Y] set Id [$K find withtag current] set SesTags [$K gettags $Id] if { [lindex $SesTags 0] != "Arc" } { return } set Nom [lindex [split [lindex $SesTags 1] "/"] 0] set Voisin [lindex [split [lindex $SesTags 1] "/"] 1] # set Texte [TexteOMO $Nom "Long"] set Texte " Operons: [ORGAorgaDesOperons $Nom Stars]" append Texte "\n[ORGAorgaDesOperons $Nom Names]" regsub ".canvas" $K ".message" M catch {destroy $M} if {$Efface!=""} { return "" } message $M -borderwidth 3 -font {Courier 8} -relief raise -width 800 -text $Texte -background "lightyellow" -foreground "black" place $M -x 10 -y [expr $y-40] -anchor w return $M } proc NomDeScene Nom { set Numero [NumeroDu $Nom] if {[OnTraite "Topos"]} { set Alias [ExtraitInfo $Nom "Alias"] if {$Alias!=""} { return $Numero/$Alias } } set ValiGN [ExtraitInfo $Nom "ValiGN"] if {$ValiGN != "" } { if {[regexp -nocase {^(ncRNA|rRNA|tRNA)} $Nom]} { return "$Nom/$ValiGN" } return "$Numero/$ValiGN" } if {[OnTraiteDesCDNAs]} { set CC [CodeClone $Nom] if {[OnTraiteDesAffymetrix]} { set GN $CC } else { set OwnerOfCDNA [OwnerOfCDNA $Nom] if {$OwnerOfCDNA!=""} { set OwnerOfCDNA "${OwnerOfCDNA}_" } set GN "${OwnerOfCDNA}$CC" } if {$GN!=""} {return "$Numero/$GN" } } if {[OnTraiteUneCollection]} { set Alias [Alias $Nom] if {$Alias!=""} { return "$Numero/$Alias" } if {[OnTraiteSpine]} { set SpineID [SpineID $Nom] if {$SpineID!=""} { return "$Numero/$SpineID" } } } set GN_Narcisse [ExtraitInfo $Nom "GN_Narcisse"] if {$GN_Narcisse!=""} { regsub -nocase { or .*} $GN_Narcisse "" GN_Narcisse return "$Numero/$GN_Narcisse" } return "$Nom" } proc SignificationLingeFrameFard K { global TypeCouleur global TypeFard global TypeCouleurDuLinge global TypeFardDuLinge set U 15 if {[info exists TypeCouleurDuLinge($K)]} { set TypeC [lindex [LaTraduction [list [set TypeCouleurDuLinge($K)]]] 0] set Linge "Banner : $TypeC" set Signif "" set KLinge "${K}_Linge" foreach S [GetSignification "ToutesLesCouleursPossibles" $KLinge] { set Sppp [string range " $S [string repeat "_" $U]" 0 $U] append Signif "\n$Sppp [GetSignification $S $KLinge]" } append Linge "\n$Signif" } else { set Linge "No color for the banner" } if {[info exists TypeCouleur($K)]} { set TypeC [lindex [LaTraduction [list [set TypeCouleur($K)]]] 0] set Frames "ORFs : $TypeC" set Signif "" foreach S [GetSignification "ToutesLesCouleursPossibles" $K] { set Sppp [string range " $S [string repeat "_" $U]" 0 $U] append Signif "\n$Sppp [GetSignification $S $K]" } append Frames "\n$Signif" } else { set Frames "No color for ORFs" } if {[info exists TypeFard($K)]} { set TypeC [lindex [LaTraduction [list [set TypeFard($K)]]] 0] set Fard "Highlight color : $TypeC" } else { set Fard "No highlight color" } return "$Linge\n\n\n$Frames\n\n\n$Fard" } proc NomDeLaFrame {A Orient} { global NomDesFrames if { ! [info exists NomDesFrames]} { set NomDesFrames(0,F) "c" set NomDesFrames(1,F) "a" set NomDesFrames(2,F) "b" set NomDesFrames(0,R) "d" set NomDesFrames(1,R) "e" set NomDesFrames(2,R) "f" set NomDesFrames(TRNA,F) "T" set NomDesFrames(TRNA,R) "t" set NomDesFrames(ARN,F) "N" set NomDesFrames(ARN,R) "n" set NomDesFrames(TROU,F) "Z" set NomDesFrames(TROU,R) "z" } return [set NomDesFrames($A,$Orient)] } proc CompositionEn {Type Nom} { global RepertoireDuGenome global CompositionEnATGC if { ! [info exists CompositionEnATGC]} { set FichierCompositionEnATGC "$RepertoireDuGenome/fiches/compositionenatgc" if { [file exists $FichierCompositionEnATGC] } { foreach Ligne [LesLignesDuFichier $FichierCompositionEnATGC] { scan $Ligne "%s %d %d %d %d %d %d" NomLu pGC pAT pA pT pG pC set CompositionEnATGC($NomLu) "$pGC $pAT $pA $pT $pG $pC" lappend CompositionEnATGC(GC,LaListe) $pGC lappend CompositionEnATGC(AT,LaListe) $pAT lappend CompositionEnATGC(A,LaListe) $pA lappend CompositionEnATGC(T,LaListe) $pT lappend CompositionEnATGC(G,LaListe) $pG lappend CompositionEnATGC(C,LaListe) $pC } } set CompositionEnATGC(Bidon) "EstCharge" } if {$Nom=="LaListeMerci"} { if {[info exists CompositionEnATGC($Type,LaListe)]} { return [set CompositionEnATGC($Type,LaListe)] } else { return {} } } if { ! [info exists CompositionEnATGC($Nom)]} { return "" } scan [set CompositionEnATGC($Nom)] "%d %d %d %d %d %d" pGC pAT pA pT pG pC if {$Type=="ATGC"} { return [set CompositionEnATGC($Nom)] } return [set p$Type] } proc CreeLeFichierCompositionEnATGC {} { global RepertoireDuGenome global ListeDeBoites if { ! [info exists ListeDeBoites]} { ChargeListeDeBoites } set Source "BoutADN" while { ! [BoutADN Existe]} { if {[OuiOuNonMemo "Do I use the [RepertoireDuGenome]/nuctfa files to calculate ATGC composition ?"]} { set Source "[RepertoireDuGenome]/nuctfa" break } if {[OuiOuNonMemo "Do You want to browse a directory containing the nuc files ?"]} { set Source [tk_chooseDirectory -mustexist 1 -initialdir "$RepertoireDuGenome/"] if {$Source==""} { continue } break } if {[OuiOuNon "DO You want to calculate ATGC composition later ?"]} { return "" } } set ntA 0 set ntT 0 set ntG 0 set ntC 0 set lt 0 foreach Boite $ListeDeBoites { set Nom [Box $Boite nom] if {$Source=="BoutADN"} { set Debut [Box $Boite debut] set Fin [Box $Boite fin] set Orient [Box $Boite orient] set ATGC [BoutADN $Debut $Fin $Orient] } else { set FichierNucTFA "$Source/$Nom" if { ! [file exists $FichierNucTFA]} { set ATGC "" } else { set ATGC [QueLaSequenceDuFichierTFA $FichierNucTFA] } } set l [Maxi 1 [string length $ATGC]] set nA 0 set nT 0 set nG 0 set nC 0 for {set i 0} {$i<$l} {incr i} { incr lt set c [string index $ATGC $i] if { $c == "A" } { incr nA ; incr ntA } if { $c == "T" } { incr nT ; incr ntT } if { $c == "G" } { incr nG ; incr ntG } if { $c == "C" } { incr nC ; incr ntC } } lappend Liste "$Nom \ [expr round(($nG+$nC)*100./$l)] \ [expr round(($nA+$nT)*100./$l)] \ [expr round(($nA) *100./$l)] \ [expr round(($nT) *100./$l)] \ [expr round(($nG) *100./$l)] \ [expr round(($nC) *100./$l)]" } set lt [Maxi $lt 1] set Liste [linsert $Liste 0 "AllORFs \ [expr round(($ntG+$ntC)*100./$lt)] \ [expr round(($ntA+$ntT)*100./$lt)] \ [expr round(($ntA) *100./$lt)] \ [expr round(($ntT) *100./$lt)] \ [expr round(($ntG) *100./$lt)] \ [expr round(($ntC) *100./$lt)]"] set FichierCompo "$RepertoireDuGenome/fiches/compositionenatgc" return [SauveLesLignes $Liste dans "$FichierCompo"] } proc AfficheLeSpectreGC {K MinSpectreY MaxSpectreY } { global RepertoireDuGenome set FichierSpectre "$RepertoireDuGenome/fiches/spectregcxy" if { ! [file exists $FichierSpectre]} { return } set HauteurDuSpectreY [expr $MaxSpectreY-$MinSpectreY] set LesCoordonnees "" set n 0 set PremiereLigne 1 foreach Ligne [LesLignesDuFichier $FichierSpectre] { if {$PremiereLigne} { scan $Ligne "%d %d" xMin yMin set PremiereLigne 0 set DeuxiemeLigne 1 continue } if {$DeuxiemeLigne} { scan $Ligne "%d %d" xMax yMax set DeuxiemeLigne 0 set TroisiemeLigne 1 continue } if {$TroisiemeLigne} { scan $Ligne "%d %d" x yMoyen set TroisiemeLigne 0 $K create line \ $xMin [expr $MaxSpectreY-($yMin-$yMin)*($HauteurDuSpectreY)/($yMax-$yMin)] \ $xMax [expr $MaxSpectreY-($yMin-$yMin)*($HauteurDuSpectreY)/($yMax-$yMin)] $K create line \ $xMin [expr $MaxSpectreY-($yMoyen-$yMin)*($HauteurDuSpectreY)/($yMax-$yMin)] \ $xMax [expr $MaxSpectreY-($yMoyen-$yMin)*($HauteurDuSpectreY)/($yMax-$yMin)] $K create line \ $xMin [expr $MaxSpectreY-($yMax-$yMin)*($HauteurDuSpectreY)/($yMax-$yMin)] \ $xMax [expr $MaxSpectreY-($yMax-$yMin)*($HauteurDuSpectreY)/($yMax-$yMin)] continue } scan $Ligne "%d %d" x y set XY " $x [expr $MaxSpectreY-($y-$yMin)*($HauteurDuSpectreY)/($yMax-$yMin)] " append LesCoordonnees $XY if {[incr n] > 100} { eval $K create line $LesCoordonnees set LesCoordonnees $XY set n 1 } } if { $n > 1 } { eval $K create line $LesCoordonnees } } proc AfficheLeSpectreGCenCouleur {K PosLineY } { global RepertoireDuGenome foreach Ligne [LesLignesDuFichier "$RepertoireDuGenome/fiches/spectregc"] { scan $Ligne "%d %d %s" d f Couleur if {[regexp "green" $Couleur]} { continue } $K create line $d $PosLineY $f $PosLineY -fill $Couleur -width 5 } } proc CreeLesFichiersSpectreDesGC {{SequenceADN ""} {Retour ""} {lWin 400}} { global RepertoireDuGenome if {$SequenceADN==""} { global ADN TDN RAC if { ! [info exists ADN]} { ChargeADNetTDNetRAC } } else { set ADN $SequenceADN } set l [string length $ADN] set nGC 0 for {set i 0} {$i<$lWin} {incr i} { set Win($i) "A" set Win([incr i]) "C" incr nGC } set pWin 0 set ntGC 0 set Mi 99 set Ma 0 set OldLimite 0 foreach Limite {25 35 50 100} Couleur {"red" "orange" "green" "blue"} { for {set i $OldLimite} {$i < $Limite} {incr i} { set CouleurDeLaBande($i) $Couleur } set OldLimite $Limite } set CouleurDeLaBande($Limite) $Couleur set OldCouleur "cacadoie" set Oldi 0 for {set i 1} {$i < $l} {incr i} { set c [string index $ADN $i] set w [set Win($pWin)] if { $c == "G" || $c == "C" } { incr nGC 1 ; incr ntGC} if { $w == "G" || $w == "C" } { incr nGC -1 } set Win($pWin) $c set pWin [expr ($pWin+1)%$lWin] set NewpGC [expr ($nGC*100)/$lWin] if {[expr $i>$lWin/2] && [expr $i%($lWin/4)] == 0} { lappend SpectreXY "[expr $i-$lWin/2] $NewpGC" } set pGC $NewpGC set Mi [Mini $Mi $NewpGC] set Ma [Maxi $Ma $NewpGC] set Couleur [set CouleurDeLaBande($pGC)] if { $Couleur != $OldCouleur } { lappend Spectre "[incr Oldi] $i $Couleur" set Oldi $i } set OldCouleur $Couleur } set Moyen [expr ($ntGC*100)/[string length $ADN]] set Entete [list "0 $Mi" "$Oldi $Ma" "0 $Moyen"] set SpectreGCXY [concat $Entete $SpectreXY] if {$Retour=="SpectreGCXY"} { return $SpectreGCXY } set FichierSpectreXY "$RepertoireDuGenome/fiches/spectregcxy" Espionne [SauveLesLignes $SpectreGCXY dans "$FichierSpectreXY"] set FichierSpectre "$RepertoireDuGenome/fiches/spectregc" Espionne [SauveLesLignes $Spectre dans "$FichierSpectre"] } proc RetexteUneBoite {Nom Texte K {Id ""}} { global CouleurDuFond if { $Id == "" } { set Id [$K find withtag "Txt_$Nom"] } if { $Id == "" } { return "" } set AvecOrganismesSimilaires 0 set TexteAvant "" set TexteApres "" if {$AvecOrganismesSimilaires} { set OrganismesSimilaires [lrange [LesOrganismesTresProches] 0 1] if { $OrganismesSimilaires == {}} { return [NomDeScene $Nom] } if {[llength $OrganismesSimilaires] > 0} { set OrgaAvant [lindex $OrganismesSimilaires 0] if {[YaPABdans $Nom] && ! [ExisteOrthologueDans $OrgaAvant $Nom]} { set TexteAvant "+ " } } if {[llength $OrganismesSimilaires] > 1} { set OrgaApres [lindex $OrganismesSimilaires 1] if {[YaPABdans $Nom] && ! [ExisteOrthologueDans $OrgaApres $Nom]} { set TexteApres " +" } } } set BonTexte "${TexteAvant}[NomDeScene $Nom]${TexteApres}" $K itemconfigure $Id -text $BonTexte return "$BonTexte" } proc ReColore {Marque Color} { set tid [lindex [split $Marque :] 0] set tc [lindex [split $Marque :] 1] $tc itemconfigure $tid -fill $Color } proc ReTexte {Marque Texte} { set tid [lindex [split $Marque :] 0] set tc [lindex [split $Marque :] 1] $tc itemconfigure [expr $tid +1] -text $Texte } proc ReelVersEcran {z zMin zMax ZMin ZMax} { set zPlage [expr $zMax-$zMin] if {[expr $zPlage == 0]} { set zPlage 1 } set Z [expr $ZMin + (($z-$zMin)*($ZMax-$ZMin)) / $zPlage] return $Z } proc CouleurAuNombreDeCopainsDansBlast {nCops {K ""}} { global SeuilsNbCops if { ! [info exists SeuilsNbCops]} { if {[OnTraiteMS2PH]} { set SeuilsNbCops(30) 300 set SeuilsNbCops(10) 100 set SeuilsNbCops(5) 50 set SeuilsNbCops(2) 2 set SeuilsNbCops(1) 1 set SeuilsNbCops(0) 0 set SeuilsNbCops(-1) -1 } elseif {[OnTraite "BaDe"]} { set SeuilsNbCops(30) 300 set SeuilsNbCops(10) 100 set SeuilsNbCops(5) 50 set SeuilsNbCops(2) 10 set SeuilsNbCops(1) 1 set SeuilsNbCops(0) 0 set SeuilsNbCops(-1) -1 } elseif {[OnTraite "CilioCarta" "Like"]} { set SeuilsNbCops(30) 5000 set SeuilsNbCops(10) 2500 set SeuilsNbCops(5) 500 set SeuilsNbCops(2) 100 set SeuilsNbCops(1) 3 set SeuilsNbCops(0) 0 set SeuilsNbCops(-1) -1 } elseif {[regexp "MsFinal" [RepertoireDuGenome]]} { set SeuilsNbCops(30) 300 set SeuilsNbCops(10) 100 set SeuilsNbCops(5) 50 set SeuilsNbCops(2) 10 set SeuilsNbCops(1) 1 set SeuilsNbCops(0) 0 set SeuilsNbCops(-1) -1 } else { #rR modifie 2014/03/28 car on en a beaucoup de nos jours !!! set SeuilsNbCops(30) 200 set SeuilsNbCops(10) 100 set SeuilsNbCops(5) 10 set SeuilsNbCops(2) 5 set SeuilsNbCops(1) 1 set SeuilsNbCops(0) 0 set SeuilsNbCops(-1) -1 } } if {$nCops=="SetAllSignification"} { SetSignification $K red "Blast hits : $SeuilsNbCops(30) <= n" SetSignification $K orange "Blast hits : $SeuilsNbCops(10) <= n < $SeuilsNbCops(30)" SetSignification $K yellow "Blast hits : $SeuilsNbCops(5) <= n < $SeuilsNbCops(10)" SetSignification $K green "Blast hits : $SeuilsNbCops(2) <= n < $SeuilsNbCops(5)" SetSignification $K blue "Blast hits : $SeuilsNbCops(1) < n < $SeuilsNbCops(2)" SetSignification $K cyan "Blast hits : $SeuilsNbCops(1) = n " SetSignification $K white "Blast hits : $SeuilsNbCops(0) = n " SetSignification $K grey "Blast hits : no value available" return } if {[expr $SeuilsNbCops(30) <= $nCops]} { return "red"} if {[expr $SeuilsNbCops(10) <= $nCops]} { return "orange"} if {[expr $SeuilsNbCops(5) <= $nCops]} { return "yellow"} if {[expr $SeuilsNbCops(2) <= $nCops]} { return "green"} if {[expr $SeuilsNbCops(1) < $nCops]} { return "cyan"} if {[expr $SeuilsNbCops(1) == $nCops]} { return "blue"} if {[expr $SeuilsNbCops(0) == $nCops]} { return "white"} if {[expr $SeuilsNbCops(-1) == $nCops]} { return "grey"} return "black" } proc HIDDEN_MiseAJourHtml {{W ""} {Action "Append"}} { #rR ne sert certainement a rien ..... a supprimer global MiseAJourHtml if {$W==""} { if {[info exists MiseAJourHtml]} { return $MiseAJourHtml } else { return {} } } if {$Action=="Append"} { return [lappend MiseAJourHtml $W] } if {$Action=="Reset"} { set Old [MiseAJourHtml] set MiseAJourHtml {} return $Old } } proc RecoloreUneBoite {Nom TypeDeCouleur K {Id ""}} { global CouleurDuFond if {[regexp "GLIMMER" $Nom]} { return } if { $Id == "" } { set Id [$K find withtag $Nom] } if {[Fantome $Nom]} { set Couleur $CouleurDuFond set CouleurOutline "black" } else { set Couleur [CouleurParTypeEtNom $TypeDeCouleur $Nom $K] set CouleurOutline $Couleur } if {[Enterre $Nom]} { set CouleurOutline "white" } if {[regexp "rond" $K]} { $K itemconfigure $Id -fill $Couleur } else { $K itemconfigure $Id -fill $Couleur -outline $CouleurOutline } } proc RecoloreUnLinge {Nom TypeDeCouleur K {Id ""}} { global CouleurDuFond global ColorierLesBox ColorierLesLinges if { $Id == "" } { set Id [$K find withtag "Linge$Nom"] } if {0 && [Fantome $Nom]} { set Couleur $CouleurDuFond set CouleurOutline "black" } else { set Couleur [CouleurParTypeEtNom $TypeDeCouleur $Nom $K] set CouleurOutline $Couleur } if {[Enterre $Nom]} { set CouleurOutline "white" } $K itemconfigure $Id -fill $Couleur -outline $Couleur } proc RecoloreLesBoites {TypeDeCouleur K} { global ListeDeBoites OnColorieLesFrames 1 SetSignification $K "AnnulerToutesSignifications" "" foreach Boite $ListeDeBoites { if {[regexp "GLIMMER" $Boite]} { continue } set Nom [Box $Boite nom] set Id [$K find withtag "$Nom"] RecoloreUneBoite $Nom $TypeDeCouleur $K $Id } OnColorieLesFrames 0 #?? MiseAJourHtml $K return $K } proc RecoloreLesLinges {TypeDeCouleur K} { global ListeDeBoites SetSignification $K "AnnulerToutesSignifications" "" foreach Boite $ListeDeBoites { if {[regexp "GLIMMER" $Boite]} { continue } set Nom [Box $Boite nom] set Id [$K find withtag "Linge$Nom"] RecoloreUnLinge $Nom $TypeDeCouleur $K $Id } #?? MiseAJourHtml $K return $K } proc RedefinirLaCouleur {K {NouveauTypeCouleur ""} {Ou ""}} { global TypeCouleur global TypeCouleurDuLinge global TypeFard if {$Ou==""} { set Ou "Boite" } Gs "UpdateK" if {$NouveauTypeCouleur == ""} { set NouveauTypeCouleur [ChoixColoration] } if { $NouveauTypeCouleur != "" } { if {$K!="OrdrePourGif" && [regexp "PresenceAndAbsence" $NouveauTypeCouleur]} { ChoixDesGenomesCompletsPresentsAbsents Ask } if {$NouveauTypeCouleur=="NombreDeCopainsDansBlast"} { NombreDeCopainsDansBlast "Reload" } if {$NouveauTypeCouleur=="HomologDetectionAgreement"} { HomologDetectionAgreement "Reset" } if {$NouveauTypeCouleur=="SameClusterXHda"} { ColorationDesClustersXHdaDesNomsPiques "Reset" } if {$NouveauTypeCouleur=="FromTamis"} { CreeLeTasTamis } if {$Ou=="Boite"} { set TypeCouleur($K) $NouveauTypeCouleur RecoloreLesBoites $NouveauTypeCouleur $K } if {$Ou=="Linge"} { set TypeCouleurDuLinge($K) $NouveauTypeCouleur RecoloreLesLinges $NouveauTypeCouleur $K } if {$Ou=="Fard"} { set TypeFard($K) $NouveauTypeCouleur } } return $K } proc RedefinirLaCouleurDuLinge {K {NouveauTypeCouleur ""}} { return [RedefinirLaCouleur $K $NouveauTypeCouleur "Linge"] } proc RedefinirLeFard {K {NouveauTypeCouleur ""}} { return [RedefinirLaCouleur $K $NouveauTypeCouleur "Fard"] } proc SetSignification {K Couleur {Signe ""}} { global SignificationEnStock if { ! [OnColorieLesFrames] } { append K "_Linge" } if {$Couleur == "AnnulerToutesSignifications"} { if {[info exists SignificationEnStock($K)]} { foreach C [set SignificationEnStock($K)] { catch {unset SignificationEnStock($C,$K)} } catch {unset SignificationEnStock($K)} } } else { if { ! [info exists SignificationEnStock($Couleur,$K)]} { lappend SignificationEnStock($K) $Couleur set SignificationEnStock($Couleur,$K) $Signe } } } proc GetSignification {Couleur K} { global SignificationEnStock if {$Couleur == "ToutesLesCouleursPossibles"} { if {[info exists SignificationEnStock($K)]} { return [set SignificationEnStock($K)] } else { return "" } } if {[info exists SignificationEnStock($Couleur,$K)]} { return [set SignificationEnStock($Couleur,$K)] } else { return "" } } proc ChoixDesGenomesCompletsPresentsAbsents {{Ask ""} {LesGenomesAChoisir ""}} { global ChoixDesGenomesCompletsPresentsAbsents global NotreOrga NotreOS if {$LesGenomesAChoisir=={}} { set LesGenomesAChoisir [LesOrganismesImportantsPourDBClustal] } if { ! [info exists ChoixDesGenomesCompletsPresentsAbsents] || $Ask!=""} { set ChoixDesGenomesCompletsPresentsAbsents {} foreach G $LesGenomesAChoisir { set P [PhylumDuOrganisme $G] lappend LesPGs "$P $G" } set LesPGs [lsort $LesPGs] foreach PG $LesPGs { scan $PG "%s" P regsub "$P " $PG "" G lappend LesGs $G } set PAI [LesPresentsAbsentsIndifferents $LesGs $LesPGs] set LesPresents [lindex $PAI 0] set LesAbsents [lindex $PAI 1] foreach Organisme $LesPresents { lappend ChoixDesGenomesCompletsPresentsAbsents [string toupper [Glossaire $Organisme Court]] } foreach Organisme $LesAbsents { lappend ChoixDesGenomesCompletsPresentsAbsents [string tolower [Glossaire $Organisme Court]] } } return $ChoixDesGenomesCompletsPresentsAbsents } proc SetListeDesPresentsAbsents Liste { global ChoixDesGenomesCompletsPresentsAbsents set ChoixDesGenomesCompletsPresentsAbsents $Liste } proc PresenceEtAbsenceDesGenomesComplets {Nom {Source ""}} { if {$Source==""} { set Source "MSF" } set TexteOo " [ORGAorgaDes${Source}s $Nom] " foreach Oo [ChoixDesGenomesCompletsPresentsAbsents] { if { ! [regexp -nocase $Oo $TexteOo]} { continue } if { ! [regexp " $Oo " $TexteOo]} { return 0 } } return 1 } proc TesteSavantEnBatch {} { set Question "batch set x 3\nbatch set y \$x" puts [QuestionDeScience Paby $Question] exit } proc MiniDeLaListe LesX { set MinX [lindex $LesX 0] foreach X $LesX { set MinX [Mini $X $MinX] } return $MinX } proc MaxiDeLaListe LesX { set MaxX [lindex $LesX 0] foreach X $LesX { set MaxX [Maxi $X $MaxX] } return $MaxX } proc GrapheDuFichier {{Fichier ""} {Format}} { if {$Format==""} { set Format "%f %f" } if {$Format=="dpvd"} { set Format "%d;%d" } if {$Fichier!=""} { foreach Ligne [LesLignesDuFichier $Fichier] { scan $Ligne $Format X Y lappend LesX $X lappend LesY $Y } return [Graphe $LesX $LesY "" "blue" 800 600] } } proc TestGraphe {{Fichier ""}} { set LaListeDesTags [list [list a] [list b] [list c] [list d] [list e] [list f] [list g] [list h]] set K [Graphe {1 3 4 5 6 3 4 2} {3 4 2 1 3 4 4 5} "" "blue" 800 600 {} "" "Beau titre" $LaListeDesTags] set G {1 3 2 5 2 3 2 2} # Graphe $G "Regulier" $K "red" "" "" {400 400 500 550} # Graphe [list 0 [llength $G]] [list [MiniDeLaListe $G] [MiniDeLaListe $G]] $K "red" "" "" {400 400 500 550} $K create text 400 400 -text Coucou MainLeveeSurUnCanva $K set K2 [Graphe {1 3 4 5 6 3 4 2} {3 4 2 1 3 4 4 5} "" "blue" 800 600 {} "" "K2" $LaListeDesTags] Espionne [GraphesEnStock] } proc GraphesEnStock {{Quoi ""} {K ""} {R ""}} { global GraphesEnStock global GraphesEnStockInfo if {$Quoi==""} { set Quoi "GetList" } if { ! [info exists GraphesEnStock]} { set GraphesEnStock {} } if {[string equal -nocase "GetList" $Quoi]} { return $GraphesEnStock } if {[string equal -nocase "Reset" $Quoi]} { set Old $GraphesEnStock set GraphesEnStock {} return $Old } if {[string equal -nocase "HighlightId" $Quoi]} { if {$R==""} { if {[info exists GraphesEnStockInfo($K,HighlightId)]} { return $GraphesEnStockInfo($K,HighlightId) } else { return "" } } set GraphesEnStockInfo($K,HighlightId) $R return $GraphesEnStockInfo($K,HighlightId) } if {[string equal -nocase "Remove" $Quoi]} { set I [lsearch $GraphesEnStock $K] set GraphesEnStock [lreplace $GraphesEnStock $I $I] return $GraphesEnStock } if {[regexp "^\." $Quoi]} { set K $Quoi if { ! [regexp {(.*).canvas} $K Match w]} { return $GraphesEnStock} set D "$w.buttons.dismiss" $D configure -command "GraphesEnStock Remove $K; destroy $w" lappend GraphesEnStock $Quoi return $GraphesEnStock } return $GraphesEnStock } proc GrapheExpressedTissuesOLD {} { set LesSi [string trim [string repeat "100 400 800 400 000 400 400 800 400 000 " 7]] set K [Graphe $LesSi "EnBatons" "" "" 1000 500 "" "" "ExpressTiss" $LesSi] $K create text 300 10 -text "Signal Intensities" -font {Arial 14} } proc Graphe {LesX {LesY {}} {K ""} {Couleur ""} {Largeur ""} {Hauteur ""} {CigCsd {}} {AvecAxes ""} {Titre ""} {LaListeDesTags ""} {DotOnly ""} {BindOnly ""} {LargeurMax ""} {HauteurMax ""}} { global BornesDuGraphe if {$BindOnly!=""} { set LesBind [split $BindOnly "_"] set BindOnly 1 } else { set BindOnly 0 } set DotOnly [string equal -nocase "DotOnly" $DotOnly] set EnBatons 0 if {$LesY=="EnBatons"} { set LesY {} ; set EnBatons 1 } if {$LesY=="Regulier"} { set LesY {}} if {$Couleur==""} { set Couleur "black" } if {$Largeur==""} { if {$K==""} { set Largeur 512 } else { set Largeur [lindex [$K configure -width] 4] } } if {$Hauteur==""} { if {$K==""} { set Hauteur 512 } else { set Hauteur [lindex [$K configure -height] 4] } } if {$CigCsd=={}} { set CigCsd [list \ [expr $Largeur*0.05] [expr $Hauteur*0.05] \ [expr $Largeur*0.95] [expr $Hauteur*0.95]] } ScanLaListe $CigCsd GaucheX BasY DroiteX HautY if {$LargeurMax==""} { set LargeurMax $Hauteur } if {$HauteurMax==""} { set HauteurMax $Hauteur } set LongX [llength $LesX] if {$LongX==0} { return "" } if {$LesY=={}} { set LesY $LesX if {$EnBatons} { set LesY [lreplace $LesY -1 -1 0] } set LongY [llength $LesY] set LesX [NombresEntre 0 [expr $LongY-1]] } if {[info exists BornesDuGraphe($K)]} { ScanLaListe [set BornesDuGraphe($K)] MinX MinY MaxX MaxY } else { set MinX [MiniDeLaListe $LesX] set MaxX [MaxiDeLaListe $LesX] set MinY [MiniDeLaListe $LesY] set MaxY [MaxiDeLaListe $LesY] set NoDistorsion 0 if {$NoDistorsion} { set MinX [Mini $MinX $MinY] set MinY $MinX set MaxX [Maxi $MaxX $MaxY] set MaxY $MaxX } set BornesDuGrapheCourant [list $MinX $MinY $MaxX $MaxY] } if {$MinX==$MaxX} { set PlageX 1 } else { set PlageX [expr $MaxX - $MinX] } if {$MinY==$MaxY} { set PlageY 1 } else { set PlageY [expr $MaxY - $MinY] } set AX [expr 1.0*($DroiteX-$GaucheX)/$PlageX] set AY [expr 1.0*($HautY -$BasY )/$PlageY] set BX [expr $GaucheX-$AX*$MinX] set BY [expr $BasY -$AY*$MinY] if {$K==""} { if {$EnBatons} { set K [UnCanva $LargeurMax $HauteurMax $Hauteur $Largeur "" $Titre] } else { set K [UnCanva $LargeurMax $HauteurMax $Largeur $Hauteur "" $Titre] } set BornesDuGraphe($K) $BornesDuGrapheCourant GraphesEnStock $K } foreach X $LesX Y $LesY { lappend Lesx [expr $AX*$X + $BX] lappend Lesy [expr $AY*$Y + $BY] } set Zerox [expr $AX*0 + $BX] set Zeroy [expr $AY*0 + $BY] set Oldx [lindex $Lesx 0] set OldyM [expr $HauteurMax-[lindex $Lesy 0]] set Prems 1 set MargeX 0 set MargeY 0 set BatonColors [list LightGreen LightBlue] set iBC 0 set nBC [llength $BatonColors] set os 4 Espionne $HauteurMax foreach x $Lesx y $Lesy X $LesX Y $LesY LesTags $LaListeDesTags { set yM [expr $HauteurMax-($y)] lappend LesTags "|" $X $Y $x $yM if {$EnBatons} { set Color [lindex $BatonColors [expr [incr iBC]%$nBC]] $K create rectangle [expr $Zeroy + $MargeY] [expr $Oldx + $MargeX] [expr $y + $MargeY] [expr $x + $MargeX] \ -fill $Color if {[lindex $LesTags 0]!="|"} { $K create text [expr $Zeroy + $MargeY +10] [expr $x + $MargeX -2] -text [lindex $LesTags 0] -anchor nw -tag "tissue" } } else { $K create oval [expr $x-$os] [expr $yM-$os] [expr $x+$os] [expr $yM+$os] \ -fill $Couleur -outline $Couleur \ -tag [linsert $LesTags 1 oval] if { ! $DotOnly} { $K create line $Oldx [expr $OldyM] $x [expr $yM] \ -fill $Couleur \ -tag [linsert $LesTags 1 line] } } set Oldx $x set OldyM $yM } if {$BindOnly} { foreach B $LesBind { $K bind $B "EntreDansCoeur $K %x %y" $K bind $B "SortDeCoeur $K %x %y" } } else { $K bind "all" "EntreDansCoeur $K %x %y" $K bind "all" "SortDeCoeur $K %x %y" } $K raise "tissue" return $K } proc EntreDansCoeur {K X Y {Propagate ""}} { if {$Propagate==""} { set Propagate "Propagate" } if {[regexp {ShowAlso_(.+)} $Propagate Match IdTag]} { set Id [$K find withtag $IdTag] set SmallBox 1 } else { set Id [$K find withtag current] set SmallBox 0 } set Moi [lindex [$K gettags $Id] 0] set Toi [lindex [$K gettags $Id] 1] #rR set Texte "$Moi $Toi" set LesTags [$K gettags $Id] set C [lindex $LesTags end] if {$C=="current"} { set X [lindex $LesTags end-2] set Y [lindex $LesTags end-1] } else { set X [lindex $LesTags end-1] set Y [lindex $LesTags end] } if { ! [regexp {[0-9.]+} "$X$Y"] } { return "" } set Texte [join $LesTags " "] if {$SmallBox} { set R [$K create oval [expr $X-10] [expr $Y-10] [expr $X+10] [expr $Y+10] -outline "black"] GraphesEnStock "HighlightId" $K $R # append Texte " _$R" } regsub ".canvas" $K ".message" M catch {destroy $M} message $M -borderwidth 3 -font {Courier 12} -relief raise -width 300 -text $Texte -background "lightyellow" -foreground "black" set AncreH "" set AncreV "s" if {$Y<500} { set AncreV "n" } if {$X<128} { set AncreH "e" } if {$X>384} { set AncreH "w" } set Ancre "${AncreV}${AncreH}" set XT [expr $X+30] set YT [Maxi 100 [expr $Y-30]] place $M -x [expr $X+10] -y [Maxi 100 [expr $Y-10]] -anchor $Ancre $K create text $XT $YT -text $Texte -fill red -tags "MessageAffiche" if {[string equal -nocase $Propagate "Propagate"]} { foreach KK [GraphesEnStock] { if {$KK==$K} { continue } EntreDansCoeur $KK "" "" "ShowAlso_$Moi" } } return $M } proc SortDeCoeur {K X Y {Propagate ""}} { if {$Propagate==""} { set Propagate "Propagate" } if {[set R [GraphesEnStock "HighlightId" $K]]!=""} { $K delete $R } regsub ".canvas" $K ".message" M catch {destroy $M} if {[string equal -nocase $Propagate "Propagate"]} { foreach KK [GraphesEnStock] { if {$KK==$K} { continue } SortDeCoeur $KK "" "" "DontPropagate" } } $K delete "MessageAffiche" } proc Milieu Nom { return [expr ([Box $Nom debut]+[Box $Nom fin])/2] } proc TGO {} { Espionne [LesGenomesDansLeBonOrdre] Espionne [LesGenomesDansLeBonOrdre] } proc ReOrdonneOoMSF {} { global RepertoireDuGenome set Fichier "$RepertoireDuGenome/fiches/oomsf" set LesG [LesGenomesComplets] set LesT [LesGenomesDansLeBonOrdre] Espionne $LesG Espionne $LesT foreach Ligne [LesLignesDuFichier $Fichier] { scan $Ligne "%s" Nom foreach Oo [lrange [split $Ligne " "] 1 end] G $LesG { set OoDuGenome($G) $Oo } set Liste [list $Nom] foreach T $LesT { lappend Liste [set OoDuGenome($T)] } Espionne [join $Liste " "] lappend LaSortie [join $Liste " "] } Espionne [SauveLesLignes $LaSortie dans $Fichier.arenommer] } proc HistogrammeDesGC {} { set Cumul 0 foreach Nom [ListeDesPABs] { set GC [CompositionEn GC $Nom] set Cumul [expr $Cumul + $GC] lappend Liste $GC } scan [MoyenneEcartMinMaxCumulLong $Liste] "%f %f %d %d" Mo Ec Mi Ma Espionne "$Mo $Ec [expr $Mo-2*$Ec] [expr $Mo+2*$Ec]" Histogramme $Liste exit } proc ToBeOrthologue {Nom {PlusMinusOrgas ""}} { global ToBeOrthologue if {[info exists ToBeOrthologue($PlusMinusOrgas)]} { if {[info exists ToBeOrthologue($Nom)] } { return [set ToBeOrthologue($Nom)] } else { return 0 } } if {[info exists ToBeOrthologue]} { unset ToBeOrthologue } LaListeToBeOrthologue $PlusMinusOrgas if {[info exists ToBeOrthologue($Nom)] } { return [set ToBeOrthologue($Nom)] } else { return 0 } } proc LaListeToBeOrthologue {{PlusMinusOrgas ""}} { global ToBeOrthologue if {$PlusMinusOrgas==""} { FaireLire "Please give a list of organisms with + and - (ie. +paby -mjan -phor +hsp)" set PlusMinusOrgas [Entre] if {$PlusMinusOrgas==""} { return {} } } set Texte $PlusMinusOrgas regsub -all " " $Texte "" Texte if { ! [regexp {^(\+|\-)} $Texte]} { set Texte "+$Texte" } regsub -all {\+|\-} $Texte " &" Texte regsub "^ " $Texte "" Texte set LesVoulus {} set LesExclus {} foreach PMOrga [split $Texte " "] { regsub {^(\+|\-)} $PMOrga "" Orga if {[regexp {\+} $PMOrga]} { lappend LesVoulus $Orga } if {[regexp {\-} $PMOrga]} { lappend LesExclus $Orga } } set LesCommeIlFaut {} foreach Nom [ListeDesPABs] { set ToBeOrthologue($Nom) 0 set Presents [ORGAorgaDesMSFs $Nom "Presents"] set IlEnManqueUn 0 foreach Orga $LesVoulus { if { ! [regexp -nocase $Orga $Presents]} { set IlEnManqueUn 1 ; break } } if {$IlEnManqueUn} { continue } set YAUnExclu 0 foreach Orga $LesExclus { if {[regexp -nocase $Orga $Presents]} { set YAUnExclu 1 ; break } } if {$YAUnExclu} { continue } set ToBeOrthologue($Nom) 1 lappend LesCommeIlFaut $Nom } set ToBeOrthologue($PlusMinusOrgas) 1 return $LesCommeIlFaut } proc RecapitulatifDesOrthologues {Nom {TPA "OTPMA"}} { global RecapitulatifDesOrthologues global SeparationShowBox if { ! [info exists SeparationShowBox]} { set SeparationShowBox [string repeat "-" [string length [ORGAorgaDesMSFs $Nom]]] } set LesLignes "\n" set Operons "" set Names "" if {[regexp "O" $TPA] && [ORGAorgaDesOperons]!="ORGAorgaNonValide"} { set Names [ORGAorgaDesOperons $Nom "Names"] set Operons [ORGAorgaDesOperons $Nom "Stars"] lappend LesLignes " Operons: $Operons" } set TBlastNs "" if {[regexp "T" $TPA] && [ORGAorgaDesTBlastNs]!="ORGAorgaNonValide"} { set Names [ORGAorgaDesTBlastNs $Nom "Names"] set TBlastNs [ORGAorgaDesTBlastNs $Nom "Stars"] lappend LesLignes " TBlastN: $TBlastNs" } if {[regexp "P" $TPA] && [ORGAorgaDesBlastPs]!="ORGAorgaNonValide"} { set Names [ORGAorgaDesBlastPs $Nom "Names"] set BlastPs [ORGAorgaDesBlastPs $Nom "Stars"] lappend LesLignes " BlastP: $BlastPs" } if {[ORGAorgaDesMSFs]!="ORGAorgaNonValide"} { set Names [ORGAorgaDesMSFs $Nom "Names"] if {[regexp "M" $TPA]} { set Missed [ORGAorgaDesMSFs $Nom "StarsP"] lappend LesLignes " InAlign: $Missed" } if {[regexp "A" $TPA]} { set DbClustal [ORGAorgaDesMSFs $Nom "Stars"] lappend LesLignes " WellAlign: $DbClustal" } } lappend LesLignes $Names return [join $LesLignes "\n"] } proc OrgasPresentsDesGenomesComplets Nom { return [ORGAorgaDesMSFs $Nom "Presents"] } proc OrgasHesitantsDesGenomesComplets Nom { return [ORGAorgaDesMSFs $Nom "Hesitants"] } proc OrgasAbsentsDesGenomesComplets Nom { return [ORGAorgaDesMSFs $Nom "Absents"] } proc AfficheORGAorgaDesMSFs {{Etat ""}} { foreach Nom [ListeDesPABs] { lappend LesORGAorga "$Nom [ORGAorgaDesMSFs $Nom $Etat]" } AfficheVariable [join $LesORGAorga "\n"] "AvecRien" "OrthologuesInCompleteGenomes" } proc PhylumDuOrganisme {Organisme {Espece ""}} { if {$Espece!=""} { set Organisme "$Organisme $Espece" } set OS [Glossaire $Organisme Complet] if {$OS!=""} { # set OC [QuestionDeScience QuidSeq "QuidOCOfOS $OS"] set OC [OCduOS $OS] } else { set OS "Inconnu inconnu" set OC "Class unknown" } return [PhylumDuOC $OC] } proc PhylumDuOC OC { if {[regexp -nocase "^Bacteria" $OC]} { return "B" } if {[regexp -nocase "^Archaea" $OC]} { return "A" } if {[regexp -nocase "^Eukaryota" $OC]} { return "E" } if {[regexp -nocase "^Virus" $OC]} { return "V" } return "X" } proc PhylumDuGenome {Genome {Quoi "Phylum"}} { global PhylumDuGenome global RepertoireDuGenome set FichierPhylumDuGenome "$RepertoireDuGenome/fiches/phylumdugenome" Wup "returns B A E V X or the whole class if Quoi is OC" if {[info exists PhylumDuGenome($Genome,$Quoi)]} { return [set PhylumDuGenome($Genome,$Quoi)] } if {[file exists $FichierPhylumDuGenome]} { array set PhylumDuGenome [LesLignesDuFichier $FichierPhylumDuGenome] } else { foreach G [LesGenomesComplets] { set OS [Glossaire $G Complet] regsub " " $OS "_" Genre_espece lappend LesGenre_espece $Genre_espece } set Genres_especes [join $LesGenre_espece "|"] set Retour [QuestionDeScience QuidSeq "QuidOCsOfOSs $Genres_especes"] foreach Ligne [split $Retour "\n"] { set OC "Class unknown" ScanLaListe [split $Ligne ":"] OS OC set PhylumDuGenome($OS,OC) $OC set BAEV [PhylumDuOC $OC] set PhylumDuGenome($OS,Phylum) $BAEV } if {[OuiOuNon "Do I save PhylumDuGenome in $FichierPhylumDuGenome ?"]} { SauveLesLignes [array get PhylumDuGenome] dans $FichierPhylumDuGenome } } if {[info exists PhylumDuGenome($Genome,$Quoi)]} { return [set PhylumDuGenome($Genome,$Quoi)] } if {[file exists $FichierPhylumDuGenome]} { set OC "Inconnu inconnu" } else { Wup "Next lines is for an organism outsite LesGenomesComplets" regsub " " $Genome "_" G_E set OC [QuestionDeScience QuidSeq "QuidOCOfOS $G_E"] } if {$Quoi=="OC"} { return $OC } else { return [PhylumDuOC $OC] } } proc LesGenomesDansLeBonOrdre {{Ordre "BAE"} {QueVeutOn ""}} { global LesGenomesDansLeBonOrdre if {$Ordre=="OC"} { set QueVeutOn $Ordre ; set Ordre "BAE" } Wup "If QueVeutOn is OC it returns the OCs list. (Works only for BAE, not for Original)" if {$QueVeutOn=="" && [info exists LesGenomesDansLeBonOrdre($Ordre)]} { return [set LesGenomesDansLeBonOrdre($Ordre)] } if { $QueVeutOn!=""} { if { ! [info exists LesGenomesDansLeBonOrdre($Ordre,$QueVeutOn)]} { LesGenomesDansLeBonOrdre $Ordre } return [set LesGenomesDansLeBonOrdre($Ordre,$QueVeutOn)] } set LesGenomes [LesGenomesComplets] if {$Ordre=="Original"} { set LesGenomesDansLeBonOrdre($Ordre) $LesGenomes return $LesGenomes } if {$Ordre=="Alpha"} { return [lsort $LesGenomes] } foreach Genome $LesGenomes { set OS [Glossaire $Genome Complet] if {[info exists DejaVu($OS)]} { FaireLire "$OS\n is the organism of the genome $Genome\n \ but\n is also the organism of the genome [set GenomeDuOS($OS)] \ It can be a source of problems ..." } set DejaVu($OS) 1 set OC [PhylumDuGenome $OS OC] set OSduGenome($Genome) $OS set OCduGenome($Genome) $OC set GenomeDuOS($OS) $Genome set OCaTrier $OC if {$Ordre=="BAE"} { regsub -nocase "^Bacteria" $OCaTrier "2_Bacteria" OCaTrier regsub -nocase "^Archaea" $OCaTrier "4_Archaea" OCaTrier regsub -nocase "^Eukaryota" $OCaTrier "6_Eukaryota" OCaTrier regsub -nocase "^Virus" $OCaTrier "9_Virus" OCaTrier } if {$Ordre=="FamiliarBAE"} { regsub -nocase "^Bacteria" $OCaTrier "2_Bacteria" OCaTrier regsub -nocase "^Archaea" $OCaTrier "4_Archaea" OCaTrier regsub -nocase "^Eukaryota" $OCaTrier "6_Eukaryota" OCaTrier regsub -nocase "^Virus" $OCaTrier "9_Virus" OCaTrier if {[FamiliarOrganism $OS]} { set OCaTrier "0_$OCaTrier" } } if {$Ordre=="SampledBAE"} { regsub -nocase "^Bacteria" $OCaTrier "2_Bacteria" OCaTrier regsub -nocase "^Archaea" $OCaTrier "4_Archaea" OCaTrier regsub -nocase "^Eukaryota" $OCaTrier "6_Eukaryota" OCaTrier regsub -nocase "^Virus" $OCaTrier "9_Virus" OCaTrier if {[SampledOrganism $OS]} { set OCaTrier "0_$OCaTrier" } } lappend LesOSOCs [list $OCaTrier $OS] } set LesOSOCsTries [lsort -index 0 $LesOSOCs] foreach LeOCOS $LesOSOCsTries { ScanLaListe $LeOCOS OCaTrier OS set Genome [set GenomeDuOS($OS)] lappend LesGenomesTries $Genome lappend LesOCDesGenomesTries [set OCduGenome($Genome)] } set LesGenomesDansLeBonOrdre($Ordre) $LesGenomesTries set LesGenomesDansLeBonOrdre($Ordre,OC) $LesOCDesGenomesTries return $LesGenomesTries } proc CreeOrthoBlastP {{NomVoulu ""}} { global RepertoireDuGenome set FichierOBP "$RepertoireDuGenome/fiches/orthoblastp" set ApnsOnly 0 set DaedalusOnly [OuiOuNon "Do I use only the organisms I'll find in the DaedalusHit files ?"] if { ! $DaedalusOnly} { set ApnsOnly [OuiOuNon "Do I use only the organisms I'll find in the ./apns files ?"] } while {[file exists $FichierOBP]} { if {[OuiOuNon "$FichierOBP already exists\nDo I replace it ?"]} { File delete -force $FichierOBP continue } if {[OuiOuNon "$FichierOBP already exists\nDo I append to it (keeping existing lines) ?"]} { foreach Ligne [LesLignesDuFichier $FichierOBP] { scan $Ligne "%s" Nom set DejaVu($Nom) 1 } break } } set SeuilExpect 0.001 scan [TailleSortiePourDBClustal] "%d %d" MinObliges MaxVoulus set MaxListe [Maxi 250 [expr 3*$MaxVoulus]] if {$NomVoulu==""} { set Liste [ListeDesPABs] } else { set Liste [list $NomVoulu] } if {$DaedalusOnly} { foreach Nom $Liste { Espionne "Je repertorie les cops de $Nom" if {[info exists DejaVu($Nom)]} { continue } set FichierDaedalus "$RepertoireDuGenome/daedalushits/$Nom" if { ! [file exists $FichierDaedalus]} { continue } set nLu 0 set MesOrgas {} foreach Ligne [LesLignesDuFichier $FichierDaedalus] { set Valeurs [ValeurDeLaBalise BlastHit Ligne "" BH] ValeurDeLaBalise AC Valeurs "NePasRogner" AC # ValeurDeLaBalise ID Valeurs "NePasRogner" ID ValeurDeLaBalise PN Valeurs "NePasRogner" PN # ValeurDeLaBalise OX Valeurs "NePasRogner" OX # ValeurDeLaBalise GN Valeurs "NePasRogner" GN # ValeurDeLaBalise DE Valeurs "NePasRogner" DE ValeurDeLaBalise OS Valeurs "NePasRogner" OS if {[EstUnAccessPDB $AC]} { continue } if {$PN > $SeuilExpect} { break } if {[incr nLu] > $MaxListe} { break } scan $OS "%s %s" Genre Espece regsub -all {[\.\,\;]} $Espece "" Espece set Orga "${Genre}_$Espece" lappend MesOrgas $Orga } set MoiEtMesOrgas "$Nom [join $MesOrgas " "]" Espionne $MoiEtMesOrgas if {$MesOrgas!={}} { AppendAuFichier $FichierOBP $MoiEtMesOrgas } } } else { foreach Nom $Liste { Espionne "Je repertorie les cops de $Nom" if {[info exists DejaVu($Nom)]} { continue } set FichierAPNs "$RepertoireDuGenome/apns/$Nom" if { ! [file exists $FichierAPNs]} { continue } set nLu 0 set LesAccess {} foreach Ligne [LesLignesDuFichier $FichierAPNs] { scan $Ligne "%s %s %s" BanqueId Access Expect if {[EstUnAccessPDB $BanqueId]} { continue } incr nLu if {$Expect > $SeuilExpect} { break } if {$nLu > $MaxListe} { break } lappend LesAccess $Access set GEs "" regsub " *$BanqueId +$Access +$Expect *" $Ligne "" GEs if { ! [regexp -nocase {[a-z]} $GEs]} { continue } set OrgaTrouve([string toupper $Access]) $GEs } if { ! $ApnsOnly} { foreach AGEs [LesOrgasDesAccess $LesAccess] { scan $AGEs "%s" A regsub "$A " $AGEs "" GEs regsub {(^|\:)Inconnu inconnu($|\:)} $GEs "" GEs if {$GEs==""} { continue } set OrgaTrouve([string toupper $A]) $GEs } } set MesOrgas {} set nLu 0 foreach Ligne [LesLignesDuFichier $FichierAPNs] { scan $Ligne "%s %s %f" BanqueId Access Expect if {[EstUnAccessPDB $BanqueId]} { continue } incr nLu if {$Expect > $SeuilExpect} { break } if {$nLu > $MaxListe} { break } set ACCESS [string toupper $Access] set Orgas "" if {[info exists OrgaTrouve($ACCESS)]} { set Orgas [set OrgaTrouve($ACCESS)] } else { if { ! $ApnsOnly } { set Orgas [OrgaDuAccess $Access Complet $BanqueId] } } foreach Orga [split $Orgas ":"] { if {$Orga=="" || $Orga=="Inconnu inconnu"} { continue } regsub " " $Orga "_" Orga lappend MesOrgas $Orga } } if {$MesOrgas!={}} { AppendAuFichier $FichierOBP "$Nom [join $MesOrgas " "]" } } } return $FichierOBP } proc OrthoBlastP {Nom {Orga ""} {OrgaOK ""}} { global OrthoBlastP global RepertoireDuGenome Wup "returns its rank (starting 1) if Orga has an expect < 0.001 in BlastP, 0 if no absent" Wup "returns OrthoBlastPNonValide if blastp not yet analyzed" if {$OrgaOK=="OrgaOK"} { set OrgaOK 1 } else { set OrgaOK 0 } if {$Orga !="" } { if {$OrgaOK} { set Organisme $Orga } else { set Organisme [Glossaire $Orga Complet] } regsub " " $Organisme "_" Organisme if {$Organisme==""} { return 0 } } else { set Organisme "LaListeMerci" } set NO "$Nom,$Organisme" if { [info exists OrthoBlastP($NO)]} { return [set OrthoBlastP($NO)] } set FichierOBP "$RepertoireDuGenome/fiches/orthoblastp" if { ! [info exists OrthoBlastP("EstCharge")]} { set OrthoBlastP("EstCharge") "EstCharge" if { ! [file exists $FichierOBP]} { if { ! [info exists QuestionDejaPoseePourCreeOrthoBlastP]} { set QuestionDejaPoseePourCreeOrthoBlastP 1 if {[OuiOuNon "Do I create \n$FichierOBP\n ?" 0]} { CreeOrthoBlastP } else { return "OrthoBlastPNonValide" } } else { return "OrthoBlastPNonValide" } } Espionne "Je charge $FichierOBP" set LesOrgasDeBlastP {} foreach Ligne [LesLignesDuFichier $FichierOBP] { set Liste [split $Ligne " "] set NomLu [lindex $Liste 0] set ieme 1 set OrthoBlastP($NomLu,LaListeMerci) {} foreach OrgaLu [lrange $Liste 1 end] { lappend OrthoBlastP($NomLu,LaListeMerci) $OrgaLu if { ! [info exists DejaVu($OrgaLu)]} { lappend LesOrgasDeBlastP $OrgaLu set DejaVu($OrgaLu) 1 } set NOlu "$NomLu,$OrgaLu" set OrthoBlastP($NOlu) $ieme } } set OrthoBlastP(LaListeMerci,LaListeMerci) $LesOrgasDeBlastP } if {[info exists OrthoBlastP($NO)]} { return [set OrthoBlastP($NO)] } else { return 0 } } proc CreeOrthoTBlastN {} { global RepertoireDuGenome set FichierOrthoTBlastN "$RepertoireDuGenome/fiches/orthotblastn" set FichierOuATapeTBN "$RepertoireDuGenome/fiches/ouatapetbn.genomes" while { ! [file exists $FichierOuATapeTBN]} { if { ! [OuiOuNon "$FichierOuATapeTBN\n doesn't exist \n\ Do You want to do it now ?" 0]} { return "" } AnalyseLesTBlastN return "" } set ToggleOrgaPositions 1 foreach Ligne [LesLignesDuFichier $FichierOuATapeTBN] { if {$ToggleOrgaPositions} { scan $Ligne "%s" Nom set LesOrgas [lrange [split $Ligne " "] 1 end] set ToggleOrgaPositions [expr ! $ToggleOrgaPositions] continue } else { scan $Ligne "%s" NomLu if {$NomLu!=$Nom} { FaireLire "Ca merde dans CreeOrthoTBlastN\n$Ligne" } set LesPositions [lrange [split $Ligne " "] 1 end] set ToggleOrgaPositions [expr ! $ToggleOrgaPositions] } catch {unset DejaVu} set LesOrgasMaPosTaPos {} foreach Orga $LesOrgas {MaPos TaPos} $LesPositions { if {[info exists DejaVu($Orga)]} { continue } lappend LesOrgasMaPosTaPos $Orga $MaPos $TaPos } Espionne $Nom lappend Sortie "$Nom [join $LesOrgasMaPosTaPos " "]" } return [SauveLesLignes $Sortie dans $FichierOrthoTBlastN] } proc OrthoTBlastN {Nom Orga} { global RepertoireDuGenome global OrthoTBlastN global LesOrgasDeTBlastN global NotreOS global QuestionDejaPoseePourCreeOrthoTBlastN set NO "$Nom,$Orga" if { [info exists OrthoTBlastN($NO)]} { return [set OrthoTBlastN($NO)] } set FichierOTBN "$RepertoireDuGenome/fiches/orthotblastn" if {$Nom == "LaListe"} { set RendreLaListe 1 } else { set RendreLaListe 0 } if { ! [info exists OrthoTBlastN("EstCharge")]} { set OrthoTBlastN("EstCharge") "EstCharge" if { ! [file exists $FichierOTBN]} { if { ! [info exists QuestionDejaPoseePourCreeOrthoTBlastN]} { set QuestionDejaPoseePourCreeOrthoTBlastN 1 if {[OuiOuNon "Do I create \n$FichierOTBN\n ?"]} { CreeOrthoTBlastN } else { return "OrthoTBlastNOrgaNonValide" } } else { return "OrthoTBlastNOrgaNonValide" } } Espionne "Je charge $FichierOTBN" foreach Ligne [LesLignesDuFichier $FichierOTBN] { set Liste [split $Ligne " "] set NomLu [lindex $Liste 0] set ListeOrgaMaPosTaPos [lrange $Liste 1 end] foreach {OrgaLu MaPos TaPos} $ListeOrgaMaPosTaPos { if {[info exists OrthoTBlastN($NomLu,$OrgaLu)]} { continue } if { ! [info exists DejaVu($OrgaLu)]} { lappend LesOrgasDeTBlastN $OrgaLu set DejaVu($OrgaLu) 1 } set NOlu "$NomLu,$OrgaLu" set OrthoTBlastN($NOlu) "$MaPos:$TaPos" } } } if {$RendreLaListe} { return $LesOrgasDeTBlastN } if {[info exists OrthoTBlastN($NO)]} { return [set OrthoTBlastN($NO)] } else { return "-1:-1" } } proc ORGAorgaDesTBlastNs {{Nom ""} {Etat ""}} { global OosTBN Oos global RepertoireDuGenome Wup "Create fiches/ootblastn if necessary" set CreerDeTouteFacon 0 if {$Nom=="CreateIt"} { set CreerDeTouteFacon 1 if {[info exists OosTBN("EstCharge")]} { unset OosTBN } } if {[info exists OosTBN("EstCharge")] && $Nom=="" && [set OosTBN("EstCharge")]=="ORGAorgaNonValide"} { return "ORGAorgaNonValide" } set FichierOosTBN "$RepertoireDuGenome/fiches/ootblastn" if { ! [info exists OosTBN("EstCharge")]} { if {[file exists $FichierOosTBN] && ! $CreerDeTouteFacon} { foreach Ligne [LesLignesDuFichier $FichierOosTBN] { scan $Ligne "%s" PAB regsub "$PAB " $Ligne "" Reste set OosTBN($PAB) $Reste } set OosTBN("EstCharge") 1 } } if { ! [info exists OosTBN("EstCharge")]} { set LesNomOosTBN {} if {[OrthoTBlastN "est-il" "valide"]!="OrthoTBlastNNonValide"} { if { $CreerDeTouteFacon || [OuiOuNon " Do I create \n$FichierOosTBN\n ?" 0]} { while {[file exists $FichierOosTBN]} { if {[OuiOuNon "$FichierOosTBN\n already exists. Do I replace it ?" 0]} { File delete $FichierOosTBN break } if {[OuiOuNon "Do I append to it ? "]} { foreach Ligne [LesLignesDuFichier $FichierOosTBN] { scan $Ligne "%s" PAB regsub "$PAB " $Ligne "" Reste set OosTNB($PAB) $Reste set DejaVu($PAB) 1 } break } if {[OuiOuNon "Do I cancel ?"]} { return "" } } } else { set OosTBN("EstCharge") "ORGAorgaNonValide" return "ORGAorgaNonValide" } set LesOrgas {} foreach Complet [LesGenomesDansLeBonOrdre] { lappend LesOrgas [Glossaire $Complet Court] } foreach PAB [ListeDesPABs] { if {[info exists DejaVu($PAB)]} { continue } set LesOosTBN {} foreach Orga $LesOrgas { # set BelOrga [string range "$Orga..." 0 3] set BelOrga $Orga set PosTBN [OrthoTBlastN $PAB $Orga] if {$PosTBN == "-1:-1"} { set Oo [string tolower $BelOrga] } else { set Oo [string toupper $BelOrga] } lappend LesOosTBN $Oo } set OosTBN($PAB) [join $LesOosTBN " "] AppendAuFichier $FichierOosTBN "$PAB [set OosTBN($PAB)]" } } else { set OosTBN("EstCharge") "ORGAorgaNonValide" return "ORGAorgaNonValide" } set OosTBN("EstCharge") 1 } if {$Nom!=""} { if {[info exists OosTBN($Nom)]} { set Retour [set OosTBN($Nom)] if {$Etat=="Names"} { if {[info exists Oos("Names")]} { return [set Oos("Names")] } set Oos("Names") [VerticalNames $Retour] return [set Oos("Names")] } if {$Etat=="Stars"} { regsub -all {\.} $Retour "" Retour append Retour "/" regsub -all { +} $Retour "/" Retour regsub -all {[A-Z]+/} $Retour "*" Retour regsub -all {[A-Za-z]+} $Retour " " Retour regsub -all {/+} $Retour "" Retour regsub -all {\*} $Retour "T" Retour } if {$Etat=="Presents"} { regsub -all {[A-Z][a-z][a-z\.]+|[a-z][a-z\.]+} $Retour " " Retour } if {$Etat=="Absents"} { regsub -all {[A-Z][A-Za-z\.]+} $Retour " " Retour } return $Retour } else { return "" } } } proc CorrigeOo {{Oo ""}} { set LesOrgas {} foreach Complet [LesGenomesDansLeBonOrdre] { lappend LesOrganismes $Complet lappend LesOrgas [Glossaire $Complet Court] } set FichierOo "[RepertoireDuGenome]/fiches/$Oo" set Different 0 set Hit(Bidon) "coucou" foreach Ligne [LesLignesDuFichier $FichierOo] { set LesMots [LesMotsDeLaLigne $Ligne] set Nom [lindex $LesMots 0] unset Hit foreach Mot [lrange $LesMots 1 end] { set Orga [string tolower $Mot] set Hit($Orga) $Mot } set LeNew [list $Nom] foreach Orga $LesOrgas { set o [string tolower $Orga] if {[info exists Hit($Orga)]} { Espionne "$o $Orga $Hit($Orga)" ; set o $Hit($Orga) } lappend LeNew $o } set New [join $LeNew " "] if {$New!=$Ligne} { set Different 1 } lappend LeBonOo $New } if { ! $Different} { return "" } Garde $FichierOo return [SauveLesLignes $LeBonOo dans $FichierOo] } proc ORGAorgaDesBlastPs {{Nom ""} {Etat ""}} { global OosBP Oos global RepertoireDuGenome Wup "Create fiches/ooblastp if necessary" set CreerDeTouteFacon 0 if {$Nom=="CreateIt"} { set CreerDeTouteFacon 1 if {[info exists OosBP("EstCharge")]} { unset OosBP } } if {[info exists OosBP("EstCharge")] && $Nom=="" && [set OosBP("EstCharge")]=="ORGAorgaNonValide"} { return "ORGAorgaNonValide" } set FichierOosBP "$RepertoireDuGenome/fiches/ooblastp" if { ! [info exists OosBP("EstCharge")]} { if {[file exists $FichierOosBP] && ! $CreerDeTouteFacon} { foreach Ligne [LesLignesDuFichier $FichierOosBP] { scan $Ligne "%s" PAB regsub "$PAB " $Ligne "" Reste set OosBP($PAB) $Reste } set OosBP("EstCharge") 1 } } if { ! [info exists OosBP("EstCharge")]} { set LesNomOosBP {} if {[OrthoBlastP "est-il" "valide"]!="OrthoBlastPNonValide"} { if { $CreerDeTouteFacon || [OuiOuNon " Do I create \n$FichierOosBP\n ?" 0]} { while {[file exists $FichierOosBP]} { if {[OuiOuNon "$FichierOosBP\n already exists. Do I replace it ?" 0]} { File delete $FichierOosBP break } if {[OuiOuNon "Do I append to it ? "]} { foreach Ligne [LesLignesDuFichier $FichierOosBP] { scan $Ligne "%s" PAB regsub "$PAB " $Ligne "" Reste set OosBP($PAB) $Reste set DejaVu($PAB) 1 } break } if {[OuiOuNon "Do I cancel ?"]} { return "" } } } else { set OosBP("EstCharge") "ORGAorgaNonValide" return "ORGAorgaNonValide" } set LesOrgas {} foreach Complet [LesGenomesDansLeBonOrdre] { lappend LesOrganismes $Complet lappend LesOrgas [Glossaire $Complet Court] } foreach PAB [ListeDesPABs] { if {[info exists DejaVu($PAB)]} { continue } set LesOosBP {} foreach Orga $LesOrgas Organisme $LesOrganismes { # set BelOrga [string range "$Orga..." 0 3] set BelOrga $Orga set YaBP [OrthoBlastP $PAB $Organisme "OrgaOK"] if {$YaBP} { set Oo [string toupper $BelOrga] } else { set Oo [string tolower $BelOrga] } lappend LesOosBP $Oo } set OosBP($PAB) [join $LesOosBP " "] AppendAuFichier $FichierOosBP "$PAB [set OosBP($PAB)]" } } else { set OosBP("EstCharge") "ORGAorgaNonValide" return "ORGAorgaNonValide" } set OosBP("EstCharge") 1 } if {$Nom!=""} { if {[info exists OosBP($Nom)]} { set Retour [set OosBP($Nom)] if {$Etat=="Names"} { if {[info exists Oos("Names")]} { return [set Oos("Names")] } set Oos("Names") [VerticalNames $Retour] return [set Oos("Names")] } if {$Etat=="Stars"} { regsub -all {\.} $Retour "" Retour append Retour "/" regsub -all { +} $Retour "/" Retour regsub -all {[A-Z]+/} $Retour "*" Retour regsub -all {[A-Za-z]+} $Retour " " Retour regsub -all {/+} $Retour "" Retour regsub -all {\*} $Retour "P" Retour } if {$Etat=="Presents"} { regsub -all {[A-Z][a-z][a-z\.]+|[a-z][a-z\.]+} $Retour " " Retour } if {$Etat=="Absents"} { regsub -all {[A-Z][A-Za-z\.]+} $Retour " " Retour } return $Retour } else { return "" } } } proc ORGAorgaDesMSFs {{Nom ""} {Etat ""}} { global Oos global RepertoireDuGenome global NotreOS global NotreOrga Wup "Create fiches/oomsf if necessary" set CreerDeTouteFacon 0 if {$Nom=="CreateIt"} { set CreerDeTouteFacon 1 if {[info exists Oos("EstCharge")]} { unset Oos } } if {[info exists Oos("EstCharge")] && $Nom=="" && [set Oos("EstCharge")]=="ORGAorgaNonValide"} { return "ORGAorgaNonValide" } set FichierOos "$RepertoireDuGenome/fiches/oomsf" if { ! [info exists Oos("EstCharge")]} { if {[file exists $FichierOos] && ! $CreerDeTouteFacon} { foreach Ligne [LesLignesDuFichier $FichierOos] { scan $Ligne "%s" PAB regsub "$PAB " $Ligne "" Reste set Oos($PAB) $Reste } set Oos("EstCharge") 1 } } if { ! [info exists Oos("EstCharge")]} { set LesNomOos {} if {[PourcentageIdentiteOrga "est-il" "valide"]=="PourcentageIdentiteOrgaNonValide"} { set Oos("EstCharge") "ORGAorgaNonValide" return "ORGAorgaNonValide" } else { if { $CreerDeTouteFacon || \ [OuiOuNon " Do I create \n$FichierOos\n ... It would take a while ... ?" 0]} { if {[file exists $FichierOos]} { if {[OuiOuNon "$FichierOos\n already exists. Do I replace it ?" 0]} { File delete $FichierOos } else { if {[OuiOuNon "Do I append to it ? "]} { foreach Ligne [LesLignesDuFichier $FichierOos] { scan $Ligne "%s" PAB regsub "$PAB " $Ligne "" Reste set Oos($PAB) $Reste set DejaVu($PAB) 1 } } else { if {[OuiOuNon "Do I cancel ?"]} { return "" } else { } } } } } else { set Oos("EstCharge") "ORGAorgaNonValide" return "ORGAorgaNonValide" } set LesOrgas {} foreach Complet [LesGenomesDansLeBonOrdre] { lappend LesOrgas [Glossaire $Complet Court] } foreach PAB [ListeDesPABs] { if {[info exists DejaVu($PAB)]} { continue } set LesOos {} foreach Orga $LesOrgas { # set BelOrga [string range "$Orga..." 0 3] set BelOrga $Orga set PIO [PourcentageIdentiteOrga $PAB $Orga] if {$PIO == -1} { set Oo [string tolower $BelOrga] } elseif {$PIO >= 20} { set Oo [string toupper $BelOrga] } else { set Oo [string tolower $BelOrga] set Oo [string replace $Oo 0 0 [string toupper [string range $Oo 0 0]]] } lappend LesOos $Oo } set Oos($PAB) [join $LesOos " "] AppendAuFichier $FichierOos "$PAB [set Oos($PAB)]" } } set Oos("EstCharge") 1 } if {$Nom!=""} { if {[info exists Oos($Nom)]} { set Retour [set Oos($Nom)] if {$Etat=="Names"} { if {[info exists Oos("Names")]} { return [set Oos("Names")] } set Oos("Names") [VerticalNames $Retour] return [set Oos("Names")] } if {$Etat=="StarsP"} { regsub -all {\.} $Retour "" Retour append Retour "/" regsub -all { +} $Retour "/" Retour regsub -all {[A-Z][a-z]+} $Retour "*" Retour regsub -all {[A-Z]+/} $Retour "*" Retour regsub -all {[a-z]+/} $Retour " " Retour regsub -all {/+} $Retour "" Retour regsub -all {\*} $Retour "X" Retour } if {$Etat=="Stars"} { regsub -all {\.} $Retour "" Retour append Retour "/" regsub -all { +} $Retour "/" Retour regsub -all {[A-Z]+/} $Retour "*" Retour regsub -all {[A-Za-z]+} $Retour " " Retour regsub -all {/+} $Retour "" Retour regsub -all {\*} $Retour "A" Retour } if {$Etat=="Presents"} { regsub -all {[A-Z][a-z][a-z\.]+|[a-z][a-z\.]+} $Retour " " Retour } if {$Etat=="Hesitants"} { regsub -all {[A-Z][A-Z\.]+|^[a-z\.]+} $Retour " " Retour } if {$Etat=="Hesitants"} { regsub -all { [a-z\.]+} $Retour " " Retour } if {$Etat=="Absents"} { regsub -all {[A-Z][A-Za-z\.]+} $Retour " " Retour } return $Retour } else { return "" } } } proc ORGAorgaDesOperons {{Nom ""} {Etat ""}} { global OosO Oos global RepertoireDuGenome global NotreOS global NotreOrga Wup "Create fiches/oooperon if necessary" set CreerDeTouteFacon 0 if {$Nom=="CreateIt"} { set CreerDeTouteFacon 1 if {[info exists OosO("EstCharge")]} { unset OosO } } if {[info exists OosO("EstCharge")] && $Nom=="" && [set OosO("EstCharge")]=="ORGAorgaNonValide"} { return "ORGAorgaNonValide" } set FichierOos "$RepertoireDuGenome/fiches/oooperon" if { ! [info exists OosO("EstCharge")]} { if {[file exists $FichierOos] && ! $CreerDeTouteFacon} { foreach Ligne [LesLignesDuFichier $FichierOos] { scan $Ligne "%s" PAB regsub "$PAB " $Ligne "" Reste set OosO($PAB) $Reste } set OosO("EstCharge") 1 } } if { ! [info exists OosO("EstCharge")]} { set LesNomOos {} if {[ListeDesOrganismesAyantMemeOperon "est-il-valide"]=="OrganismesAyantMemeOperonNonValide"} { set OosO("EstCharge") "ORGAorgaNonValide" return "ORGAorgaNonValide" } else { if { $CreerDeTouteFacon || \ [OuiOuNon " Do I create \n$FichierOos\n ... It would take a while ... ?" 0]} { if {[file exists $FichierOos]} { if {[OuiOuNon "$FichierOos\n already exists. Do I replace it ?" 0]} { File delete $FichierOos } else { if {[OuiOuNon "Do I append to it ? "]} { foreach Ligne [LesLignesDuFichier $FichierOos] { scan $Ligne "%s" PAB regsub "$PAB " $Ligne "" Reste set OosO($PAB) $Reste set DejaVu($PAB) 1 } } else { if {[OuiOuNon "Do I cancel ?"]} { return "" } else { } } } } } else { set OosO("EstCharge") "ORGAorgaNonValide" return "ORGAorgaNonValide" } set LesOrgas {} foreach Complet [LesGenomesDansLeBonOrdre] { lappend LesOrgas [Glossaire $Complet Court] } foreach PAB [ListeDesPABs] { if {[info exists DejaVu($PAB)]} { continue } set LesOMOs [ListeDesOrganismesAyantMemeOperon $PAB] set LesOos {} foreach Orga $LesOrgas { set BelOrga $Orga set YEst [lsearch -exact $LesOMOs $Orga] if {$YEst < 0} { set Oo [string tolower $BelOrga] } else { set Oo [string toupper $BelOrga] } lappend LesOos $Oo } set OosO($PAB) [join $LesOos " "] AppendAuFichier $FichierOos "$PAB [set OosO($PAB)]" } } set OosO("EstCharge") 1 } if {$Nom!=""} { if {[info exists OosO($Nom)]} { set Retour [set OosO($Nom)] if {$Etat=="Names"} { if {[info exists Oos("Names")]} { return [set Oos("Names")] } set Oos("Names") [VerticalNames $Retour] return [set Oos("Names")] } if {$Etat=="Stars"} { regsub -all {\.} $Retour "" Retour append Retour "/" regsub -all { +} $Retour "/" Retour regsub -all {[A-Z]+/} $Retour "*" Retour regsub -all {[A-Za-z]+} $Retour " " Retour regsub -all {/+} $Retour "" Retour regsub -all {\*} $Retour "O" Retour } return $Retour } else { return "" } } } proc SauteSurCible {K x y} { global RepertoireDuGenome global yDuContig set Id [$K find withtag current] set QueryFraction [lindex [$K gettags $Id] 0] scan $QueryFraction "%s %s" Contig Fraction set CibleEtc [lindex [$K gettags $Id] 1] scan $CibleEtc "%s" Cible set y [set yDuContig($Cible)] $K yview moveto $y $K yview scroll -5 units } proc AfficheLeBlastNDuContig {K x y} { global RepertoireDuGenome set Id [$K find withtag current] set QueryFraction [lindex [$K gettags $Id] 0] scan $QueryFraction "%s %s" Contig Fraction set w [AfficheFichier "$RepertoireDuGenome/blastn/TTH-$Contig" "AvecRien"] Illumine $Fraction $w } proc TopoDuBlastN {} { global RepertoireDuGenome global PlottePourBlastN global DotPlotDesProches ; set DotPlotDesProches 0 global yDuContig set OnVeutLeDotPlot 0 set OnVeutLesQuery 1 foreach Ligne [LesLignesDuFichier "$RepertoireDuGenome/fiches/bornesdescontigs"] { scan $Ligne "%s %d %d" Contig d f set Debut($Contig) $d set Fin($Contig) $f set Long($Contig) [expr $f-$d+1] lappend LesFins $f set ContigDeLaFin($f) $Contig } set OldContig "" foreach Ligne [LesLignesDuFichier "$RepertoireDuGenome/fiches/ouonttapelescontigs.mini"] { if { ! [regexp {[a-z0-9]} $Ligne]} { continue } scan $Ligne "%s %d %d %s %s %s %s %d %d %d %d" Contig a b OrgaComplet Orga Fraction PN dQ fQ dC fC regsub {TTH\-} $Contig "" Contig set Sens "F" if {$dC>$fC} { set W $dC set dC $fC set fC $W set Sens "R" } foreach FinDeContig $LesFins { if {$FinDeContig < $fC} { continue } set ContigCible [set ContigDeLaFin($FinDeContig)] if {$dC < [set Debut($ContigCible)]} { FaireLire "A cheval sur $ContigCible\n$Ligne" } break } ScanLaListe [split $Fraction "/"] IdenHSP LongHSP if {$LongHSP < 1} { continue } set Limite -0 if {[incr dQ $Limite]<0} { continue } if {[incr fQ $Limite]<0} { continue } if {[incr dC $Limite]<0} { continue } if {[incr fC $Limite]<0} { continue } lappend Nous "$Contig $dQ $fQ" lappend Nous "$Contig $dQ $fQ" lappend Vous "$ContigCible $dC $fC" lappend Vous "$ContigCible $dC $fC" lappend NosPos $dQ lappend NosPos $fQ lappend VosPos $dC lappend VosPos $fC set dQr [format "%3d" [expr round(100.*($dQ-[set Debut($Contig)])/[set Long($Contig)])] ] set fQr [format "%3d" [expr round(100.*($fQ-[set Debut($Contig)])/[set Long($Contig)])] ] set dCr [format "%3d" [expr round(100.*($dC-[set Debut($ContigCible)])/[set Long($ContigCible)])] ] set fCr [format "%3d" [expr round(100.*($fC-[set Debut($ContigCible)])/[set Long($ContigCible)])] ] set BelleFraction [format "%15s" $Fraction] set OldContig $Contig set Resume "$Sens $Contig $dQr $fQr $ContigCible $dCr $fCr $BelleFraction $dQ $fQ [set Debut($Contig)] [set Long($Contig)] $dC $fC [set Debut($ContigCible)] [set Long($ContigCible)]" lappend LesCommunsDeCible($ContigCible) $Resume lappend LesCommunsDeQuery($Contig) $Resume } set xMax 12000 set yMax 250000 set K [UnCanva $xMax $yMax 1000 1000] MainLeveeSurUnCanva $K set dy 50 set y [expr 10*$dy] set lQueryMax 0 foreach Contig [lsort -decreasing [array names LesCommunsDeCible]] { set lQuery 0 set MettreEntete 1 foreach Ligne [set LesCommunsDeQuery($Contig)] { scan $Ligne "%s %s %d %d %s %d %d %s %d %d %d %d %d %d %d %d" Sens Query dQr fQr Cible dCr fCr Fraction dQ fQ aQ lQ dC fC aC lC if { ! $lQuery } { set lQuery $lQ } if { ! $lQueryMax } { set lQueryMax $lQ } set oC [expr $lQueryMax+$dQ-$aQ-$dC+$aC] incr y $dy if {$Sens=="F"} { set CouleurAuSens "red" } else { set CouleurAuSens "blue" } set X1 $oC set X2 [expr $oC+$lC] set X1 [expr $X1/24.] set X2 [expr $X2/24.] if {$MettreEntete} { set MettreEntete 0 $K create text [expr $X1] [expr $y-2*$dy] -text $Contig -fill black -anchor w set yDuContig($Query) [expr 1.*$y/$yMax] set X2Query $X2 set n 0 lappend LesTextesAssocies "" } $K create line $X1 $y $X2 $y -fill black set bdQ [format "%7d" $dQ] set bfQ [format "%7d" $fQ] set bdC [format "%7d" $dC] set bfC [format "%7d" $fC] set blQ [format "%7d" [set Long($Query)]] set blC [format "%7d" [set Long($Cible)]] set baQ [format "%7d" [set Debut($Query)]] set bzQ [format "%7d" [set Fin($Query)]] set baC [format "%7d" [set Debut($Cible)]] set bzC [format "%7d" [set Fin($Cible)]] set bFraction [format "%11s" $Fraction] set BeauTexteQuery "$Query $bFraction $blQ $bdQ-$bfQ $baQ $bzQ" set TexteQuery "$Query $Fraction [set Long($Query)] $dQ-$fQ [set Debut($Query)] [set Fin($Query)]" set TexteCible "$Cible [string repeat " " [string length $Fraction]] [set Long($Cible)] $dC-$fC [set Debut($Cible)] [set Fin($Cible)]" set BeauTexteCible "$Cible $blC $bdC-$bfC $baC $bzC" set LesTags [list "$TexteQuery" "\n$TexteCible" "Coeur"] set Texte [format "%2.2d %s" [incr n] $Cible] $K create text [expr $X2Query+100] $y -text $Texte -anchor w -font {Courier 4} lappend LesTextesAssocies "[format %2d $n] $BeauTexteQuery $BeauTexteCible" set X1 [expr $oC+$dC-$aC] set X2 [expr $oC+$fC-$aC] set X1 [expr $X1/24.] set X2 [expr $X2/24.] $K create line $X1 $y $X2 $y -fill $CouleurAuSens -width 3 -tag $LesTags } incr y [expr 5*$dy] $K create line 0 $y 24000 $y -fill grey incr y [expr 5*$dy] } SauveLesLignes $LesTextesAssocies dans "$RepertoireDuGenome/textesassocies" regsub {\.canvas} $K "" FK Gonfle $FK all 0.2 0.2 BoutonneLaFenetre $FK "Coucou" "puts coucou" $K bind "Coeur" <1> "AfficheLeBlastNDuContig $K %x %y" $K bind "Coeur" <2> "SauteSurCible $K %x %y" $K bind "Coeur" "EntreDansCoeur $K %x %y" $K bind "Coeur" "SortDeCoeur $K %x %y" if {$OnVeutLeDotPlot} { set PlottePourBlastN 0 Plotte $Nous $Vous $NosPos $VosPos unset PlottePourBlastN } } proc TesteRepereBox K { LesOrdresPourGif [GscopeBoard titi PourGif] exit Espionne [RepereBox "serrs" OrdrePourGif] } proc TrogStatus Nom { global RepertoireDuGenome global TrogStatus if {[info exists TrogStatus($Nom)]} { return [set TrogStatus($Nom)] } if {[info exists TrogStatus("EstCharge")]} { return "" } set FichierTrogStatus "$RepertoireDuGenome/fiches/trogstatus" set TrogStatus("EstCharge") "EstCharge" if { ! [file exists $FichierTrogStatus]} { return "" } foreach Ligne [LesLignesDuFichier $FichierTrogStatus] { scan $Ligne "%s %s" NomLu Valeur set TrogStatus($NomLu) $Valeur } return [TrogStatus $Nom] } proc Sock {} { return "Coucou\n[BoutADN 1 10 "F"]\nBeau bout de sequence." } proc PointeDotPlot {K X Y} { global RepertoireDuGenome set Contig "InconnuBlaBlaBla" set Id [$K find withtag current] set Moi [lindex [$K gettags $Id] 0] set Toi [lindex [$K gettags $Id] 1] scan $Moi "%d %d %s" MonD MonF Contig scan $Toi "%d %d" TonD TonF if { ! [file exists "$RepertoireDuGenome/blastn/$Contig"]} { return "" } set Fenetre [AfficheFichier "$RepertoireDuGenome/blastn/$Contig" "SansFetch"] Illumine $MonD $Fenetre return $Fenetre set MonO [FouR $MonD $MonF] set TonO [FouR $TonD $TonF] set MaSeq [BoutADN [Mini $MonD $MonF] [Maxi $MonD $MonF] $MonO] set TaSeq [BoutADN [Mini $TonD $TonF] [Maxi $TonD $TonF] $TonO] return [EntreTexte "$MaSeq\n$TaSeq"] } proc CreeLaBanqueBlastPureSansTroncon {} { global RepertoireDuGenome global FichierSequenceADN set TFA $FichierSequenceADN if {[file exists "$TFA.pure"]} { set TFA "$TFA.pure" } return [CreeUneBanqueBlast $TFA "$RepertoireDuGenome/banques/[PreFixe]"] } proc BlastNDesContigsPures {} { global RepertoireDuGenome global ADN TDN RAC global NotreOS set BanqueBlastN "$RepertoireDuGenome/banques/[PreFixe]" if { ! [file exists "$BanqueBlastN.nhr"]} { if {[OuiOuNon "Blastn database $BanqueBlastN doesn't exists.\n\ Do I create it ?"]} { CreeLaBanqueBlastPureSansTroncon } else { return "" } } set RepBlastN "$RepertoireDuGenome/blastn" if { ! [file exists $RepBlastN]} { File mkdir $RepBlastN } catch {unset ADN} catch {unset TDN} catch {unset RAC} if { ! [info exists ADN]} { ChargeADNetTDNetRAC ".pure" } set OnAttendLeDernierContigDejaTraite 0 set OnAttendLeDernierHomologueBon 0 set FichierOuOntTapeLesContigs "$RepertoireDuGenome/fiches/ouonttapelescontigs" while {[file exists $FichierOuOntTapeLesContigs]} { if {[OuiOuNon "$FichierOuOntTapeLesContigs\already exists.\nDo I replace it ?"]} { File delete $FichierOuOntTapeLesContigs break } if {[OuiOuNon "$FichierOuOntTapeLesContigs\already exists.\nDo I append to it ?"]} { set DernierHomologueBon [lindex [LesLignesDuFichier $FichierOuOntTapeLesContigs] end] scan $DernierHomologueBon "%s" DernierContigDejaTraite set OnAttendLeDernierContigDejaTraite 1 set OnAttendLeDernierHomologueBon 0 Espionne $DernierContigDejaTraite Espionne $DernierHomologueBon break } if {[OuiOuNon "$FichierOuOntTapeLesContigs\already exists.\nDo I cancel ?"]} { return "" } if {[OuiOuNon "$FichierOuOntTapeLesContigs\already exists.\nDo I stop ?"]} { exit } } NousAllonsAuBoulot foreach Ligne [LesLignesDuFichier "$RepertoireDuGenome/fiches/bornesdescontigs"] { scan $Ligne "%s %d %d" Contig Debut Fin set Orient "F" Espionne $Ligne if {$OnAttendLeDernierContigDejaTraite && ! [regexp $Contig $DernierContigDejaTraite]} { continue } set OnAttendLeDernierContigDejaTraite 0 set SeqNuc [BoutADN $Debut $Fin $Orient] set TFA [SequenceFormatTFA $SeqNuc "$Contig $Debut $Fin $Orient" "nucbrut"] set FichierTFA [Sauve $TFA dans $Contig] set FichierBlastN "$RepBlastN/[PreFixe]-$Contig" set CommandeBlast "blastall \ -p blastn \ -d $BanqueBlastN \ -i $FichierTFA \ -o $FichierBlastN \ -q -1 -F T -G 6 -E 1" if { ! [file exists $FichierBlastN]} { Espionne "BlastN de $FichierTFA sur $BanqueBlastN" eval exec $CommandeBlast Espionne " --------> resultat dans $FichierBlastN" } foreach Homo [LesHomologiesDuBlastN $FichierBlastN "" $BanqueBlastN] { set lHomo [split $Homo "\t"] set i -1 set Nom [lindex $lHomo [incr i]] set nCops [lindex $lHomo [incr i]] set nCopsSeq [lindex $lHomo [incr i]] set BanqueId [lindex $lHomo [incr i]] set OrgaHomo [lindex $lHomo [incr i]] set Identities [lindex $lHomo [incr i]] set Expect [lindex $lHomo [incr i]] set DebutQuery [lindex $lHomo [incr i]] set FinQuery [lindex $lHomo [incr i]] set DebutSbjct [lindex $lHomo [incr i]] set FinSbjct [lindex $lHomo [incr i]] set SeqSbjct [lindex $lHomo [incr i]] set DebutQuery [expr $DebutQuery + $Debut -1] set FinQuery [expr $FinQuery + $Debut -1] set Homologue "$Nom\t$nCops\t$nCopsSeq\t$BanqueId\t$OrgaHomo\t$Identities\t$Expect\t$DebutQuery\t$FinQuery\t$DebutSbjct\t$FinSbjct" Espionne "$Nom\t$nCops\t$nCopsSeq\t$Identities\t$Expect\t$DebutQuery\t$FinQuery\t$DebutSbjct\t$FinSbjct" if {$OnAttendLeDernierHomologueBon && $Homologue != $DernierHomologueBon} { continue } set OnAttendLeDernierHomologueBon 0 lappend LesHomologues $Homologue AppendAuFichier $FichierOuOntTapeLesContigs $Homologue } } OnRevientDuBoulot catch {unset ADN} catch {unset TDN} catch {unset RAC} } proc DotPlotDesInteressants Orga { global RepertoireDuGenome global DotPlotDesProches ; set DotPlotDesProches 0 global PlottePourBlastN foreach Ligne [LesLignesDuFichier "$RepertoireDuGenome/blastn/$Orga.mesinteressants"] { scan $Ligne "%s %d %d %s %s %d %d %s %d" MonNom MonD MonF MonO TonNom TonD TonF TonO PI lappend Nous "$MonNom $MonD $MonF $MonO" lappend Vous "$TonNom $TonD $TonF $TonO $PI" if {$MonO=="R"} { set Toto $MonD set MonD $MonF set MonF $Toto } if {$TonO=="R"} { set Toto $TonD set TonD $TonF set TonF $Toto } lappend NosPos $MonD lappend NosPos $MonF lappend VosPos $TonD lappend VosPos $TonF } set PlottePourBlastN 1 Plotte $NosPos $VosPos $NosPos $VosPos unset PlottePourBlastN } proc AnalyseLeBlastN {Fichier {BanqueBlast ""}} { global RepertoireDuGenome if { ! [file exists $Fichier]} { set FichierDeLOrga "$RepertoireDuGenome/blastn/[file tail $Fichier]" if { ! [file exists $FichierDeLOrga]} { FaireLire "Sorry, I can't find \n $Fichier \n nor \n $FichierDeLOrga" return "" } set Fichier $FichierDeLOrga } CreeLesBornesDuBlastN $Fichier $BanqueBlast LesZonesDuBlastNEnOverlap $Fichier exit } proc LesZonesDuBlastNEnOverlap Fichier { global RepertoireDuGenome global LesORFsEnOverlap global ListeDeBoites set FichierTesBornes "$Fichier.tesbornes" set FichierMesBornes "$Fichier.mesbornes" set FichierMesOverlaps "$Fichier.mesoverlaps" set FichierMesSolitaires "$Fichier.messolitaires" set FichierMesConviviaux "$Fichier.mesconviviaux" set FichierMesInteressants "$Fichier.mesinteressants" foreach Ligne [LesLignesDuFichier $FichierTesBornes] { ExtraireDe $Ligne Nom Debut Fin Orient regsub "TaZone" $Nom "MaZone" MonNom set TaZone($MonNom) $Ligne } foreach Ligne [LesLignesDuFichier $FichierMesBornes] { ExtraireDe $Ligne Nom Debut Fin Orient if {[info exists DejaVu($Debut,$Fin,$Orient)]} { Espionne "DejaVu [set DejaVu($Debut,$Fin,$Orient)] $Nom" continue } set Long [expr $Fin-$Debut+1] if {$Long<1000} { continue } set Frame [NomDeLaFrame [expr $Debut%3] $Orient] set Boite $Nom Box $Boite nom $Nom Box $Boite orient $Orient Box $Boite frame $Frame Box $Boite debut $Debut Box $Boite fin $Fin Box $Boite long $Long set DejaVu($Debut,$Fin,$Orient) $Nom lappend ListeDeBoites $Boite } CalculeLesORFsEnOverlap foreach Boite $ListeDeBoites { set Nom [Box $Boite nom] set Over [CalculeLesOverlapsDe $Nom] if {$Over == ""} { continue } if {[regexp "I am in" $Over]} { set EstIn($Nom) 1 } } foreach Boite $ListeDeBoites { set Nom [Box $Boite nom] if {[info exists EstIn($Nom)]} { continue } set Over [CalculeLesOverlapsDe $Nom] lappend Interessants $Nom if {$Over == ""} { lappend Solitaires $Nom continue } lappend Conviviaux $Nom foreach Ligne [split $Over "\n"] { if {[regexp "I contain" $Ligne]} { continue } set Toi [StringApres " in " dans $Ligne] if {[info exists EstIn($Toi)]} { continue } set Longueur [IntegerApres "Overlap\:" dans $Ligne] if {$Longueur<100} { continue } if {[Box $Nom orient]!=[Box $Toi orient]} { continue } if {[info exists DejaVu($Nom,$Toi)]} { continue } set DejaVu($Toi,$Nom) 1 lappend MoiToi $Nom lappend MoiToi $Toi lappend MoiToi $Longueur } } set OldMoi "" foreach {Moi Toi Longueur} $MoiToi { if {$OldMoi != $Moi } { lappend SortieOverlaps "$Moi [Box $Moi debut] [Box $Moi fin] [Box $Moi orient]" set LongMoi [expr [Box $Moi fin]-[Box $Moi debut]+1] } set OldMoi $Moi set LongToi [expr [Box $Toi fin]-[Box $Toi debut]+1] lappend SortieOverlaps "[string repeat " " [string length $Moi]] [Box $Toi debut] [Box $Toi fin] [Box $Toi orient] $Toi $LongMoi $LongToi $Longueur" } foreach Nom $Solitaires { lappend SortieSolitaires "$Nom [Box $Nom debut] [Box $Nom fin] [Box $Nom orient] [set TaZone($Nom)]" } foreach Nom $Conviviaux { lappend SortieConviviaux "$Nom [Box $Nom debut] [Box $Nom fin] [Box $Nom orient] [set TaZone($Nom)]" } foreach Nom $Interessants { lappend SortieInteressants "$Nom [Box $Nom debut] [Box $Nom fin] [Box $Nom orient] [set TaZone($Nom)]" } Espionne [SauveLesLignes $SortieSolitaires dans $FichierMesSolitaires] Espionne [SauveLesLignes $SortieConviviaux dans $FichierMesConviviaux] Espionne [SauveLesLignes $SortieOverlaps dans $FichierMesOverlaps] Espionne [SauveLesLignes $SortieInteressants dans $FichierMesInteressants] exit } proc CreeLesBornesDuBlastN {Fichier {BanqueBlast ""}} { set NS 0 set NQ 0 foreach Homo [LesHomologiesDuBlastN $Fichier "" $BanqueBlast] { set lHomo [split $Homo "\t"] set i -1 set Nom [lindex $lHomo [incr i]] set nCops [lindex $lHomo [incr i]] set nCopsSeq [lindex $lHomo [incr i]] set BanqueId [lindex $lHomo [incr i]] set OrgaHomo [lindex $lHomo [incr i]] set Identities [lindex $lHomo [incr i]] set Expect [lindex $lHomo [incr i]] set DebutQuery [lindex $lHomo [incr i]] set FinQuery [lindex $lHomo [incr i]] set DebutSbjct [lindex $lHomo [incr i]] set FinSbjct [lindex $lHomo [incr i]] set SeqSbjct [lindex $lHomo [incr i]] set LongSbjct [expr abs($FinSbjct-$DebutSbjct)+1] if {$LongSbjct<1000} { continue } regsub "/" $Identities " " IsurT scan $IsurT "%d %d" I T set PI [expr round(100.*$I/$T)] if {$PI < 60.} { continue } if {$DebutSbjct<=$FinSbjct} { set DS $DebutSbjct set FS $FinSbjct set OS "F" } else { set DS $FinSbjct set FS $DebutSbjct set OS "R" } if {$DebutQuery<=$FinQuery} { set DQ $DebutQuery set FQ $FinQuery set OQ "F" } else { set DQ $FinQuery set FQ $DebutQuery set OQ "R" } incr NS set MaZone "MaZone[format "%4.4d" $NS]" incr NQ set TaZone "TaZone[format "%4.4d" $NQ]" lappend MesBornes "$MaZone $DS $FS $OS $PI $TaZone" lappend TesBornes "$TaZone $DQ $FQ $OQ $PI $MaZone" } Espionne [SauveLesLignes $MesBornes dans "$Fichier.mesbornes"] Espionne [SauveLesLignes $TesBornes dans "$Fichier.tesbornes"] } proc BlastNDUnOrgaComplet {{FichierTFA ""}} { global RepertoireDuGenome Wup "We make blastn agains a non overlapping database of the in 100000 bases cutted dna" if {$FichierTFA==""} { FaireLire "Please browse for a TFA file" set FichierTFA [ButineArborescence "All" "$RepertoireDuGenome/../"] } set AutreOrga [file tail $FichierTFA] regsub {\.tfa$} $AutreOrga "" AutreOrga set Orga [Glossaire $AutreOrga Court] while {$Orga==""} { FaireLire "I couldn't find the organism associated to $FichierTFA\n\Please help me." set Orga [Entre ""] set Orga [Glossaire $Orga Court] if {$Orga == "" && [OuiOuNon "Do I cancel ?"]} { return "" } } set BanqueBlastN "$RepertoireDuGenome/banques/[PreFixe]overlap" if { ! [file exists "$BanqueBlastN.nhr"]} { if {[OuiOuNon "Blastn database $BanqueBlastN doesn't exists.\n\ Do I create it ?"]} { CreeLaBanqueBlastN $BanqueBlastN } else { return "" } } set RepBlastN "$RepertoireDuGenome/blastn" if { ! [file exists $RepBlastN]} { File mkdir $RepBlastN } set FichierBlastN "$RepBlastN/$Orga" set FaireBlastN 1 if {[file exists $FichierBlastN]} { if {[OuiOuNon "$FichierBlastN already exists. Do I use it ?"]} { set FaireBlastN 0 } elseif { ! [OuiOuNon "$FichierBlastN already exists. Do I replace it ?"]} { set FaireBlastN 1 } else { set FichierBlastN [FichierPourSaveAs "$FichierBlastN"] if {$FichierBlastN==""} { return "" } set FaireBlastN 1 } } set AnalyseLeBlastN [OuiOuNon "Do I analyse the BlastN for overlaps ?"] if {$FaireBlastN} { set CommandeBlast "blastall \ -p blastn \ -d $BanqueBlastN \ -i $FichierTFA \ -o $FichierBlastN \ -q -1 -F F -G 6 -E 1" set CommandeBlast [Entre $CommandeBlast] if {$CommandeBlast==""} { return "" } eval exec $CommandeBlast } if {[file exists $FichierBlastN]} { AnalyseLeBlastN $FichierBlastN $BanqueBlastN return [AfficheFichier $FichierBlastN "AvecGrapheAvecSegAlignementAvecAligneurs"] } else { FaireLire "I have a problem ... $FichierBlastN doesn't exist." return "" } } proc CreeLaBanqueBlastN {{FichierTFAs ""}} { global RepertoireDuGenome global NotreOS set LongueurChevauchement 10000 set RepertoireBanquesBlast "$RepertoireDuGenome/banques" if {$FichierTFAs==""} { set FichierTFAs "$RepertoireBanquesBlast/[PreFixe]" if {[OuiOuNon "Do we use (old manner) overlapping regions ?" 0]} { append FichierTFAs "overlap" } } set RepertoireTFAs [file dirname $FichierTFAs] if {$RepertoireTFAs!=$RepertoireBanquesBlast} { if {[OuiOuNon "$RepertoireTFAs\nis not the same as\n$RepertoireBanquesBlast\n\ Do I exit ?"]} { exit } if {[OuiOuNon "Do I cancel ?"]} { return "" } } if { ! [file exists $RepertoireBanquesBlast]} { File mkdir $RepertoireBanquesBlast } if { ! [file exists $FichierTFAs]} { if {[OuiOuNon "The TFAs file \n$FichierTFAs\ndoesn't exist. Do I create it ?"]} { while 1 { if {[OuiOuNon "We do no more need to create overlapping regions.\n\ Ok to create a blastdatabase with the whole file ?"]} { CreeFichierTFADuGenomePourBanqueBlast $FichierTFAs break } if {[OuiOuNon "We do no more need to create overlapping regions.\n\ Ok to create a blastdatabase with overlapping regions ?" 0]} { CreeTroncons "TFA" $FichierTFAs $LongueurChevauchement break } if {[OuiOuNon "Do I cancel CreeLaBanqueBlastN ?" 0]} { return "" } } } else { if {[OuiOuNon "Do I exit Gscope ?"]} { exit } return "" } } set NomDeLaBanque [file tail $FichierTFAs] return [CreeUneBanqueBlast $FichierTFAs "$RepertoireBanquesBlast/$NomDeLaBanque"] } proc DotPlotBlastN {{Fichier ""} {BanqueBlast ""} } { global RepertoireDuGenome global DotPlotDesProches ; set DotPlotDesProches 0 global PlottePourBlastN if {$Fichier==""} { set LesHomologues [LesLignesDuFichier "$RepertoireDuGenome/fiches/ouonttapelescontigs"] } else { set LesHomologues [LesHomologiesDuBlastN $Fichier "" $BanqueBlast] } foreach Homo $LesHomologues { set lHomo [split $Homo "\t"] set i -1 set Nom [lindex $lHomo [incr i]] set nCops [lindex $lHomo [incr i]] set nCopsSeq [lindex $lHomo [incr i]] set BanqueId [lindex $lHomo [incr i]] set OrgaHomo [lindex $lHomo [incr i]] set Identities [lindex $lHomo [incr i]] set Expect [lindex $lHomo [incr i]] set DebutQuery [lindex $lHomo [incr i]] set FinQuery [lindex $lHomo [incr i]] set DebutSbjct [lindex $lHomo [incr i]] set FinSbjct [lindex $lHomo [incr i]] set SeqQuery [lindex $lHomo [incr i]] set SeqSbjct [lindex $lHomo [incr i]] set LongSbjct [expr abs($FinSbjct-$DebutSbjct)+1] if {$LongSbjct<100} { continue } if {$DebutSbjct < $FinSbjct} { set OrientSbjct "F" } else { set OrientSbjct "R" } if {$DebutQuery < $FinQuery} { set OrientQuery "F" } else { set OrientQuery "R" } set TexteNous "$DebutSbjct $FinSbjct $Nom $OrientSbjct $OrientQuery $Identities" set TexteVous "$DebutQuery $FinQuery" regsub -all { +} $TexteNous " " TexteNous regsub -all { +} $TexteVous " " TexteVous lappend Nous $TexteNous lappend Nous $TexteNous lappend Vous $TexteVous lappend Vous $TexteVous lappend NosPos "$DebutSbjct" lappend NosPos "$FinSbjct" lappend VosPos "$DebutQuery" lappend VosPos "$FinQuery" } set PlottePourBlastN 1 Plotte $Nous $Vous $NosPos $VosPos unset PlottePourBlastN } proc LesHomologiesDuBlastN {Fichier {AvecLaSeq ""} {BanqueBlast ""} {Maniere ""} {Qui ""}} { if {$Maniere==""} { set Maniere "AvecTestOrgaAvecOffset" } set AvecTestOrga [string equal -nocase $Maniere "AvecTestOrga"] set AvecOffset [string equal -nocase $Maniere "AvecOffset"] if {$AvecLaSeq==""} { set AvecLaSeq "SansLaSeq" } set AvecLaSeq [string equal -nocase $AvecLaSeq "AvecLaSeq"] set Nom [file tail $Fichier] set SeuilDuBlastN 0.001 set nSequencesTrouves [DecortiqueBlast $Fichier \ $SeuilDuBlastN "SansLimiteDeNombre" Query lBanqueId lAccess lDE lProfil lPN lPartieSegAli] if { $nSequencesTrouves == 0 } { set nCops 0 return {} } if {$Qui=="FirstOnly"} { set Qui [lindex $lBanqueId 0] } set ListeDesHomologues {} set nCops 0 set AttendreFinEntete 0 set FinEntete 0 foreach BanqueId $lBanqueId PN $lPN PartieSegAli $lPartieSegAli { if {$Qui!="" && ! [string equal -nocase $Qui $BanqueId]} { continue } if {$AvecTestOrga} { set Genre "" set Espece "" scan [OffsetEtOrganismeDuFragment $BanqueId $BanqueBlast] "%s %s %s" O Genre Espece set OrgaComplet "$Genre $Espece" set Orga [Glossaire $OrgaComplet Court] } else { set Orga "iinc" } set nCopsDansCetteSequence 0 foreach Ligne $PartieSegAli { if { $AttendreFinEntete } { if { ! [regexp {[0-9a-zA-Z_]} $Ligne] } { set AttendreFinEntete 0 set FinEntete 1 } else { append Entete $Ligne continue } } if {[regexp {^>} $Ligne]} { set Entete $Ligne set AttendreFinEntete 1 } if { $FinEntete } { set FinEntete 0 if {$AvecOffset} { set Offset [OffsetDansEnteteSegAli $Entete $BanqueBlast] } else { set Offset 0 } } if { [regexp "^ Identities =" $Ligne] } { set Identities [StringApres "Identities =" dans $Ligne] set Positives [StringApres "Positives =" dans $Ligne] scan $Identities "%d/%d" nId nTotal scan $Positives "%d/%d" nPo nTotal } if { [regexp "^ Score =" $Ligne] } { if {[info exists Score]} { incr nCops incr nCopsDansCetteSequence if { $AvecLaSeq } { set EtLaSeq "\t$SeqQuery\t$SeqSbjct" } else { set EtLaSeq "" } Wup "Je triche en cachant dans Score le PourcentageIdentite" set PourcentageIdentiteCacheDansScore [format "%5.2f" [expr (100.*$nId)/$nTotal]] set BeauIdentities [format "%14.14s" $Identities] lappend ListeDesHomologues "$Nom\t$nCops\t$nCopsDansCetteSequence\t$BanqueId\t$Orga\t$BeauIdentities\t$Expect\t$DebutQuery\t$FinQuery\t$DebutSbjct\t$FinSbjct$EtLaSeq" unset Score unset Expect unset DebutQuery unset DebutSbjct } set Score [FloatApres "Score =" dans $Ligne] catch {unset Expect} if {[regexp "Expect =" $Ligne]} { set Expect [PNApres "Expect =" dans $Ligne] } if {[regexp {Expect\([0-9]\) =} $Ligne Match]} { set Expect [PNApres $Match dans $Ligne] } if { ! [info exists Expect]} { Warne "$Ligne\nwithout Expect ... I break" catch {unset Score} catch {unset Expect} catch {unset DebutQuery} catch {unset DebutSbjct} break } catch {unset DebutQuery} catch {unset DebutSbjct} if { [expr $Expect > $SeuilDuBlastN]} { catch {unset Score} catch {unset Expect} catch {unset DebutQuery} catch {unset DebutSbjct} break } } if {[regexp "^ Database:" $Ligne] } { break } if {[regexp "^Query:?" $Ligne] } { if { ! [info exists DebutQuery]} { set SeqQuery "" #rR pour lire aussi les blast+ 2018/11/07 set Key "Query" if {[regexp "Query:" $Ligne]} { set Key "Query:" } set DebutQuery [IntegerApres $Key dans $Ligne] } regexp -indices {[0-9]+} $Ligne D set D [lindex $D 1] regexp -indices {[0-9]+} [string range $Ligne [incr D] end] F set F [expr [lindex $F 0]+$D-1] append SeqQuery [string trim [string range $Ligne $D $F]] set FinQuery [IntegerEnFin de $Ligne] } if {[regexp "^Sbjct:?" $Ligne] } { if { ! [info exists DebutSbjct]} { set SeqSbjct "" #rR pour lire aussi les blast+ 2018/11/07 set Key "Sbjct" if {[regexp "Sbjct:" $Ligne]} { set Key "Sbjct:" } set DebutSbjct [expr [IntegerApres $Key dans $Ligne] + $Offset] } regexp -indices {[0-9]+} $Ligne D set D [lindex $D 1] regexp -indices {[0-9]+} [string range $Ligne [incr D] end] F set F [expr [lindex $F 0]+$D-1] append SeqSbjct [string trim [string range $Ligne $D $F]] set FinSbjct [expr [IntegerEnFin de $Ligne] + $Offset] } } if {[info exists Score] && [expr $Expect <= $SeuilDuBlastN] } { incr nCops incr nCopsDansCetteSequence if { $AvecLaSeq } { set EtLaSeq "\t$SeqQuery\t$SeqSbjct" } else { set EtLaSeq "" } Wup "Je triche en cachant dans Score le PourcentageIdentite" set PourcentageIdentiteCacheDansScore [expr (100.*$nId)/$nTotal] lappend ListeDesHomologues "$Nom\t$nCops\t$nCopsDansCetteSequence\t$BanqueId\t$Orga\t$PourcentageIdentiteCacheDansScore\t$Expect\t$DebutQuery\t$FinQuery\t$DebutSbjct\t$FinSbjct$EtLaSeq" } catch {unset Score} catch {unset Expect} catch {unset DebutQuery} catch {unset DebutSbjct} if {$Qui!=""} { break } } return $ListeDesHomologues } proc CreeClasseDesOrganismes {} { global RepertoireDuGenome foreach Organisme [Glossaire Bidon Index] { regsub "_" $Organisme " " Organisme set Classe [OCduOS $Organisme] if {$Classe=="ClassUnknown" && [regexp -nocase virus $Organisme]} { set Classe "Virus" } lappend Sortie "$Organisme $Classe" } Espionne [SauveLesLignes $Sortie dans glossaire.classes.arenommer] } proc ContigDuPAB Nom { global RepertoireDuGenome global ContigDuPAB global ListeDeBoites if { ! [info exists ListeDeBoites]} { ChargeListeDeBoites } if {[info exists ContigDuPAB($Nom)]} { return [set ContigDuPAB($Nom)] } if {[info exists ContigDuPAB("EstCharge")]} { return 0 } set FichierBornesDesContigs "$RepertoireDuGenome/fiches/bornesdescontigs" set ContigDuPAB("EstCharge") "EstCharge" if { ! [file exists $FichierBornesDesContigs]} { return 0 } else { foreach Ligne [LesLignesDuFichier $FichierBornesDesContigs] { scan $Ligne "%s %s %s" Contig Debut Fin lappend LesDebuts $Debut lappend LesFins $Fin set Contigs($Debut) $Contig set Fins($Debut) $Fin } foreach Boite $ListeDeBoites { set NomLu [Box $Boite nom] set Debut [Box $Boite debut] set Fin [Box $Boite fin] set Orient [Box $Boite orient] foreach DC $LesDebuts { if { $Debut < $DC } { continue } set ContigDuPAB($NomLu) "[set Contigs($DC)] $DC [set Fins($DC)]" } } return [ContigDuPAB $Nom] } } proc ConcateneLesContigs {{FichierACreer ""} {NomDeBapteme ""}} { global RepertoireDuGenome if {$FichierACreer==""} { FaireLire "Please give me the name of the DNA sequence file." set FichierACreer [FichierPourSaveAs "$RepertoireDuGenome/beton/allcontigs.tfa"] } if {$FichierACreer==""} { return "" } if {$NomDeBapteme==""} { set NomDeBapteme "DNAsequence" } set Tout "" set ToutPure "" set NumeroContig 0 set FinContig 0 foreach FichierContig [glob "$RepertoireDuGenome/contigs/*"] { incr NumeroContig set LigneKO 0 set Contig "" foreach Ligne [LesLignesDuFichier $FichierContig] { regsub -all -nocase "X" $Ligne "N" Ligne if {[regexp -nocase {[^ATGCNMKRSYWVHDB ]} $Ligne Match]} { if {[OuiOuNon "In file $FichierContig a line contiains\n $Match\nwhich is unusual. \ Do I skipp this file"]} { set LigneKO 1 ; break } if {[OuiOuNon "Do I skipp this line ?"]} { continue } if {[OuiOuNon "Do I remove the wrong characters ?"]} { regsub -nocase {[^ATGCNMKRSYWVHDB]} $Ligne] "" Ligne } if {[OuiOuNon "Do I replace the wrong characters with 'n' ?"]} { regsub -nocase {[^ATGCNMKRSYWVHDB]} $Ligne] "n" Ligne } } if {$LigneKO } { continue } regsub " " $Ligne "" Ligne append Contig $Ligne } set PotStart "TTAnTTAnTTATGnATGnATG" set TratStop "CATnCATnCATAAnTAAnTAA" set GrosContig "$PotStart$Contig$TratStop" set Tout "$Tout$GrosContig" set PotStartPure "nnnnnnnnnnnnnnnnnnnnn" set TratStopPure "nnnnnnnnnnnnnnnnnnnnn" set GrosContigPure "$PotStartPure$Contig$TratStopPure" set ToutPure "$ToutPure$GrosContigPure" set DebutContig [expr $FinContig+1] set FinContig [string length $Tout] lappend LesBornesDesContigs "CONTIG[format "%4.4d" $NumeroContig] $DebutContig $FinContig" } Espionne [SauveLesLignes $LesBornesDesContigs dans "$RepertoireDuGenome/fiches/bornesdescontigs"] set Sequence [SequenceFormatTFA $Tout $NomDeBapteme "nucbrut"] set SequencePure [SequenceFormatTFA $ToutPure $NomDeBapteme.pure "nucbrut"] set NomDuFichierCree [Sauve $Sequence dans $FichierACreer] set NomDuFichierCreePure [Sauve $SequencePure dans $FichierACreer.pure] return $NomDuFichierCree return $NomDuFichierCreePure } proc AfficheTexte {Texte {Titre ""} {X ""} {Y ""} } { set w [NomDe fenetre] toplevel $w if {$Titre==""} { set Titre [string range $Texte 0 19] } wm title $w $Titre wm iconname $w $Titre set LesLignesDuTexte [split $Texte "\n"] set PremiereLigne [lindex $LesLignesDuTexte 0] set Hauteur [Mini 12 [Maxi 30 [llength $LesLignesDuTexte]]] set Largeur 80 foreach Ligne $LesLignesDuTexte { set Largeur [Maxi $Largeur [string length $Ligne]] } set Largeur [Mini $Largeur 180] text $w.text -wrap none -relief sunken -bd 2 \ -xscrollcommand "$w.scrollx set" -setgrid 1 \ -yscrollcommand "$w.scrolly set" -setgrid 1 \ -width $Largeur -height $Hauteur $w.text insert 0.0 $Texte $w.text configure -state "disable" focus $w.text frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m button $w.buttons.dismiss -background red -text "Dismiss" -command "destroy $w" pack $w.buttons.dismiss -side left -expand 1 button $w.buttons.saveas -text "Save All/Sel." bind $w.buttons.saveas <1> "SaveAs \[$w.text get 1.0 end\]" bind $w.buttons.saveas <2> "SaveAs \[$w.text get sel.first sel.last\]" pack $w.buttons.saveas -side left -expand 1 button $w.buttons.medline -text "Medline" bind $w.buttons.medline <1> "AfficheMedline \[$w.text get 1.0 end\]" pack $w.buttons.medline -side left -expand 1 scrollbar $w.scrollx -command "$w.text xview" -orient "horizontal" pack $w.scrollx -side bottom -fill x scrollbar $w.scrolly -command "$w.text yview" pack $w.scrolly -side right -fill y pack $w.text -expand yes -fill both if {$X!=""} { $w.text xview scroll $X units } if {$Y!=""} { $w.text yview scroll $Y units } return $w } proc EnMajuscule {Fichier {Action "toupper"}} { foreach Ligne [LesLignesDuFichier $Fichier] { lappend Sortie [string $Action $Ligne] } Espionne [SauveLesLignes $Sortie dans $Fichier.$Action] exit } proc VecteurVRP AA { global FichierGscopeVRP global VecteurVRP if {[info exists VecteurVRP($AA)]} { return [set VecteurVRP($AA)] } if {[info exists VecteurVRP("EstCharge")]} { return [set VecteurVRP(*)] } foreach Ligne [LesLignesDuFichier "$FichierGscopeVRP"] { scan $Ligne "%s %f %f" A X Y set VecteurVRP($A) "$X $Y" } set VecteurVRP("EstCharge") "0.0 0.0" return [VecteurVRP $AA]] } proc TresseVRP {{FichierMSF ""} {FichierTresse ""} {Derive 0}} { while { ! [file exists $FichierMSF]} { if {$FichierMSF==""} { FaireLire "Please, browse for a MSF file." set FichierMSF [ButineArborescence "All" "[RepertoireDuGenome]/"] } elseif {[regexp [ExpressionReguliereDesPABs] $FichierMSF]} { set FichierMSF "[RepertoireDuGenome]/msf/$FichierMSF" } if {$FichierMSF==""} { return "" } if { ! [file exists $FichierMSF]} { if {[OuiOuNon "$FichierMSF\n doesn't exist. Do I skipp ?"]} { return "" } set FichierMSF "" } } if {$FichierTresse==""} { FaireLire "Please, give a filename for output." set FichierTresse [FichierPourSaveAs] } if {$FichierTresse==""} { return "" } set NombreDeSequences [DecortiqueUnMSF $FichierMSF LesNomsDeSequences Sequences] set Sortie {} lappend Sortie "begin_object [string range [file tail $FichierMSF] end-5 end ]" set Ieme 0 foreach Nom $LesNomsDeSequences { incr Ieme set Sequence [set Sequences($Nom)] set Objet [format "%s%3.3d" "Seq" $Ieme] set Couleur [Nuance3x8 [expr 1.0*$Ieme/$NombreDeSequences]] scan $Couleur "%d %d %d" r g b set CouleurPourO [expr ($r*256 + $g)*256 + $b] lappend Sortie " colour $CouleurPourO" set Trace "move" set X 0.0 set Y 0.0 set Z 0.0 set dZ 1.0 foreach A [split $Sequence ""] { set Z [expr $Z+$dZ] scan [VecteurVRP $A] "%f %f" dX dY set X [expr $X+$dX] set Y [expr $Y+$dY] if {$Derive} { lappend Sortie "$Trace $X $Y $Z" } else { lappend Sortie "move 0.0 0.0 $Z" lappend Sortie "line $dX $dY $Z" } set Trace "line" } # lappend Sortie "end" # Espionne [set FichierCree [SauveLesLignes $Sortie dans ${FichierTresse}$Objet]] # regsub "/groupes/poch" $FichierCree "/home" FichierCree # lappend LesFichiersCrees "draw $FichierCree" } Espionne [SauveLesLignes $Sortie dans $FichierTresse] # Espionne [SauveLesLignes $LesFichiersCrees dans $FichierTresse] exit } proc CoGlimmer Nom { global RepertoireDuGenome global CoGlimmer if {[info exists CoGlimmer($Nom)]} { return [set CoGlimmer($Nom)] } if {[info exists CoGlimmer("EstCharge")]} { return [set CoGlimmer("EstCharge")] } Wup "Si bornesdesglimmers est cache on ne fait pas CoGlimmer" if { ! [file exists "$RepertoireDuGenome/fiches/bornesdesglimmers"]} { set CoGlimmer("EstCharge") "IgnoreCoGlimmer" return [set CoGlimmer("EstCharge")] } set FichierCoGlimmer "$RepertoireDuGenome/fiches/coglimmer" while { ! [file exists $FichierCoGlimmer]} { if {[OuiOuNon "Do I calculate overlaps with GLIMMER to create the file\n$FichierCoGlimmer\ ?"]} { CreeCorrespondanceAvecGlimmer $FichierCoGlimmer continue } if {[OuiOuNon "Do I ignore overlaps with GLIMMER ?"]} { set CoGlimmer("EstCharge") "IgnoreCoGlimmer" return [set CoGlimmer("EstCharge")] } if {[OuiOuNon "Do I exit ?"]} { exit } } foreach Ligne [LesLignesDuFichier $FichierCoGlimmer] { scan $Ligne "%s %s %s" A Etat B set CoGlimmer($A) "$Etat $B" } set CoGlimmer("EstCharge") "EstCharge" return [CoGlimmer $Nom] } proc CreeCorrespondanceAvecGlimmer {{FichierCoGlimmer ""}} { global RepertoireDuGenome global LesORFsEnOverlap global ListeDeBoites if { ! [info exists ListeDeBoites] } { ChargeListeDeBoites } if {$FichierCoGlimmer==""} { set FichierCoGlimmer "$RepertoireDuGenome/fiches/coglimmer" } foreach Boite [concat [ListeDesGLIMMERs] [ListeDesPABs]] { set Nom [Box $Boite nom] set Debut [Box $Boite debut] set Fin [Box $Boite fin] set Orient [Box $Boite orient] if {[regexp "GLIMMER" $Nom]} { set GLI($Debut,$Fin,$Orient) $Nom } if {[YaPABenDebutDe $Nom]} { set PAB($Debut,$Fin,$Orient) $Nom } } CalculeLesORFsEnOverlap "AvecGLIMMER" Espionne "debut array get LesORFsEnOverlap" EspionneL [array get LesORFsEnOverlap] Espionne "fin array get LesORFsEnOverlap" set Sortie {} FaireLire "coucou" foreach Boite [concat [ListeDesGLIMMERs] [ListeDesPABs]] { set Nom [Box $Boite nom] set Debut [Box $Boite debut] set Fin [Box $Boite fin] set Orient [Box $Boite orient] Espionne $Nom if {[regexp "GLIMMER" $Nom]} { if {[info exists PAB($Debut,$Fin,$Orient)]} { lappend Sortie "$Nom is [set PAB($Debut,$Fin,$Orient)]" } else { Espionne "$Nom,$Debut,$Fin,$Orient" if {[info exists LesORFsEnOverlap($Nom)]} { set Touches {} foreach Over [set LesORFsEnOverlap($Nom)] { if { ! [YaPABenDebutDe $Over]} { continue } if {$Orient != [Box $Over orient]} { continue } if {[expr [Box $Over debut]%3] != [expr $Debut%3]} { continue } lappend Touches "$Over" } if {$Touches!={}} { lappend Sortie "$Nom touches [join $Touches " "]" } } } } if {[YaPABenDebutDe $Nom]} { if {[info exists GLI($Debut,$Fin,$Orient)]} { lappend Sortie "$Nom is [set GLI($Debut,$Fin,$Orient)]" } else { Espionne "$Nom,$Debut,$Fin,$Orient" if {[info exists LesORFsEnOverlap($Nom)]} { set Touches {} foreach Over [set LesORFsEnOverlap($Nom)] { if { ! [regexp "GLIMMER" $Over]} { continue } if {$Orient != [Box $Over orient]} { continue } if {[expr [Box $Over debut]%3 != $Debut%3]} { continue } lappend Touches "$Over" } if {$Touches!={}} { lappend Sortie "$Nom overlaps [join $Touches " "]" } } } } } catch {unset LesORFsEnOverlap} return [SauveLesLignes $Sortie dans $FichierCoGlimmer] } proc DotPlotADN {PosX PosY} { global DotPlotDesProches set DotPlotDesProches 0 set lX 512 set lY $lX set F 50 set SeuilAffichage 50 set dX [expr $PosX-$lX] set fX [expr $PosX+$lX] set dY [expr $PosY-$lY] set fY [expr $PosY+$lY] for {set i $dX} {$i<$fX} {incr i} { set SeqX [BoutADN [expr $i-$F] [expr $i+$F] "F"] set LesX [split $SeqX ""] for {set j $dY} {$j<$fY} {incr j} { set SeqY [BoutADN [expr $j-$F] [expr $j+$F] "F"] set LesY [split $SeqY ""] set N 0 set Z 5 foreach X $LesX Y $LesY { if {$X==$Y} { incr N set Z 5 } else { incr Z -1 } if {$Z} { continue } break } set Score [expr ($N*100)/(2*$F+1)] if {$Score > $SeuilAffichage } { lappend Nous "$SeqX " lappend Vous " $SeqY" lappend NosPos $i lappend VosPos $j } } } return [Plotte $Nous $Vous $NosPos $VosPos] } proc CreeGIF {} { set K .toto canvas $K -width 100 -height 200 $K create rectangle 20 20 40 50 -fill "red" CanvaEnGIF $K "OnVeutTout" "[HomeRipp]/gigi.gif" destroy $K } proc GscopeBoard {{Titre ""} {PourGif ""}} { global RepertoireDuGenome global ListeDeBoites global ScaleCumuleDeGonfle OrigXCumuleDeGonfle OrigYCumuleDeGonfle global ScrollRectangleOriginal IdScrollRectangle global bVisuPepCurrentGenome bVisuBlastCurrentGenome bVisuMSFCurrentGenome global CouleurDuFond global KanvaCourant global LesKanvasOuverts global Org1 Org2 global LesOrdresPourGif if {$Titre==""} { set Titre "GscopeBoard" } Gs "Canvas" if {$PourGif != ""} { set PourGif 1 set Canvas NeRienFaire set Bind NeRienFaire set Pack NeRienFaire set Fram NeRienFaire set Button NeRienFaire set Scrollbar NeRienFaire set Grid NeRienFaire set FonctionRejetteLaBoite "RejetteLaBoite" set LesOrdresPourGif {} set w "PourGif" set K "OrdrePourGif" } else { set PourGif 0 set Canvas canvas set Bind bind set Pack pack set Fram frame set Button button set Scrollbar scrollbar set Grid grid set FonctionRejetteLaBoite "NeRejettePasLaBoite" set w [NomDe board] catch {destroy $w} toplevel $w wm title $w "$Titre" wm iconname $w "$Titre" set K $w.canvas JeMeSignale "Patience" } if { ! [info exists ListeDeBoites] } { ChargeListeDeBoites } set ScroHor $w.hscroll set ScroVer $w.vscroll set KShSv $w.grid set Boutons $w.buttons set Clavier $w.buttons scan [BoundingBox $ListeDeBoites] "%d %d" xDebut xFin set xDebut [Maxi 0 [expr $xDebut-3000]] incr xFin 1000 set CanvaSizeX [expr $xFin - $xDebut] set CanvaScroMinX [expr $xDebut] set CanvaScroMaxX [expr $xFin ] set CanvaScreenX 1024 set TxtCenX 0 set BoxMinY -20 set BoxMaxY 20 set DeltaY [expr 0.9*($BoxMaxY-$BoxMinY)] set BordHaut [expr 1.5*($BoxMaxY-$BoxMinY)] set EcraseLaFrame(a) 0.8 set EcraseLaFrame(b) 0.8 set EcraseLaFrame(c) 0.8 set EcraseLaFrame(A) 0.8 set EcraseLaFrame(B) 0.8 set EcraseLaFrame(C) 0.8 set EcraseLaFrame(T) 1.0 set EcraseLaFrame(N) 0.7 set EcraseLaFrame(Z) 1.0 set EcraseLaFrame(n) 0.7 set EcraseLaFrame(t) 1.0 set EcraseLaFrame(D) 0.8 set EcraseLaFrame(E) 0.8 set EcraseLaFrame(F) 0.8 set EcraseLaFrame(d) 0.8 set EcraseLaFrame(e) 0.8 set EcraseLaFrame(f) 0.8 set PositionDeLaFrame(a) [expr $BordHaut + 0.0*$DeltaY] set PositionDeLaFrame(b) [expr $BordHaut + 1.0*$DeltaY] set PositionDeLaFrame(c) [expr $BordHaut + 2.0*$DeltaY] set PositionDeLaFrame(A) [expr $BordHaut + 0.5*$DeltaY] set PositionDeLaFrame(B) [expr $BordHaut + 1.5*$DeltaY] set PositionDeLaFrame(C) [expr $BordHaut + 2.5*$DeltaY] set PositionDeLaFrame(T) [expr $BordHaut + 3.0*$DeltaY] set PositionDeLaFrame(N) [expr $BordHaut + 3.2*$DeltaY] set PositionDeLaFrame(Z) [expr $BordHaut + 3.5*$DeltaY] set PositionDeLaFrame(n) [expr $BordHaut + 3.8*$DeltaY] set PositionDeLaFrame(t) [expr $BordHaut + 4.0*$DeltaY] set PositionDeLaFrame(D) [expr $BordHaut + 5.5*$DeltaY] set PositionDeLaFrame(E) [expr $BordHaut + 6.5*$DeltaY] set PositionDeLaFrame(F) [expr $BordHaut + 7.5*$DeltaY] set PositionDeLaFrame(d) [expr $BordHaut + 5.0*$DeltaY] set PositionDeLaFrame(e) [expr $BordHaut + 6.0*$DeltaY] set PositionDeLaFrame(f) [expr $BordHaut + 7.0*$DeltaY] if {[OnTraiteUnGenome]} { set PositionDuSpectre [expr $BordHaut + 9.0*$DeltaY] set PosLineY [expr ($PositionDeLaFrame(a)+$PositionDeLaFrame(f))/2] } else { set PositionDuSpectre [expr $BordHaut + 2.0*$DeltaY] } set TxtCenY 0 set PosSecheLingeMinY 10 set PosSecheLingeMaxY 30 # set yHaut [expr $PositionDeLaFrame(a)-2*$BoxMinY] # set yBas [expr $PositionDeLaFrame(f)+2*$BoxMaxY] # set CanvaSizeY [expr $yBas-$yHaut] # set CanvaScroMinY [expr $yHaut - 0.1*$CanvaSizeY] # set CanvaScroMaxY [expr $yBas + 0.1*$CanvaSizeY] set CanvaScroMinY 0 set CanvaScroMaxY [expr $PositionDuSpectre + 1.2*$DeltaY] set CanvaScreenY [expr $CanvaScroMaxY-$CanvaScroMinY] set CanvaSizeY $CanvaScreenY $Fram $Boutons $Pack $Boutons -side bottom -fill x -pady 2m TouchePour $Clavier NouvelleGamme TouchePour $Clavier NouvelleCouleur "red" set ToucheDismiss [TouchePour $Clavier "Dismiss" "DetruireLeBoard $w"] $Bind $ToucheDismiss "MainLeveeSurUnCanva $K" TouchePour $Clavier NouvelleGamme TouchePour $Clavier NouvelleCouleur "lightgrey" TouchePour $Clavier "Zoom" "Gonfle $w all " TouchePour <2> "/UnZoom" "Gonfle $w all degonfle" TouchePour <3> "/Reset" "Gonfle $w all reset reset" if { ! [PourWscope]} { TouchePour $Clavier "Vis PNG" "CanvaEnPNG $K Visible AskForFile" TouchePour <2> "/Postscr" "CanvaEnPostscript $K Visible AskForFile" TouchePour <3> "/print" "CanvaEnImpression $K Visible" TouchePour $Clavier "All PNG" "CanvaEnPNG $K OnVeutTout AskForFile" TouchePour <2> "/Postscr" "CanvaEnPostscript $K OnVeutTout AskForFile" TouchePour <3> "/print" "CanvaEnImpression $K OnVeutTout" } TouchePour $Clavier NouvelleGamme TouchePour $Clavier NouvelleCouleur "yellow" TouchePour $Clavier "Color ORFs" "RedefinirLaCouleur $K" TouchePour <2> "/Banner" "RedefinirLaCouleurDuLinge $K" TouchePour <3> "/Which" "FaireLire \[SignificationLingeFrameFard $K\]" TouchePour $Clavier "Colors display" "AfficheLesCouleursEtSignifications $K" TouchePour <2> "/to file" "CreeLeFichierAssocieAuxCouleurs $K" TouchePour <3> " /On enter" "RedefinirLeFard $K" if { ! [PourWscope]} { TouchePour $Clavier "Action ORF-Enter" "ShowBoxAction Enter" TouchePour <2> "/Clic" "ShowBoxAction Clic" TouchePour <3> "/Show" "ShowBoxAction Which" } TouchePour $Clavier NouvelleGamme TouchePour $Clavier NouvelleCouleur "green" TouchePour $Clavier "Search" "RepereBox \[Entre \"Nom: [PreFixe]\"\] $K" TouchePour <2> "/Next" "RepereBox Salut $K NextSansInforme" TouchePour <3> "/Info" "RepereBox Salut $K Next" TouchePour $Clavier "Nuc pos." "RepereNuc \[Entre \] $K" TouchePour <2> " /sequence" "RepereNuc \[ChoixParmi \[LocaliseSurADN\]\]\" $K" TouchePour <3> "/ Bird" "BirdGscopeSearch" TouchePour $Clavier "Chromo" "IllustreLesChromosomes" TouchePour <2> "/Histo" "ChoixHistogramme" TouchePour <3> "/Narcisse" "RepereBox \"Nom: \[Narcisse \[Entre\]\]\" $K" if { ! [PourWscope]} { TouchePour $Clavier NouvelleGamme TouchePour $Clavier NouvelleCouleur "lightgrey" TouchePour $Clavier "Sel. to file" "Presente \[LesNomsPiques\]" TouchePour <2> "/to disp" "Presente \[LesNomsPiques\]" TouchePour <3> "/Reset" "Deselecte $K" TouchePour $Clavier "Text font" "Scene $K toggle font" TouchePour <2> "/color" "Scene $K toggle fill" TouchePour $Clavier "Toggle text" "ToggleCanva $K TEXTE" TouchePour <2> "/upper line" "ToggleCanva $K Linge" } if { ! [PourWscope]} { TouchePour $Clavier NouvelleGamme TouchePour $Clavier NouvelleCouleur "lightblue" TouchePour $Clavier "Blast: X zone" "BlastXsurZone $K" TouchePour <2> "/6P zone" "SixBlastPsurZone $K" TouchePour <3> "/6P sel Prot" "SixBlastPsurPiques \[LesNomsPiques\]" TouchePour $Clavier "Create DNA seq" "CreeLaSequenceDeLaZone $K" TouchePour <2> "/Extend DNA" "VoisinADNDeLaZone $K" TouchePour $Clavier "Create Family" "CreeLesFamillesDesSelectionnes" } # $Button $Boutons.liste -text "List\nTFA/Blast/MSF" \ # -background "green" -foreground "black" # $Bind $Boutons.liste <1> "$bVisuPepCurrentGenome invoke" # $Bind $Boutons.liste <2> "$bVisuBlastpCurrentGenome invoke" # $Bind $Boutons.liste <3> "$bVisuMSFCurrentGenome invoke" # $Pack $Boutons.liste -side left -expand 1 $Fram $KShSv $Scrollbar $ScroHor -orient horiz -command "$K xview" $Scrollbar $ScroVer -command "$K yview" set BetterCanvaScroMaxY $CanvaScroMaxY if {[OnTraiteDesClones]} { set BetterCanvaScroMaxY 3000 } $Canvas $K -relief sunken -borderwidth 2 \ -width $CanvaScreenX \ -height $CanvaScreenY \ -scrollregion [list $CanvaScroMinX $CanvaScroMinY $CanvaScroMaxX $BetterCanvaScroMaxY] \ -xscrollcommand "$ScroHor set" \ -yscrollcommand "$ScroVer set" $Pack $KShSv -expand yes -fill both -padx 1 -pady 1 $Grid rowconfig $KShSv 0 -weight 1 -minsize 0 $Grid columnconfig $KShSv 0 -weight 1 -minsize 0 $Grid $K -in $KShSv -padx 1 -pady 1 -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news $Grid $ScroVer -in $KShSv -padx 1 -pady 1 -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news $Grid $ScroHor -in $KShSv -padx 1 -pady 1 -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news set CouleurDuFond "cadetblue" $K configure -background $CouleurDuFond set IdScrollRectangle($K) [$K create rectangle $CanvaScroMinX $CanvaScroMinY $CanvaScroMaxX $BetterCanvaScroMaxY -outline $CouleurDuFond -tag [list "Cadre"]] set ScrollRectangleOriginal($K) "[$K coords [set IdScrollRectangle($K)]]" if {[OnTraiteUnGenome]} { $K create line $CanvaScroMinX $PosLineY $CanvaScroMaxX $PosLineY -fill "black" } set Patientons [$K create text 10 20 -text "Merci de patienter ... " -font {Courier 12} -anchor w] if { ! $PourGif && ! [PourWscope] && [OnTraiteUnGenome]} { AfficheLeSpectreGC $K [expr $PositionDuSpectre - $DeltaY] [expr $PositionDuSpectre + $DeltaY] } #rR set LesBoites [concat [ListeDesGLIMMERs] [ListeDesPABs] [ListeDesTRNAs] [ListeDesARNs] [ListeDesTROUs] [ListeDesFusions]] set LesBoites [concat [ListeDesPABs] [ListeDesTRNAs] [ListeDesARNs] [ListeDesTROUs] [ListeDesFusions]] foreach Boite $LesBoites { if {[$FonctionRejetteLaBoite $Boite]} { continue } set Nom [Box $Boite nom] set Frame [Box $Boite frame] set PosY [set PositionDeLaFrame($Frame)] if {[OnTraiteDesClones]} { set PosY [set PositionDeLaFrame(a)] set DebFinOri "[Box $Boite deb]_[Box $Boite fin]_[Box $Boite ori]" if { ! [info exists DejaPlace($DebFinOri)]} { set DejaPlace($DebFinOri) -1 } set IemePosY [incr DejaPlace($DebFinOri)] set PosY [expr $PosY + $IemePosY*0.9*($BoxMaxY-$BoxMinY)] } set PosMinY [expr $PosY + $BoxMinY*[set EcraseLaFrame($Frame)]] set PosMaxY [expr $PosY + $BoxMaxY*[set EcraseLaFrame($Frame)]] set PosTxtY [expr $PosY + $TxtCenY] set PosMinX [Box $Boite debut] set PosMaxX [Box $Boite fin] set PosTxtX [expr ($PosMinX+$PosMaxX)/2 + $TxtCenX] set Forme "rect" if {[regexp "TROU" $Nom] && ! [PourWscope]} { set Forme "oval" } if {[EstUneFusion $Nom]} { set Forme "oval" } if {[Fantome $Nom]} { set CouleurTrait "white" } else { set CouleurTrait "black" } if {[regexp "GLIMMER" $Nom]} { if {[regexp "^is " [CoGlimmer $Nom]]} { continue } set DecalageY 10 } else { set GlimmerOK [regexp "^is " [CoGlimmer $Nom]] set GlimmerNO [regexp "EstCharge" [CoGlimmer $Nom]] set DecalageY 0 } if {[YaPABenDebutDe $Nom] && $GlimmerNO} { $K create $Forme $PosMinX $PosMinY $PosMaxX [expr $PosMaxY+$DecalageY+10] \ -fill "lightgrey" \ -outline "black" \ -tags [list "Box" "Fantome_$Boite" "FetchMe"] } $K create $Forme $PosMinX $PosMinY $PosMaxX [expr $PosMaxY+$DecalageY] \ -fill $CouleurDuFond \ -outline $CouleurTrait \ -tags [list "Box" "$Boite" "FetchMe"] set TexteOrgAvant "" set TexteOrgApres "" if {0 && [YaPABenDebutDe $Nom] && ! [ExisteOrthologueDans $Org1 $Nom]} { set TexteOrgAvant "+ " } if {0 && [YaPABenDebutDe $Nom] && ! [ExisteOrthologueDans $Org2 $Nom]} { set TexteOrgApres " +" } if {1} { $K create text $PosTxtX $PosTxtY \ -text "${TexteOrgAvant}[NomDeScene $Boite]${TexteOrgApres}" \ -fill $CouleurTrait \ -font {Courier 8} \ -anchor center \ -tags [list "TEXTE" "Txt_$Nom" "FetchMe" "DispMe"] } if {[regexp "GLIMMER" $Nom]} { continue } $K create rectangle $PosMinX $PosSecheLingeMinY $PosMaxX $PosSecheLingeMaxY \ -tags [list "Linge" "Linge$Boite"] } Wup " ............................................et GscopeBoard crea les boites" if { ! $PourGif } { DefinirLaCouleurAuLancement $K } if {[OnTraiteUnGenome] && ! [PourWscope]} { RelieLesOperons $K $PosLineY } $K delete $Patientons if {[PourWscope]} { $K bind "FetchMe" <1> "FetcheBox $K %x %y" } else { $K bind "DispMe" "ShowBox $K %x %y Enter" $K bind "DispMe" "ShowBox $K %x %y Leave" $K bind "Box" "EnterBox $K %x %y" $K bind "Box" "LeaveBox $K %x %y" $K bind "FetchMe" <1> "FetcheBox $K %x %y" $K bind "FetchMe" "FetcheBox $K %x %y MSF" $K bind "FetchMe" "Informe \[NomDuCourant $K\]" $Bind $K <2> "$K scan mark %x %y" if {[OnTraiteDesCDNAs]} { $K bind "Box" <2> "VoirLaMeilleureLocalisationDuCDNA \[NomDuCourant $K\]" } $Bind $K "$K scan dragto %x %y" $K bind "Box" "SautParalogue $K %x %y" $K bind "Box" <3> "PiqueBox $K %x %y Fixe" $Bind $K "ShowNuc $K %x %y Point" $Bind $K "ShowNuc $K %x %y Motion" } if {$PourGif } { return $LesOrdresPourGif } ShowBoxAction EnterDefaults Gonfle $w all 0.1 set KanvaCourant $K lappend LesKanvasOuverts $K JeMeSignale "FinPatience" if {0 && [PourWscope] } { return $w } else { return $K } } proc DecalageAngulaireRosace {} { global DecalageAngulaireRosace if {[info exists DecalageAngulaireRosace]} { return $DecalageAngulaireRosace } if {[regexp "MsFinal" [RepertoireDuGenome]]} { set StartGenome 5916072 set LongueurGenome 6988205 set DecalageAngulaireRosace [expr (1.*$StartGenome/$LongueurGenome)*2*3.14159] } else { set DecalageAngulaireRosace 0 } return $DecalageAngulaireRosace } proc RscopeBoard {Titre {PourGif ""}} { global RepertoireDuGenome global ListeDeBoites global ScaleCumuleDeGonfle OrigXCumuleDeGonfle OrigYCumuleDeGonfle global ScrollRectangleOriginal IdScrollRectangle global bVisuPepCurrentGenome bVisuBlastCurrentGenome bVisuMSFCurrentGenome global CouleurDuFond global KanvaCourant global LesKanvasOuverts global RosaceCourante global Org1 Org2 global ParametresDuBoard global FichierGscopeHublot global LesOrdresPourGif Gs "Canvas" if {$PourGif != ""} { set PourGif 1 set Canvas NeRienFaire set Bind NeRienFaire set Pack NeRienFaire set Fram NeRienFaire set Button NeRienFaire set Scrollbar NeRienFaire set Grid NeRienFaire set FonctionRejetteLaBoite "RejetteLaBoite" set LesOrdresPourGif {} } else { set PourGif 0 set Canvas canvas set Bind bind set Pack pack set Fram frame set Button button set Scrollbar scrollbar set Grid grid set FonctionRejetteLaBoite "NeRejettePasLaBoite" JeMeSignale "Patience" } if { ! [info exists ListeDeBoites] } { ChargeListeDeBoites } if { ! $PourGif} { set w [NomDe rond] catch {destroy $w} toplevel $w wm title $w "$Titre" wm iconname $w "$Titre" set K $w.canvas set CanvasizeX 800 set CanvasizeX 800 } else { set w "PourGif" set K "OrdrePourGif" set CanvasizeX 256 } scan [BoundingBox $ListeDeBoites] "%d %d" xDebut xFin set CanvaScroMinX 0 set CanvaScroMaxX $CanvasizeX set CanvasizeY $CanvasizeX set CanvaScroMinY 0 set CanvaScroMaxY $CanvasizeY set CanvascreenX $CanvasizeX set CanvascreenY $CanvascreenX set CentreX [expr $CanvascreenX/2] set CentreY [expr $CanvascreenY/2] set RayonMoyen [expr $CentreX*0.60] set RayonMoyen [expr $CentreX*0.80] set OffsetRayonMin [expr $RayonMoyen*0.02] set OffsetRayonMax [expr $RayonMoyen*0.18] set ScroHor $w.hscroll set ScroVer $w.vscroll set KShSv $w.grid set Boutons $w.buttons $Fram $Boutons $Pack $Boutons -side bottom -fill x -pady 2m $Button $Boutons.dismiss -text "Dismiss" -background red -command "DetruireLaRosace $w" $Bind $Boutons.dismiss "MainLeveeSurUnCanva $K" $Pack $Boutons.dismiss -side left -expand 1 $Button $Boutons.gonfle -text "Zoom/UnZoom/Desel\nJpg/Postscript/Print\nErase Sticks/Textes/Arcs" $Bind $Boutons.gonfle <1> "Gonfle $w all gonfle gonfle" $Bind $Boutons.gonfle <2> "Gonfle $w all degonfle degonfle" $Bind $Boutons.gonfle <3> "Deselecte $K" # $Bind $Boutons.gonfle "ToggleCanva $K TEXTE" # $Bind $Boutons.gonfle "CanvaEnPNG $K" $Bind $Boutons.gonfle "CanvaEnJpg $K" $Bind $Boutons.gonfle "CanvaEnPostscript $K Visible AskForFile" $Bind $Boutons.gonfle "CanvaEnImpression $K Visible AskForFile" $Bind $Boutons.gonfle "CleanRosace $K Aiguilles" $Bind $Boutons.gonfle "CleanRosace $K Textes" $Bind $Boutons.gonfle "CleanRosace $K Zones" $Pack $Boutons.gonfle -side left -expand 1 $Button $Boutons.recolore \ -text "Color ORFs/Banner/Which\nColors display/to file/On enter\nAction ORF-Enter/Clic/Show" \ -background "yellow" $Bind $Boutons.recolore <1> "RedefinirLaCouleur $K" $Bind $Boutons.recolore <2> "RedefinirLaCouleurDuLinge $K" $Bind $Boutons.recolore <3> "FaireLire \[SignificationLingeFrameFard $K\]" $Bind $Boutons.recolore "AfficheLesCouleursEtSignifications $K" $Bind $Boutons.recolore "CreeLeFichierAssocieAuxCouleurs $K" $Bind $Boutons.recolore "RedefinirLeFard $K" if { ! [PourWscope]} { $Bind $Boutons.recolore "ShowBoxAction Enter" $Bind $Boutons.recolore "ShowBoxAction Clic" $Bind $Boutons.recolore "ShowBoxAction Which" } $Pack $Boutons.recolore -side left -expand 1 $Button $Boutons.repere -text "Search/Next/Info\nNucleic\nNarcisse" -background "green" $Bind $Boutons.repere <1> "RepereBox \[Entre \"Nom: [PreFixe]\"\] $K" $Bind $Boutons.repere "RepereNuc \[Entre \] $K" $Bind $Boutons.repere "RepereBox \"Nom: \[Narcisse \[Entre\]\]\" $K" $Bind $Boutons.repere <2> "RepereBox Salut $K NextSansInforme" $Bind $Boutons.repere <3> "RepereBox Salut $K Next" $Pack $Boutons.repere -side left -expand 1 $Button $Boutons.intero -text "Wheel Add/New/Which\nText Add/Save/Append\nfrom list/ /Erase" $Bind $Boutons.intero <1> "InteRosace Add $K" $Bind $Boutons.intero <2> "InteRosace New $K" $Bind $Boutons.intero <3> "InteRosace Which $K" $Bind $Boutons.intero "TextePourRosace Add $K" $Bind $Boutons.intero "SauveLeCanva $K {Zone Fleche Etiquette}" $Bind $Boutons.intero "RestaureLeCanva $K ; BindLaRosace $K" $Bind $Boutons.intero "TextePourRosace AddFromList $K " $Bind $Boutons.intero "" $Bind $Boutons.intero "TextePourRosace Erase $K" $Pack $Boutons.intero -side left -expand 1 $Button $Boutons.rosarc -text "Wheel Turn+/Turn-/Switch\nText Add/Save/Append\nfrom list/ /Erase" $Bind $Boutons.rosarc <1> "InteRosace Turn+ $K" $Bind $Boutons.rosarc <2> "InteRosace Turn- $K" $Bind $Boutons.rosarc <3> "InteRosace Switch $K" $Bind $Boutons.rosarc "TextePourRosace Add $K" $Bind $Boutons.rosarc "TextePourRosace Save $K" $Bind $Boutons.rosarc "TextePourRosace Append $K" $Bind $Boutons.rosarc "TextePourRosace AddFromList $K " $Bind $Boutons.rosarc "" $Bind $Boutons.rosarc "TextePourRosace Erase $K" # $Pack $Boutons.rosarc -side left -expand 1 $Button $Boutons.piques -text "Create FOF" $Bind $Boutons.piques <1> "Presente \[LesNomsPiques\]" # $Pack $Boutons.piques -side left -expand 1 $Button $Boutons.selnuc -text "Blast: X nuc zone/6P zone/ 6P sel Prot\nCreate DNA sequence/Extend DNA" $Bind $Boutons.selnuc <1> "BlastXsurZone $K" $Bind $Boutons.selnuc <2> "SixBlastPsurZone $K" $Bind $Boutons.selnuc <3> "SixBlastPsurPiques \[LesNomsPiques\]" $Bind $Boutons.selnuc "CreeLaSequenceDeLaZone $K" $Bind $Boutons.selnuc "VoisinADNDeLaZone $K" $Pack $Boutons.selnuc -side left -expand 1 $Fram $KShSv $Scrollbar $ScroHor -orient horiz -command "$K xview" $Scrollbar $ScroVer -command "$K yview" $Canvas $K -relief sunken -borderwidth 2 \ -width $CanvascreenX \ -height $CanvascreenY \ -scrollregion [list $CanvaScroMinX $CanvaScroMinY $CanvaScroMaxX $CanvaScroMaxY] \ -xscrollcommand "$ScroHor set" \ -yscrollcommand "$ScroVer set" $Pack $KShSv -expand yes -fill both -padx 1 -pady 1 $Grid rowconfig $KShSv 0 -weight 1 -minsize 0 $Grid columnconfig $KShSv 0 -weight 1 -minsize 0 $Grid $K -in $KShSv -padx 1 -pady 1 -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky nsew $Grid $ScroVer -in $KShSv -padx 1 -pady 1 -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky nsew $Grid $ScroHor -in $KShSv -padx 1 -pady 1 -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky nsew set CouleurDuFond "cadetblue" if {[regexp "casimir" $RepertoireDuGenome]} { set CouleurDuFond "white" } if {[regexp "MsFinal" $RepertoireDuGenome]} { set CouleurDuFond "white" } $K configure -background $CouleurDuFond set IdScrollRectangle($K) [$K create rectangle $CanvaScroMinX $CanvaScroMinY $CanvaScroMaxX $CanvaScroMaxY -outline $CouleurDuFond -tag [list "Cadre"]] set ScrollRectangleOriginal($K) "[$K coords [set IdScrollRectangle($K)]]" set ParametresDuBoard($K,xDdebut) $xDebut set ParametresDuBoard($K,xFin) $xFin set ParametresDuBoard($K,CentreX) $CentreX set ParametresDuBoard($K,CentreY) $CentreY set ParametresDuBoard($K,RayonMoyen) $RayonMoyen set ParametresDuBoard($K,OffsetRayonMin) $OffsetRayonMin set ParametresDuBoard($K,OffsetRayonMax) $OffsetRayonMax if {0 && [info exists FichierGscopeHublot] && [file exists $FichierGscopeHublot]} { image create photo Hublot -file $FichierGscopeHublot $K create image $CentreX $CentreY -image Hublot -tags "Hublot" } foreach Boite $ListeDeBoites { if {[regexp "GLIMMER" $Boite]} { continue } if {[regexp "TROU" $Boite]} { continue } set Nom [Box $Boite nom] set Debut [Box $Boite debut] set Fin [Box $Boite fin] set Orient [Box $Boite orient] set Milieu [expr ($Debut+$Fin)/2] if {$Orient == "F"} { set Sens 1 } else { set Sens -1 } if {[YaPABenDebutDe $Nom]} { set RayonMin [expr $RayonMoyen + $Sens*$OffsetRayonMin] set RayonMax [expr $RayonMoyen + $Sens*$OffsetRayonMax] set LargeurDuTrait 1 } elseif {[regexp "TRNA" $Nom]} { set RayonMin [expr $RayonMoyen - $OffsetRayonMin] set RayonMax [expr $RayonMoyen + $OffsetRayonMin] set LargeurDuTrait 2 } elseif {[regexp "ARN" $Nom]} { set RayonMin [expr $RayonMoyen - $OffsetRayonMin] set RayonMax [expr $RayonMoyen + $OffsetRayonMin] set LargeurDuTrait 3 } else { set RayonMin [expr $RayonMoyen - $OffsetRayonMin] set RayonMax [expr $RayonMoyen + $OffsetRayonMin] set LargeurDuTrait 1 } set DecalageAngulaire [DecalageAngulaireRosace] set Angle [expr $DecalageAngulaire + 3.14159/2 - $Milieu*2*3.14159/$xFin] set PosMinX [expr $CentreX+$RayonMin*cos($Angle)] set PosMinY [expr $CentreY-$RayonMin*sin($Angle)] set PosMaxX [expr $CentreX+$RayonMax*cos($Angle)] set PosMaxY [expr $CentreY-$RayonMax*sin($Angle)] set Couleur $CouleurDuFond if {[Fantome $Nom]} { set CouleurTrait "white" } else { set CouleurTrait "black" } $K create line $PosMinX $PosMinY $PosMaxX $PosMaxY \ -width $LargeurDuTrait \ -fill $Couleur \ -tags [list "Box" "$Boite"] } Wup " .......................................... et Rscope crea les boites." DefinirLaCouleurAuLancement $K $K $Bind "RepereBox" <1> "$K delete current" $K $Bind "SelectionNucleique" <1> "$K delete current" $K $Bind "Box" <1> "FetcheBox $K %x %y" $K $Bind "Box" "FetcheBox $K %x %y" $K $Bind "Box" "Informe \[Box \[BoiteDuCourant $K %x %y\] nom \]" $K $Bind "Box" "OrganismesOrthologues $K %x %y" $K $Bind "Box" "SautParalogue $K %x %y" $K $Bind "Box" <3> "PiqueBox $K %x %y Fixe" $Bind $K "ShowNucRosace $K %x %y Point" $Bind $K "ShowNucRosace $K %x %y Motion" $Bind $K <2> "$K scan mark %x %y" $Bind $K "$K scan dragto %x %y" if {$PourGif } { return $LesOrdresPourGif } if { ! $PourGif } { set KanvaCourant $K set RosaceCourante $K lappend ParametresDuBoard(RosacesEnCours) $K lappend LesKanvasOuverts $K JeMeSignale "FinPatience" if {0 && [PourWscope] } { return $w } else { return $K } } } proc Scene {K Action Quoi} { global SceneMemo if { ! [info exists SceneMemo($K,font)]} { set SceneMemo($K,font) {{Courier 8} {Courier 10} {Courier 12}} } if { ! [info exists SceneMemo($K,fill)]} { set SceneMemo($K,fill) {black white} } if {$Action=="toggle"} { set Top [lindex [set SceneMemo($K,$Quoi)] 0] set SceneMemo($K,$Quoi) [lreplace [set SceneMemo($K,$Quoi)] 0 0] lappend SceneMemo($K,$Quoi) $Top set Nouveau [lindex [set SceneMemo($K,$Quoi)] 0] $K itemconfigure TEXTE -$Quoi $Nouveau } return $Nouveau }