Method: Bio::Spidey::Report::SegmentPair.parse

Defined in:
lib/bio/appl/spidey/report.rb

.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