snittype for getting informations for LocusLink-IDs. Currently you ust download the files from: ftp://ftp.ncbi.nih.gov/refseq/LocusLink/. We assume that you download: ftp://ftp.ncbi.nih.gov/refseq/LocusLink/LL.out_hs.gz nad for GeneOntology mappings: ftp://ftp.ncbi.nih.gov/refseq/LocusLink/loc2go. Downloading may be done via http::geturl directly from the package. # Author : Dr. Detlef Groth, MPIMG Berlin # Created By : Dr. Detlef Groth # Created : Fri Feb 18 13:06:07 2005 # Last Modified : <050221.0622> # # Description : snittype for getting informations for LocusLink-IDs. # package require snit 0.97 package require oomk snit::type LocusLinkFile { option -filename "" option -mkfile "" option -gofile "" variable db variable dbgo variable pvLocusLink constructor {args} { $self configurelist $args if {$options(-mkfile) eq ""} { set options(-mkfile) $options(-filename).mk } if {$options(-gofile) eq ""} { set options(-gofile) [file join [file dirname $options(-filename)] LOC2GO] } set db [mkstorage %AUTO% $options(-mkfile)] if {[file size $options(-mkfile)] < 2} { $self CreateMkDB } else { [$db view locuslink] as pvLocusLink } if {[file exists $options(-gofile)] && (![file exists $options(-gofile).mk] || [file size $options(-gofile).mk] < 2)} { set dbgo [mkstorage %AUTO% $options(-gofile).mk] $self CreateGoDB } }; destructor { $db close catch {$dbgo close} } method CreateGoDB {} { if [catch {open $options(-gofile) r} infh] { puts stderr "Cannot open $options(-gofile): $infh" return 0 } else { $dbgo layout goinfo {id:I go quality} [$dbgo view goinfo] as pvGO set x 0 set prog [Progress %AUTO% -file $options(-gofile)] puts stderr "Converting $options(-gofile)" while {[gets $infh line] >= 0} { set F [split $line \t] if {[expr $x % 1000] == 0} { $prog progress [tell $infh] } $pvGO append id [lindex $F 0] go [lindex $F 1] quality [lindex $F 2] } close $infh $dbgo commit } } method CreateMkDB {} { if [catch {open $options(-filename) r} infh] { puts stderr "Cannot open $options(-filename): $infh" return 0 } else { $db layout locuslink {id symbol chr chrpos descr} [$db view locuslink] as pvLocusLink set prog [Progress %AUTO% -file $options(-filename)] set x 0 while {[gets $infh line] >= 0} { set F [split $line \t] if {[expr $x % 100] == 0} { $prog progress [tell $infh] } $pvLocusLink append id [lindex $F 0] symbol [lindex $F 1] chr [lindex $F 4] \ chrpos [lindex $F 5] descr [lindex $F 6] } close $infh $db commit #$db close } }; method getInfo {key val args} { regsub -- {-} $key "" colkey #puts "colkey $colkey val $val" set arg(-mode) exact array set arg $args [$pvLocusLink select -$arg(-mode) $colkey $val] as pSel set res [list] if {[$pSel size] > 0} { $pSel loop c { lappend res [array get c] } } return $res }; method getGos {key val} { } } proc test {} { source [file join [file dirname [info script]] Progress.tcl] set file LL.out_hs set sf [LocusLinkFile %AUTO% -filename e:/links//project/goblet/data/LocusLink/$file] puts [$sf getInfo -id 1] puts [$sf getInfo -symbol AANAT] puts [$sf getInfo -chrpos 2q31] puts [llength [$sf getInfo -chr X]] puts [$sf getInfo -descr "interleukin*receptor*" -mode glob] }