can't read "argv": no such variable
while executing
"Split $argv"
(in namespace eval "::request" script line 86)
invoked from within
"namespace eval ::request $script"
("::try" body line 12)
OUTPUT BUFFER:
#!/usr/local/bin/tclsh
#package require profile
### Name ......: splitter
### Version ...: 1.0
### Date ......: 07-Mars-2005
### Purpose ...: split a multiple sequence TFA file into individual
# files with file-name = seq-name
#
# Le debut d'une grande serie ??
proc ContenuDuFichier {{Fichier ""}} {
if { $Fichier == "" } {return ""}
set f [open $Fichier r]
set Texte [read -nonewline $f]
close $f
return $Texte
}
proc LesLignesDuFichier {{Fichier ""}} {
return [split [ContenuDuFichier $Fichier] "\n"]
}
proc ValArg {e} {
set e [string trim $e]
set i [expr [string first "=" $e] + 1]
return [string trim [string range $e $i end]]
}
proc Split {vals} {
set args [string trim $vals]
regsub -all " " $args " " args
set args [split $args " "]
if {[llength $args] < 1} {
puts "\nUsage : splitter"
puts "\t-input= compulsory (fasta format)"
puts "\t-prefix= optional"
puts "\n"
return 0
}
set Prefix ""
foreach e $args {
if {[regexp {\-input} $e]} {set file [ValArg $e]}
if {[regexp {\-prefix} $e]} {set Prefix [ValArg $e]}
}
set Ll [LesLignesDuFichier $file]
set YaPrefix 0
if {[expr ![string equal $Prefix ""]]} {
set i 0
set ns [llength [lsearch -regexp -all $Ll ">"]]
set nc [string length $ns]
set fmt "%0${nc}d"
set YaPrefix 1
set Prefix [string toupper $Prefix]
}
foreach l $Ll {
if {[regexp {^>} $l]} {
if {[info exists of]} {close $of}
if {$YaPrefix} {
set lefic "$Prefix[format $fmt $i]"
incr i
} else {
set ib [string first " " $l]
if {$ib == -1} {
set ib end
} else {
set ib [expr $ib - 1]
}
set lefic [string range $l 1 $ib]
}
set of [open $lefic w]
}
puts $of $l
}
return
}
Split $argv
exit 0