Class Bio::PAML::Codeml::PositiveSites
In: lib/bio/appl/paml/codeml/report.rb
Parent: Array

List for the positive selection sites. PAML returns:

Naive Empirical Bayes (NEB) analysis Positively selected sites (*: P>95%; **: P>99%) (amino acids refer to 1st sequence: PITG_23265T0)

            Pr(w>1)     post mean +- SE for w

    17 I      0.988*        3.293
    18 H      1.000**       17.975
    23 F      0.991**       6.283

(…)

   131 V      1.000**       22.797
   132 R      1.000**       10.800

(newline)

these can be accessed using normal iterators. Also special methods are available for presenting this data

Methods

graph   graph_omega   graph_seq   graph_to_s   new   to_s  

Attributes

descr  [R] 

Public Class methods

[Source]

     # File lib/bio/appl/paml/codeml/report.rb, line 537
537:       def initialize search, buf, num_codons
538:         @num_codons = num_codons
539:         if buf.index(search)==nil
540:           raise ReportError,"No NB sites found for #{search}" 
541:         end
542:         # Set description of this class
543:         @descr = search
544:         lines = buf.split("\n")
545:         # find location of 'search'
546:         start = 0
547:         lines.each_with_index do | line, i |
548:           if line.index(search) != nil
549:             start = i
550:             break
551:           end
552:         end
553:         raise ReportError,"Out of bound error for <#{buf}>" if lines[start+6]==nil
554:         lines[start+6..-1].each do | line |
555:           break if line.strip == ""
556:           fields = line.split
557:           push PositiveSite.new(fields)
558:         end
559:         num = size()
560:         @buf = lines[start..start+num+7].join("\n")
561:       end

Public Instance methods

Generate a graph - which is a simple string pointing out the positions showing evidence of positive selection pressure.

  >> c.sites.graph[0..32]
  => "                **    *       * *"

[Source]

     # File lib/bio/appl/paml/codeml/report.rb, line 569
569:       def graph
570:         graph_to_s(lambda { |site| "*" })
571:       end

Generate a graph - which is a simple string pointing out the positions showing evidence of positive selection pressure, with dN/dS values (high values are an asterisk *)

  >> c.sites.graph_omega[0..32]
  => "                24    3       3 2"

[Source]

     # File lib/bio/appl/paml/codeml/report.rb, line 580
580:       def graph_omega
581:         graph_to_s(lambda { |site| 
582:             symbol = "*"
583:             symbol = site.omega.to_i.to_s if site.omega.abs <= 10.0
584:             symbol
585:         })
586:       end

Graph of amino acids of first sequence at locations

[Source]

     # File lib/bio/appl/paml/codeml/report.rb, line 589
589:       def graph_seq
590:         graph_to_s(lambda { |site |
591:           symbol = site.aaref
592:         })
593:       end

:nodoc: Creates a graph of sites, adjusting for gaps. This generator is also called from HtmlPositiveSites. The fill is used to fill out the gaps

[Source]

     # File lib/bio/appl/paml/codeml/report.rb, line 604
604:       def graph_to_s func, fill=' '
605:         ret = ""
606:         pos = 0
607:         each do | site |
608:           symbol = func.call(site)
609:           gapsize = site.position-pos-1
610:           ret += fill*gapsize + symbol
611:           pos = site.position
612:         end
613:         gapsize = @num_codons - pos - 1
614:         ret += fill*gapsize if gapsize > 0
615:         ret
616:       end

Return the positive selection information as a String

[Source]

     # File lib/bio/appl/paml/codeml/report.rb, line 596
596:       def to_s
597:         @buf
598:       end

[Validate]