Class: Bio::Spidey::Report::SegmentPair

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/appl/spidey/report.rb

Overview

Sequence segment pair of Spidey result. Similar to Bio::Blast::Report::Hsp but lacks many methods. For mRNA-genome mapping programs, unlike other homology search programs, the class is used not only for exons but also for introns. (Note that intron data would not be available according to run-time options of the program.)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(genomic, mrna, midline, aaseqline, percent_identity, mismatches, gaps, splice_site, align_len) ⇒ SegmentPair

Creates a new SegmentPair object. It is designed to be called from Bio::Spidey::Report::* classes. Users shall not call it directly.


125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/bio/appl/spidey/report.rb', line 125

def initialize(genomic, mrna, midline, aaseqline,
               percent_identity, mismatches, gaps, splice_site,
               align_len)
  @genomic   = genomic
  @mrna      = mrna
  @midline   = midline
  @aaseqline = aaseqline
  @percent_identity = percent_identity
  @mismaches        = mismatches
  @gaps             = gaps
  @splice_site      = splice_site
  @align_len        = align_len
end

Instance Attribute Details

#aaseqlineObject (readonly)

Returns amino acide sequence in alignment. Returns String, because white spaces is also important. Returns nil if no alignment data are available.


156
157
158
# File 'lib/bio/appl/spidey/report.rb', line 156

def aaseqline
  @aaseqline
end

#align_lenObject (readonly)

Returns alignment length of the segment pair. Returns nil if no alignment data are available.


176
177
178
# File 'lib/bio/appl/spidey/report.rb', line 176

def align_len
  @align_len
end

#gapsObject (readonly)

Returns gaps.


166
167
168
# File 'lib/bio/appl/spidey/report.rb', line 166

def gaps
  @gaps
end

#genomicObject (readonly)

Returns segment informations of the 'Genomic'. Returns a Bio::Spidey::Report::Segment object. This would be a Bio::Spidey specific method.


142
143
144
# File 'lib/bio/appl/spidey/report.rb', line 142

def genomic
  @genomic
end

#midlineObject (readonly)

Returns the middle line of the alignment of the segment pair. Returns nil if no alignment data are available.


151
152
153
# File 'lib/bio/appl/spidey/report.rb', line 151

def midline
  @midline
end

#mismatchesObject (readonly) Also known as: mismatch_count

Returns mismatches.


162
163
164
# File 'lib/bio/appl/spidey/report.rb', line 162

def mismatches
  @mismatches
end

#mrnaObject (readonly)

Returns segment informations of the 'mRNA'. Returns a Bio::Spidey::Report::Segment object. This would be a Bio::Spidey specific method.


147
148
149
# File 'lib/bio/appl/spidey/report.rb', line 147

def mrna
  @mrna
end

#percent_identityObject (readonly)

Returns percent identity of the segment pair.


159
160
161
# File 'lib/bio/appl/spidey/report.rb', line 159

def percent_identity
  @percent_identity
end

#splice_siteObject (readonly)

Returns splice site information. Returns a hash which contains :d and :a for keys and 0, 1, or nil for values. This would be a Bio::Spidey specific methods.


172
173
174
# File 'lib/bio/appl/spidey/report.rb', line 172

def splice_site
  @splice_site
end

Class Method Details

.new_intron(from, to, strand, aln) ⇒ Object

Creates a new SegmentPair object when the segment pair is an intron. It is designed to be called internally from Bio::Spidey::Report::* classes. Users shall not call it directly.


182
183
184
185
186
187
188
189
# File 'lib/bio/appl/spidey/report.rb', line 182

def self.new_intron(from, to, strand, aln)
  genomic   = Segment.new(from, to, strand, aln[0])
  mrna      = Segment.new(nil, nil, nil,    aln[2])
  midline   = aln[1]
  aaseqline = aln[3]
  self.new(genomic, mrna, midline, aaseqline,
           nil, nil, nil, nil, nil)
end

.parse(str, strand, complement, aln) ⇒ Object

Parses a piece of Spidey result text and creates a new SegmentPair object. It is designed to be called internally from Bio::Spidey::Report::* classes. Users shall not call it directly.


196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/bio/appl/spidey/report.rb', line 196

def self.parse(str, strand, complement, aln)
  /\AExon\s*\d+(\(\-\))?\:\s*(\d+)\-(\d+)\s*\(gen\)\s+(\d+)\-(\d+)\s*\(mRNA\)\s+id\s*([\d\.]+)\s*\%\s+mismatches\s+(\d+)\s+gaps\s+(\d+)\s+splice site\s*\(d +a\)\s*\:\s*(\d+)\s+(\d+)/ =~ str
  if strand == 'minus' then
    genomic = Segment.new($3, $2, strand, aln[0])
  else
    genomic = Segment.new($2, $3, 'plus', aln[0])
  end
  if complement then
    mrna    = Segment.new($4, $5, 'minus', aln[2])
  else
    mrna    = Segment.new($4, $5, 'plus',  aln[2])
  end
  percent_identity = $6
  mismatches = ($7 ? $7.to_i : nil)
  gaps = ($8 ? $8.to_i : nil)
  splice_site = {
    :d => ($9  ? $9.to_i  : nil),
    :a => ($10 ? $10.to_i : nil)
  }
  midline   = aln[1]
  aaseqline = aln[3]
  self.new(genomic, mrna, midline, aaseqline,
           percent_identity, mismatches, gaps, splice_site,
           (midline ? midline.length : nil))
end

Instance Method Details

#hit_fromObject

Returns start position of the genomic (target, hit) (the first position is 1).


243
# File 'lib/bio/appl/spidey/report.rb', line 243

def hit_from;     @genomic.from;    end

#hit_strandObject

Returns strand information of the genomic (target, hit). Returns 'plus', 'minus', or nil.


254
# File 'lib/bio/appl/spidey/report.rb', line 254

def hit_strand;   @genomic.strand;  end

#hit_toObject

Returns end position (including its position) of the genomic (target, hit).


247
# File 'lib/bio/appl/spidey/report.rb', line 247

def hit_to;       @genomic.to;      end

#hseqObject

Returns the sequence (with gaps) of the genomic (target, hit).


250
# File 'lib/bio/appl/spidey/report.rb', line 250

def hseq;         @genomic.seq;     end

#qseqObject

Returns the sequence (with gaps) of the mRNA (query).


235
# File 'lib/bio/appl/spidey/report.rb', line 235

def qseq;         @mrna.seq;        end

#query_fromObject

Returns start position of the mRNA (query) (the first position is 1).


229
# File 'lib/bio/appl/spidey/report.rb', line 229

def query_from;   @mrna.from;       end

#query_strandObject

Returns strand information of the mRNA (query). Returns 'plus', 'minus', or nil.


239
# File 'lib/bio/appl/spidey/report.rb', line 239

def query_strand; @mrna.strand;     end

#query_toObject

Returns end position (including its position) of the mRNA (query).


232
# File 'lib/bio/appl/spidey/report.rb', line 232

def query_to;     @mrna.to;         end