Class: FastaPairedRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/bigbio/db/fasta/fastarecord.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nt, aa) ⇒ FastaPairedRecord

Returns a new instance of FastaPairedRecord.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bigbio/db/fasta/fastarecord.rb', line 15

def initialize nt, aa
  @nt = nt
  @aa = aa
  raise "ID error NT #{nt.id} not matching AA #{aa.id}" if nt.id != aa.id
  if nt.seq.size == aa.seq.size*3-1
    # account for EMBOSS cleverness
    nt.seq.chop!
    nt.seq.chop!
    aa.seq.chop!
  end
  if nt.seq.size == aa.seq.size*3-2
    # account for EMBOSS cleverness
    nt.seq.chop!
    aa.seq.chop!
  end
  if nt.seq.size == aa.seq.size*3-3
    aa.seq.chop!
  end
  raise "Sequence size mismatch for #{nt.id} <nt:#{nt.seq.size} != #{aa.seq.size*3} (aa:#{aa.seq.size}*3)>" if nt.seq.size != aa.seq.size*3
end

Instance Attribute Details

#aaObject (readonly)

Returns the value of attribute aa.



13
14
15
# File 'lib/bigbio/db/fasta/fastarecord.rb', line 13

def aa
  @aa
end

#ntObject (readonly)

Returns the value of attribute nt.



13
14
15
# File 'lib/bigbio/db/fasta/fastarecord.rb', line 13

def nt
  @nt
end

Instance Method Details

#idObject



36
37
38
# File 'lib/bigbio/db/fasta/fastarecord.rb', line 36

def id
  @aa.id
end