Method: Bio::Sequence::NA#initialize

Defined in:
lib/bio/sequence/na.rb

#initialize(str) ⇒ NA

Generate an nucleic acid sequence object from a string.

s = Bio::Sequence::NA.new("aagcttggaccgttgaagt")

or maybe (if you have an nucleic acid sequence in a file)

s = Bio::Sequence:NA.new(File.open('dna.txt').read)

Nucleic Acid sequences are always all lowercase in bioruby

s = Bio::Sequence::NA.new("AAGcTtGG")
puts s                                  #=> "aagcttgg"

Whitespace is stripped from the sequence

seq = Bio::Sequence::NA.new("atg\nggg\ttt\r  gc")
puts s                                  #=> "atggggttgc"

Arguments:

  • (required) str: String

Returns

Bio::Sequence::NA object



75
76
77
78
79
# File 'lib/bio/sequence/na.rb', line 75

def initialize(str)
  super
  self.downcase!
  self.tr!(" \t\n\r",'')
end