proc Lego {FiPdb FiMod FiFa {FragSize ""} {FragNumber ""} {StackSize ""}} { if {$FragSize ==""} { set FragSize 5 } if {$FragNumber==""} { set FragNumber 20 } if {$StackSize !=""} { set Options "-g $StackSize" } exec /home/koehl/program/lego/Lego -i $FiPdb -o $FiMod -f $FiFa -s $FragSize -n $FragNumber $Options return $FiMod } proc FichierModAssocie {NomSeq3d FiMsf3d} { set Rep [file dirname $FiMsf3d] set FichierMod "$Rep/$NomSeq3d/${NomSeq3d}_20.mod" if {[file exists $FichierMod]} { return $FichierMod } Wup "the Lego mod file doesn't exist. We'll create it" set RepForSeq "$Rep/$NomSeq3d" set FiPdb "$RepForSeq/${NomSeq3d}.pdb" set FiMod "$RepForSeq/${NomSeq3d}_20.mod" set FiFa "$RepForSeq/${NomSeq3d}.fa" Lego FiPdb FiMod FiFa if {[file exists $FiMod]} { return $FiMod } FaireLire "I can't create the .mod file for \n$NomSeq3d $FiMsf3d" return "" } proc MsfAAFromMsf3d {FiMsf3d FiMsfAA} { set NombreDeSequences [DecortiqueUnMSF $MSF3d LesSeq3d TabSeq3d] set LeTfasAA {} foreach NomSeq3d $LesSeq3d { set FiMod [FichierModAssocie $NomSeq3d $FiMsf3d] if {$FiMod==""} { continue } ScanLaListe [Seq3dAndA5From $FiMod] Seq3d LesA5 set GappedSeq3d [set TabSeq3d($NomSeq3d)] set GappedSeqAA [GappedSeqAAFromGappedSeq3d $GappedSeq3d $LesA5 $Seq3d] regsub -all -nocase {[^a-z]} $GappedSeqAA "-" GappedSeqAA lappend LeTfasAA [SequenceFormatTFA $GappedSeqAA $NomSeq3d "protbrut"] } return [CreeLeMSFDuTFAs [join $LeTfasAA "\n"] $FiMsfAA] } proc TestLego {} { ScanLaListe [Seq3dAndA5From 1oxa_20.mod] Seq3d LesA5 Espionne "$Seq3d \n$LesA5" set GappedSeq3d [Entre $Seq3d] set GappedSeqAA [GappedSeqAAFromGappedSeq3d $GappedSeq3d $LesA5 $Seq3d] Espionne $GappedSeq3d Espionne $GappedSeqAA exit } proc GappedSeqAAFromGappedSeq3d {GappedSeq3d FichierOuListeA5 {Seq3d ""}} { if {[llength $FichierOuListeA5]==1} { ScanLaListe [Seq3dAndA5From $Fichier$FichierOuListeA5] Seq3d LesA5 } else { set LesA5 $FichierOuListeA5 } set i 0 set GappedSeqAA "" foreach G [split $GappedSeq3d ""] { if {[regexp -nocase {[a-z]} $G]} { set A5 [lindex $LesA5 $i] set AA [string range $A5 0 1] if {$Seq3d!=""} { set D [string index $Seq3d $i] if { ! [string equal -nocase $G $D]} { FaireLire "Problem in GappedSeqAAFromGappedSeq3d\n $G should be $D" } } incr i } else { set AA "$G$G" } append GappedSeqAA $AA } return $GappedSeqAA } proc Seq3dAndA5From Fichier { set Alphabet3d "?ARNDCQEGHILKMFPSTWYV" set LesAAs {} set LesRangs {} foreach Ligne [LesLignesDuFichier $Fichier] { if {[regexp "^SEQRES " $Ligne]} { regsub "SEQRES " $Ligne "" Texte LConcat LesAAs [LesMotsDeLaLigne $Texte] } if {[regexp "^SEQWRD " $Ligne]} { regsub "SEQWRD " $Ligne "" Texte LConcat LesRangs [LesMotsDeLaLigne $Texte] } } set SeqAA "" foreach AA $LesAAs { if {[string length $AA]==3} { set AA [UT $AA] } append SeqAA $AA } set Seq3d "" foreach R $LesRangs { if {[regexp {^[0-9]+$} $R]} { set R [string index $Alphabet3d $R] } append Seq3d $R } set iAA 0 foreach D [split $Seq3d ""] { set A5 [string range $SeqAA $iAA [expr $iAA+4]] incr iAA 2 lappend LesA5 $A5 } return [list $Seq3d $LesA5] exit }