Class: Bioworks::Prot
- Inherits:
-
Object
- Object
- Bioworks::Prot
- Includes:
- XML, SpecID::Prot
- Defined in:
- lib/spec_id/bioworks.rb
Constant Summary collapse
- @@end_prot_re =
/<\/protein>/o
- @@pep_re =
/<peptide>/o
- @@atts =
%w(reference protein_probability consensus_score sf unified_score coverage pi weight accession peps)
Instance Attribute Summary collapse
-
#accession ⇒ Object
Returns the value of attribute accession.
-
#bioworks ⇒ Object
Returns the value of attribute bioworks.
-
#consensus_score ⇒ Object
Returns the value of attribute consensus_score.
-
#coverage ⇒ Object
Returns the value of attribute coverage.
-
#peps ⇒ Object
Returns the value of attribute peps.
-
#peptide_hit_counts ⇒ Object
Returns the value of attribute peptide_hit_counts.
-
#pi ⇒ Object
Returns the value of attribute pi.
-
#protein_probability ⇒ Object
Returns the value of attribute protein_probability.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#sf ⇒ Object
Returns the value of attribute sf.
-
#unified_score ⇒ Object
Returns the value of attribute unified_score.
-
#weight ⇒ Object
Returns the value of attribute weight.
Attributes included from SpecID::Prot
Instance Method Summary collapse
-
#get(*args) ⇒ Object
returns array of values of the attributes given (as symbols).
-
#initialize ⇒ Prot
constructor
A new instance of Prot.
-
#set_from_xml_hash(hash) ⇒ Object
changes the sf to Sf and pI to pi.
- #set_from_xml_hash_xmlparser(hash) ⇒ Object
- #set_from_xml_stream(fh, uniq_pephit_hash) ⇒ Object
Methods included from SpecID::Prot
Constructor Details
#initialize ⇒ Prot
Returns a new instance of Prot.
304 305 306 307 |
# File 'lib/spec_id/bioworks.rb', line 304 def initialize @peps = [] @peptide_hit_counts = [0,0,0,0,0,0] end |
Instance Attribute Details
#accession ⇒ Object
Returns the value of attribute accession.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def accession @accession end |
#bioworks ⇒ Object
Returns the value of attribute bioworks.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def bioworks @bioworks end |
#consensus_score ⇒ Object
Returns the value of attribute consensus_score.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def consensus_score @consensus_score end |
#coverage ⇒ Object
Returns the value of attribute coverage.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def coverage @coverage end |
#peps ⇒ Object
Returns the value of attribute peps.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def peps @peps end |
#peptide_hit_counts ⇒ Object
Returns the value of attribute peptide_hit_counts.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def peptide_hit_counts @peptide_hit_counts end |
#pi ⇒ Object
Returns the value of attribute pi.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def pi @pi end |
#protein_probability ⇒ Object
Returns the value of attribute protein_probability.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def protein_probability @protein_probability end |
#reference ⇒ Object
Returns the value of attribute reference.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def reference @reference end |
#sf ⇒ Object
Returns the value of attribute sf.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def sf @sf end |
#unified_score ⇒ Object
Returns the value of attribute unified_score.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def unified_score @unified_score end |
#weight ⇒ Object
Returns the value of attribute weight.
302 303 304 |
# File 'lib/spec_id/bioworks.rb', line 302 def weight @weight end |
Instance Method Details
#get(*args) ⇒ Object
returns array of values of the attributes given (as symbols)
311 312 313 314 315 |
# File 'lib/spec_id/bioworks.rb', line 311 def get(*args) args.collect do |arg| send(arg) end end |
#set_from_xml_hash(hash) ⇒ Object
changes the sf to Sf and pI to pi
364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/spec_id/bioworks.rb', line 364 def set_from_xml_hash(hash) @reference = hash["reference"] @protein_probability = hash["protein_probability"] @probability = @protein_probability.to_f @consensus_score = hash["consensus_score"] @sf = hash["Sf"] @unified_score = hash["unified_score"] @coverage = hash["coverage"] @pi = hash["pI"] @weight = hash["weight"] @accession = hash["accession"] end |
#set_from_xml_hash_xmlparser(hash) ⇒ Object
355 356 357 358 359 360 361 |
# File 'lib/spec_id/bioworks.rb', line 355 def set_from_xml_hash_xmlparser(hash) hash.delete("sequestresults") hash.delete("bioworksinfo") hash["sf"] = hash.delete("Sf") hash["pi"] = hash.delete("pI") set_from_hash(hash) end |
#set_from_xml_stream(fh, uniq_pephit_hash) ⇒ Object
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/spec_id/bioworks.rb', line 317 def set_from_xml_stream(fh, uniq_pephit_hash) hash = {} @peps = [] while line = fh.gets if line =~ @@att_re hash[$1] = $2 elsif line =~ @@pep_re ## Could do a look ahead to grab the file and sequence to check ## uniqueness to increase speed here. pep = Bioworks::Pep.new.set_from_xml_stream(fh) # normal search results files have a global filename # while multi-consensus do not pep[12] ||= bioworks.global_filename ## figure out uniqueness ky = [pep.base_name, pep.first_scan, pep.charge, pep.sequence] if uniq_pephit_hash.key? ky pep = uniq_pephit_hash[ky] else ## insert the new protein pep.prots = [] uniq_pephit_hash[ky] = pep end pep.prots << self @peps << pep elsif line =~ @@end_prot_re set_from_xml_hash(hash) break else puts "Bad parsing on: #{line}" puts "EXITING!" exit end end self end |