Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit c459a8f1 authored by luc.moulinier's avatar luc.moulinier
Browse files

bugs ...

parent b8e21ba1
......@@ -8248,7 +8248,7 @@ proc AfficheFrameSequences {} {
label $w.lessequences.fpos.vposg \
-textvariable XGen \
-relief flat \
-width 4 \
-width 5 \
-anchor w
label $w.lessequences.fpos.tposs \
-text " seq " \
......@@ -8258,7 +8258,7 @@ proc AfficheFrameSequences {} {
label $w.lessequences.fpos.vposs \
-textvariable XSeq \
-relief flat \
-width 4 \
-width 5 \
-anchor w
grid $w.lessequences.fpos.tposg -row 0 -column 0 -sticky w
grid $w.lessequences.fpos.vposg -row 0 -column 1 -sticky w
......
......@@ -10182,6 +10182,7 @@ proc tdbt {} {
$db eval {attach database curr.sql as cur}
}
proc tlmp1 {l} {
set i -1
set res [lmap x $l {
......@@ -13392,12 +13393,75 @@ proc KirsleyData {data} {
}
if {0} {
the $k$ parameter is set by the biologist and depends upon the purpose of the computation. When selecting leaves to create a multiple sequence alignment $k$ will typically be in the range 50 < $k$ < 500.
proc tmem {} {
cd /commun/bics/IDMapping/update
set o [open idmapping.dat r]
fconfigure $o -buffersize 100000000
set t1 [time {
set l [read -nonewline $o]
}]
puts $t1
close $o
exit
}
proc nico_img {args} {
LoadTkAndPackages
#package require Img
set rep /home/scalzitti/test/paper_3/Resultats/Figures/bbs/
set Limg [lsort -dictionary [glob $rep/*_nuc.png]]
puts "imgs [llength $Limg]"
# calcule taille canvas
set img [image create photo -file [lindex $Limg 0]]
#set ihgt [$img cget -height]
set ihgt [image height $img]
#set iwdt [$img cget -width]
set iwdt [image width $img]
set wdt [expr {4 * $iwdt + 3*10}]
set hgt [expr {5 * $ihgt + 4*10}]
image delete $img
puts "img $iwdt $ihgt"
puts "can $wdt $hgt"
toplevel .t
canvas .t.c \
-width 200 \
-height 200 \
-scrollregion [list 0 0 $wdt $hgt]
grid .t.c -row 0 -column 0 -sticky news
frame .t.f -background black
grid .t.f -row 1 -column 0 -sticky news
button .t.f.print \
-text " Print " \
-background green1 \
-command [list PrintCanvas .t.c png toto.png]
grid .t.f.print -row 0 -column 0
set y 0
set iImg 0
for {set j 0} {$j < 5} {incr j} {
# remplit ligne
set x 0
for {set i 0} {$i < 4} {incr i} {
set img [image create photo -file [lindex $Limg $iImg]]
incr iImg
.t.c create image $x $y -image $img
incr x [expr {$iwdt + 10}]
}
incr y [expr {$ihgt + 10}]
}
raise .t
update idletasks
return
}
......@@ -351,6 +351,7 @@ proc SauveLAlignement {{SauveEn ""} {Out ""}} {
$::db eval {vacuum}
$::db backup $Defauts(FichierOBK)
FaireLaSuite
return
}
}
......@@ -382,6 +383,10 @@ proc SauveLAlignement {{SauveEn ""} {Out ""}} {
} elseif {$Out ne "JLeSauveAs" && $Out ne ""} {
set AliFilOut $Out
}
if { 0 && ! [file is writable $out] } {
FaireLire "Warning !\nThe file named :\n>$AliFilOut<\ncan not be saved ! Please check location or file permissions."
return
}
switch $OutputFormat {
"FenetreMSF" {CreeLAlignementDeLaFenetre $AliFileOut}
......
#
#
##
# ordali_service.tcl
#
......@@ -169,7 +170,6 @@ proc InfosFromRefSeq {Lid} {
if {$Lid == {} } {return {} }
set Lxml [eFetchREST protein $Lid tiny]
#lulu
if {$Lxml eq ""} {
# nothin found
return 0
......@@ -686,53 +686,75 @@ proc IDMapping_help {{args ""}} {
}
proc CheckIDMappingInputParam {argv} {
if {[llength $argv] < 3} {
IDMapping_help
proc idmHome {} {
if {[info exists ::env(IDMAPPING_HOME)]} {
set idmHome $::env(IDMAPPING_HOME)
} else {
set idmHome [IDMappingDir]
}
# parse arguments
lassign $argv from to Lids taxid
return $idmHome
}
if {$taxid ne ""} {
if {! [string is integer -strict $taxid]} {
puts "taxID should be an integer !"
exit
}
} else {
set taxid ""
}
if {$from ni {ACC ID ACC+ID} && $to ni {ACC ID}} {
proc IDMappingDir {} {
return "/commun/bics/IDMapping/production/"
}
proc CheckIDMappingInputParam {args} {
# This proc is called when doing external call
# to IDMapping (setidmapping)
if {[llength $args] < 3} {
IDMapping_help
}
# parse arguments
lassign $args from to Lids taxid
if {$taxid != "" && ! [string is integer $taxid]} {
puts "\nError !\n\ttaxID should be an integer !\n"
exit
}
set from [string toupper $from]
set to [string toupper $to]
set LidmDBs [lsort [LesLignesDuFichier [file join [IDMappingDir] id_dbs.txt]]]
lappend LidmDBs "ACC+ID" ACC
if {$from ni $LidmDBs || $to ni $LidmDBs} {
puts "\nError :\nBad <FROM_db> and/or <TO_db> names !"
IDMapping_help
}
set Lids [string toupper $Lids]
if {[string first "," $Lids] != -1} {
set Lids [split $Lids ,]
#
# 1) check Aceessions data ...
if {[file exists $Lids]} {
set Ltmp [LesLignesDuFichier $Lids]
set Lids {}
foreach l $Ltmp {
if {[string trim $l] eq ""} {continue}
set l [string toupper $l]
if {[regexp {\,| |\;|\|} $l]} {
set l [split $l " ,;|"]
}
lappend Lids {*}$l
}
} else {
# ids are not in a file
set Lids [string toupper $Lids]
if {[regexp { |\,|\;|\|} $Lids]} {
set Lids [split $Lids " ,;|"]
}
}
#puts ">$from< >$to< >$Lids< >$taxid<"
if {$from in {ACC ID ACC+ID} && $to in {ACC ID}} {
if {$from eq "ID"} {
set from UNIPROTKB_ID
} elseif {$to eq "ID"} {
set to UNIPROTKB_ID
} else {
puts "Error :"
exit
}
return [list $from $to $Lids]
}
set Lsql [glob "*.sql"]
set isFrom [lsearch -inline -nocase $Lsql "$from.sql"]
set isTo [lsearch -inline -nocase $Lsql "$to.sql"]
if {$isFrom eq ""} {
set to [string range $isTo 0 end-4]
} elseif {$isTo eq ""} {
set from [string range $isFrom 0 end-4]
return [list $from $to $Lids $taxid]
}
if {$from in {"GENE_NAME" "GENE_SYNONYM"} && $taxid ne ""} {
......@@ -747,22 +769,29 @@ proc DbIDMappingSQL {bank what} {
switch $what {
"open" {
set db $bank
set fdb [file join /genomics link idmapping SQLDBS $bank.sql]
Espionne $fdb
sqlite3 $db $fdb
set fdb [file join [idmHome] SQLDBS $bank.sql]
#Espionne $fdb
sqlite3 $db $fdb -readonly 1
$db eval "PRAGMA journal_mode = OFF"
$db eval "PRAGMA synchronous = OFF"
#puts [$db eval {analyze}]
}
"close" {
$db close
}
}
return $db
}
proc IDMapping_sql {from to Lids {taxid ""}} {
set Lacc [list]
set Acc2Id 0
set Lacc {}
if {$from ni {ACC ID ACC+ID} && $to ni {ACC ID}} {
set jointure 1
} else {
set jointure 0
}
switch $from {
"ACC" {
set source acc
......@@ -776,6 +805,7 @@ proc IDMapping_sql {from to Lids {taxid ""}} {
set bank $to
set target id
# get everything as an ACC
set db [DbIDMappingSQL UNIPROTKB_ID open]
set Laccid [$db eval "select acc,id from UNIPROTKB_ID where id in ('[join $Lids ',']') OR acc in ('[join $Lids ',']')"]
$db close
......@@ -785,13 +815,12 @@ proc IDMapping_sql {from to Lids {taxid ""}} {
set t($i) $a
}
# IDs not in database
set Lout [lor $Laccid $Lids]
if {$Lout != {} } {
foreach elt $Lout {
set t($elt) $elt
}
set Lout [lor $Laccid $Lids from2]
foreach elt $Lout {
set t($elt) $elt
}
set Lacc {}
foreach a $Lids {
lappend Lacc $t($a)
}
......@@ -802,25 +831,121 @@ proc IDMapping_sql {from to Lids {taxid ""}} {
set bank $from
set target acc
set Lacc $Lids
switch $to {
"ACC" {set ACC2Id 0}
"ID" {set Acc2Id 1}
}
}
}
if {! $jointure} {
set db [DbIDMappingSQL $bank open]
if {$taxid eq ""} {
set cmd "select $source,$target from $bank where $source in ('[join $Lacc ',']')"
} else {
set fdb [file join [idmHome] SQLDBS NCBI_TAXID.sql]
$db eval {attach database $fdb as NCBI_TAXID}
set cmd "select db1.$source,db1.$target from $bank as db1, NCBI_TAXID as db2 where db1.$source in ('[join $Lacc ',']') and db2.id='$taxid' and db1.acc = db2.acc"
}
} else {
set db [DbIDMappingSQL $from open]
set fdb [file join [idmHome] SQLDBS ${to}.sql]
$db eval {attach database $fdb as $to}
if {$taxid ne ""} {
set fdb [file join [idmHome] SQLDBS NCBI_TAXID.sql]
$db eval {attach database $fdb as NCBI_TAXID}
set cmd "select db1.id, db2.id from $from as db1, $to as db2, NCBI_TAXID as db3 where db1.id in ('[join $Lacc ',']') and db3.id = '$taxid' and db1.acc = db2.acc and db3.acc = db2.acc"
} else {
set cmd "select db1.id, db2.id from $from as db1, $to as db2 where db1.id in ('[join $Lacc ',']') and db1.acc = db2.acc"
}
}
#puts "cmd= $cmd\n"
set Lout [$db eval $cmd]
$db close
foreach {in out} $Lout {
lappend t($in) $out
}
set Lres {}
foreach a $Lacc {
if {[info exists t($a)]} {
lappend Lres $t($a)
} else {
lappend Lres ""
}
}
#lulu
puts "[join $Lres \n]"
exit
return $Lres
}
proc IDMapping_sql_OLD {from to Lids {taxid ""}} {
set Lacc {}
set Acc2Id 0
switch $from {
"ACC" {
set source acc
set bank $to
set target id
set Lacc $Lids
}
"ID" -
"ACC+ID" {
set source acc
set bank $to
set target id
# get everything as an ACC
set db [DbIDMappingSQL UNIPROTKB_ID open]
set Laccid [$db eval "select acc,id from UNIPROTKB_ID where id in ('[join $Lids ',']') OR acc in ('[join $Lids ',']')"]
$db close
foreach {a i} $Laccid {
set t($a) $a
set t($i) $a
}
# IDs not in database
set Lout [lor $Laccid $Lids from2]
foreach elt $Lout {
set t($elt) $elt
}
set Lacc {}
foreach a $Lids {
lappend Lacc $t($a)
}
unset -nocomplain t
}
default {
set source id
set bank $from
set target acc
set Lacc $Lids
}
}
switch $to {
"ACC" {set Acc2Id 0}
"ID" {set Acc2Id 1}
}
set db [DbIDMappingSQL $bank open]
set cmd "select $target,$source from $bank where $source in ('[join $Lacc ',']')"
set Lout [$db eval $cmd]
$db close
foreach {target source} $Lout {
lappend t($source) $target
}
foreach a [array names t] {
if {$t($a) ne ""} {
puts "t($a) = $t($a)"
}
}
if {$from in {"GENE_NAME" "GENE_SYNONYM"} && $taxid ne ""} {
set db [DbIDMappingSQL NCBI_TAXID open]
foreach a [array names t] {
set cmd "select acc from NCBI_TAXID where acc in ('[join $t($a) ',']') and id = $taxid"
set cmd "select acc from NCBI_TAXID where acc in ('[join $t($a) ',']') and id = '$taxid'"
set Ltid [$db eval $cmd]
set t($a) $Ltid
}
......@@ -838,16 +963,21 @@ proc IDMapping_sql {from to Lids {taxid ""}} {
}
}
} else {
set lres [list]
# ! Acc2Id
set Lres {}
foreach a [array names t] {
lappend Lres [lsort -unique $t($a)]
}
foreach a $Lacc {
if {[info exists t($a)]} {
lappend Lres $t($a)
#lappend Lres $t($a)
} else {
lappend Lres ""
#lappend Lres ""
}
}
}
puts "\nLres $Lres"
return $Lres
}
......@@ -903,7 +1033,6 @@ proc IDMapping_sql_old {from to LId {orga ""}} {
}
}
set query "select $target from idmapping where $source in ('[join $Lacc ',']')"
#puts "query : $query"
set Lout [$db eval $query]
} else {
# to = ACC or ID
......@@ -974,7 +1103,6 @@ proc IDMapping_web {from to LId {orga ""}} {
# Bunches of 200 queries
set url "https://www.uniprot.org/mapping/"
#set url "https://www.uniprot.org/uploadlists/"
set Lres [list]
set paquets 200
set ni [expr {int([llength $LId]/$paquets)+1}]
......@@ -988,7 +1116,9 @@ proc IDMapping_web {from to LId {orga ""}} {
query "[join [lrange $LId $d $f] ,]"
]
set rep [HttpCopy $url "" $query]
#set rep [HttpCopy $url "" $query]
package require TclCurl
curl::transfer -url "$url?$query" -bodyvar rep
if {! [regexp {^yourlist} $rep]} {
#puts "ERROR in IDMapping :"
......@@ -3674,3 +3804,90 @@ proc tp {} {
}
proc tjson {} {
package require TclCurl
set url "https://rest.ensembl.org/lookup/id/ENSG00000157764?content-type=application/json;expand=1"
#curl::transfer -url $url -bodyvar json
set json [ContenuDuFichier exa.json]
set json [encoding convertfrom utf-8 $json]
puts "length0 [llength $json]"
puts "$json"
package require json 1.3.3
set tout [::json::json2dict $json]
source /home/moumou/json-procs.tcl
set fout [::util::json::parse $json]
if {$tout == $fout} {
puts "ok"
exit
}
puts "\ntout\n$tout\n"
puts "len = [llength $tout]"
puts "keys : [llength [dict keys $tout]] | [dict keys $tout]"
puts "\ndict infos :\n[dict info $tout]"
foreach {k v} $tout {
puts "k= [llength $k] $k v= [llength $v] $v"
while {[llength $v] > 1} {
set vin $v
foreach {k v} $vin {
puts "\tk= $k | v= $v"
}
}
}
return
}
proc tatta {} {
package require sqlite3
set db root
set rep /commun/bics/IDMapping/production/SQLDBS
sqlite3 $db "$rep/GENE_NAME.sql" -readonly 1
set dpdb "$rep/PDB.sql"
set dbtax "$rep/NCBI_TAXID.sql"
$db eval {attach database $dpdb as PDB}
$db eval {attach $dbtax as NCBI_TAXID}
set Lids {ASPS PHES WXY}
set out [$db eval "select db1.id, db2.id from GENE_NAME as db1, PDB as db2, NCBI_TAXID as db3 where \
db1.id in ('[join $Lids ',']') and \
db3.id = '83333' and \
db1.acc = db2.acc and \
db3.acc = db1.acc"]
foreach {i a} $out {
lappend t($i) $a
}
foreach i $Lids {
if {[info exists t($i)]} {
puts $t($i)
} else {
puts ""
}
}
exit
}
# changer HttpCopy par
# curl::transfer -nobody 1 -header 1 -headervar head_var -url $url
......@@ -11,6 +11,13 @@ proc CreeLeMacsim {{out "dehors"} {LNoms ""} {LSeqs ""}} {
global TColScore
global {*}[info globals "TD*"]
# First, check if file is writable
if {0 && ! [file is writable $out]} {
FaireLire "Warning !\nThe file named :\n>$out<\ncan not be written ! Check location or rights permission."
return
}
dom createDocument "macsim" doc
# Cre les commandes de creation de noeuds
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment