[BioRuby-cvs] bioruby/lib/bio/appl/blat report.rb,1.10,1.11

Naohisa Goto ngoto at dev.open-bio.org
Wed Jun 28 13:43:33 UTC 2006


Update of /home/repository/bioruby/bioruby/lib/bio/appl/blat
In directory dev.open-bio.org:/tmp/cvs-serv13692/lib/bio/appl/blat

Modified Files:
	report.rb 
Log Message:
* Fixed a bug in Bio::Blat::Report::Hit#protein?.
* Fixed: when protein query and nucleotide database, HSPs are incorrect.


Index: report.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blat/report.rb,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** report.rb	27 Jun 2006 15:17:07 -0000	1.10
--- report.rb	28 Jun 2006 13:43:31 -0000	1.11
***************
*** 140,149 ****
          # It is designed to be called internally from Bio::Blat::Report class.
          # Users shall not use it directly.
!         def initialize(query_len, strand,
!                        blksize, qstart, tstart, qseq, tseq)
            @blocksize  = blksize
            @qseq       = qseq
            @hseq       = hseq
            @hit_strand   = 'plus'
            case strand
            when '-'
--- 140,151 ----
          # It is designed to be called internally from Bio::Blat::Report class.
          # Users shall not use it directly.
!         def initialize(query_len, target_len, strand,
!                        blksize, qstart, tstart, qseq, tseq,
!                        protein_flag)
            @blocksize  = blksize
            @qseq       = qseq
            @hseq       = hseq
            @hit_strand   = 'plus'
+           w = (protein_flag ? 3 : 1) # 3 means query=protein target=dna
            case strand
            when '-'
***************
*** 156,161 ****
              # we add 1 to each position number.
              @hit_from   = tstart + 1
!             @hit_to     = tstart + blksize # - 1 + 1
!           else #when '+'
              @query_strand = 'plus'
              # To keep compatibility with other homology search programs,
--- 158,174 ----
              # we add 1 to each position number.
              @hit_from   = tstart + 1
!             @hit_to     = tstart + blksize * w # - 1 + 1
!           when '+-'
!             # hit is minus strand
!             @query_strand = 'plus'
!             @hit_strand = 'minus'
!             # To keep compatibility, with other homology search programs,
!             # we add 1 to each position number.
!             @query_from   = qstart + 1
!             @query_to     = qstart + blksize # - 1 + 1
!             # convert positions
!             @hit_from     = target_len - tstart
!             @hit_to       = target_len - tstart - blksize * w + 1
!           else #when '+', '++'
              @query_strand = 'plus'
              # To keep compatibility with other homology search programs,
***************
*** 164,168 ****
              @query_to   = qstart + blksize # - 1 + 1
              @hit_from   = tstart + 1
!             @hit_to     = tstart + blksize # - 1 + 1
            end
          end
--- 177,181 ----
              @query_to   = qstart + blksize # - 1 + 1
              @hit_from   = tstart + 1
!             @hit_to     = tstart + blksize * w # - 1 + 1
            end
          end
***************
*** 298,304 ****
              qseqs = query.seqs
              tseqs = target.seqs
              @blocks = (0...block_count).collect do |i|
!               SegmentPair.new(query.size, strand, bs[i],
!                               qst[i], tst[i], qseqs[i], tseqs[i])
              end
            end
--- 311,319 ----
              qseqs = query.seqs
              tseqs = target.seqs
+             pflag = self.protein?
              @blocks = (0...block_count).collect do |i|
!               SegmentPair.new(query.size, target.size, strand, bs[i],
!                               qst[i], tst[i], qseqs[i], tseqs[i],
!                               pflag)
              end
            end
***************
*** 374,380 ****
          # The algorithm is taken from the BLAT FAQ
          # (http://genome.ucsc.edu/FAQ/FAQblat#blat4).
          def protein?
            return nil if self.block_sizes.empty?
!           case self.strand
            when '+'
              if self.target.end == self.target.starts[-1] +
--- 389,398 ----
          # The algorithm is taken from the BLAT FAQ
          # (http://genome.ucsc.edu/FAQ/FAQblat#blat4).
+         #
+         # Note: It seems that it returns true only when protein query
+         # with nucleotide database (blat options: -q=prot -t=dnax).
          def protein?
            return nil if self.block_sizes.empty?
!           case self.strand[1,1]
            when '+'
              if self.target.end == self.target.starts[-1] +
***************
*** 386,390 ****
            when '-'
              if self.target.start == self.target.size -
!                 self.target.starts[-1] + 3 * self.block_sizes[-1] then
                true
              else
--- 404,408 ----
            when '-'
              if self.target.start == self.target.size -
!                 self.target.starts[-1] - 3 * self.block_sizes[-1] then
                true
              else




More information about the bioruby-cvs mailing list