Commit df2b88d0 authored by luc.moulinier's avatar luc.moulinier

idmapping_sql OK !

parent 80a47313
......@@ -701,6 +701,16 @@ proc IDMappingDir {} {
return "/commun/bics/IDMapping/production/"
}
proc ListOfAllIDMappingBanks {} {
if {! [info exists ::ListAllIDMappingBanks]} {
set ::ListAllIDMappingBanks [lsort [LesLignesDuFichier [file join [IDMappingDir] id_dbs.txt]]]
}
return $::ListAllIDMappingBanks
}
proc CheckIDMappingInputParam {args} {
# This proc is called when doing external call
# to IDMapping (setidmapping)
......@@ -717,7 +727,7 @@ proc CheckIDMappingInputParam {args} {
set from [string toupper $from]
set to [string toupper $to]
set LidmDBs [lsort [LesLignesDuFichier [file join [IDMappingDir] id_dbs.txt]]]
set LidmDBs [ListOfAllIDMappingBanks]
lappend LidmDBs "ACC+ID" ACC ID
if {$from ni $LidmDBs || $to ni $LidmDBs} {
puts "\nError :\nBad <FROM_db> and/or <TO_db> names !"
......@@ -745,23 +755,8 @@ proc CheckIDMappingInputParam {args} {
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
}
return [list $from $to $Lids $taxid]
}
if {$from in {"GENE_NAME" "GENE_SYNONYM"} && $taxid ne ""} {
return [list $from $to $Lids $taxid]
} else {
return [list $from $to $Lids]
}
return [list $from $to $Lids $taxid]
}
......@@ -785,13 +780,9 @@ proc DbIDMappingSQL {bank what} {
proc IDMapping_sql {from to Lids {taxid ""}} {
lassign [CheckIDMappingInputParam $from $to $Lids $taxid] from to Lids taxid
set Lacc {}
if {$from eq $to} {
puts ">$from> == <$to> !!"
IDMapping_Help
return
}
if {$from ni {ACC ID ACC+ID} && $to ni {ACC ID}} {
set jointure 1
......@@ -809,7 +800,7 @@ proc IDMapping_sql {from to Lids {taxid ""}} {
"ID" -
"ACC+ID" {
set source acc
if {$to eq "ACC"} {
if {0 && $to eq "ACC"} {
set bank ""
} else {
set bank $to
......@@ -850,6 +841,14 @@ proc IDMapping_sql {from to Lids {taxid ""}} {
return $Lacc
}
if {$to eq "ACC"} {
set target acc
}
if {$to eq "ID" || $to eq "ACC"} {
set bank UNIPROTKB_ID
}
if {! $jointure} {
set db [DbIDMappingSQL $bank open]
if {$taxid eq ""} {
......@@ -872,7 +871,7 @@ proc IDMapping_sql {from to Lids {taxid ""}} {
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
......@@ -889,9 +888,6 @@ proc IDMapping_sql {from to Lids {taxid ""}} {
}
}
#lulu
puts "[join $Lres \n]"
exit
return $Lres
}
......
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