DR = "DR"
LAST = '//'
- def initialize file
- Util.check_file_for_readability file
- @file = file
+ def initialize
+
end
- def parse( ids )
- entries = Hash.new
+ def parse( lines )
de = []
dr = []
id = nil
- File.open( @file ).each do | line |
- if line.index( ID ) == 0
- # puts line
- ids.each do | i |
- #puts " " + i
- if line.include?( i ) && line.split[ 1 ] == i
- id = i
- break
- end
- end
- end
- if id != nil
+ lines.each do | line |
+
+ if line.include?( ID ) && line.index( ID ) == 0
+ id = line.split[ 1 ]
+ elsif id != nil
if line.include?( LAST ) && line.index( LAST ) == 0
e = UniprotEntry.new
+ e.id = id
e.de = de
e.dr = dr
- entries[ id ] = e
- puts id
- id = nil
- de = []
- dr = []
+ return e
else
if line.include?( DE ) && line.index( DE ) == 0
add( line, de )
end
end
end
- entries
+ return nil
end
private
attr_accessor :pe
attr_accessor :kw
+ def get_pdb_ids
+ ids = []
+ if dr != nil
+ dr.each do | dr |
+ if dr != nil
+ if dr =~ /PDB;\s+([A-Z0-9]{4});/
+ ids << $1
+ end
+ end
+ end
+ end
+ ids
+ end
+
+ def get_go_descriptions
+ gos = []
+ if dr != nil
+ dr.each do | dr |
+ if dr != nil
+ if dr =~ /GO;\s+GO:\d+(.+);\s+([^;]+)/
+ gos << $1
+ end
+ end
+ end
+ end
+ gos
+ end
+
+ def get_full_name
+ # DE RecName: Full=Apoptosis regulator Bcl-2;
+ end
+
+
+ def get_reactome_descriptions
+ s = []
+ if dr != nil
+ dr.each do | dr |
+ if dr != nil
+ if dr =~ /Reactome;\s+REACT_\d+;\s+([^.]+)/
+ s << $1
+ end
+ end
+ end
+ end
+ s
+ end
+
+
end
+
+
+
+
+
+
end # module Evoruby