]> git.donarmstrong.com Git - biopieces.git/commitdiff
changed Seq.new argument to hash
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 1 Oct 2013 18:33:22 +0000 (18:33 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 1 Oct 2013 18:33:22 +0000 (18:33 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2223 74ccb610-7750-0410-82ae-013aeee3265d

18 files changed:
bp_bin/analyze_seq
bp_bin/blast_seq_pair
bp_bin/find_adaptor
bp_bin/find_homopolymers
bp_bin/join_seq
bp_bin/shred_seq
code_ruby/lib/maasha/embl.rb
code_ruby/lib/maasha/genbank.rb
code_ruby/lib/maasha/locator.rb
code_ruby/lib/maasha/sam.rb
code_ruby/lib/maasha/seq.rb
code_ruby/test/maasha/seq/test_assemble.rb
code_ruby/test/maasha/seq/test_backtrack.rb
code_ruby/test/maasha/seq/test_digest.rb
code_ruby/test/maasha/seq/test_dynamic.rb
code_ruby/test/maasha/seq/test_homopolymer.rb
code_ruby/test/maasha/test_locator.rb
code_ruby/test/maasha/test_seq.rb

index c2b96a5070b252bbe89f9e2e1c1fbd63055432a0..2c38a274beeb593394ec5d33663d4dec1129de23 100755 (executable)
@@ -39,7 +39,7 @@ options = Biopieces.options_parse(ARGV, casts)
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   input.each_record do |record|
     if record[:SEQ]
-      seq  = Seq.new(record[:SEQ_NAME], record[:SEQ], record[:SEQ_TYPE], record[:SCORE])
+      seq  = Seq.new_bp(record)
       comp = seq.composition
 
       comp.each_pair do |key,val|
index 73c74154a7340809fbe0784726dc83791f1dc071..854ee424c3201110c9fb48f1dfcbe085737a884b 100755 (executable)
@@ -175,14 +175,14 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
         end
 
         got1  = true
-        type1 = Seq.new(nil, record[:SEQ][0 ... 100]).type_guess
+        type1 = Seq.new(seq: record[:SEQ][0 ... 100]).type_guess
       elsif got2.nil?
         Fasta.open(infile2, "w") do |fasta_io|
           fasta_io.puts seq.to_fasta
         end
 
         got2  = true
-        type2 = Seq.new(nil, record[:SEQ][0 ... 100]).type_guess
+        type2 = Seq.new(seq: record[:SEQ][0 ... 100]).type_guess
       end
 
       if got1 and got2
index f2f593d1ce90f11087b04ca9d2abc8a58a40b264..c4df418f571556bf663c89cf3ab0f23f2f6074b5 100755 (executable)
@@ -53,11 +53,11 @@ casts << {:long=>'deletions',   :short=>'d', :type=>'uint',   :mandatory=>false,
 options = Biopieces.options_parse(ARGV, casts)
 
 if options[:forward_rc]
-  options[:forward] = Seq.new("test", options[:forward_rc], :dna).reverse.complement.seq
+  options[:forward] = Seq.new(seq: options[:forward_rc], type: :dna).reverse.complement.seq
 end
 
 if options[:reverse_rc]
-  options[:reverse] = Seq.new("test", options[:reverse_rc], :dna).reverse.complement.seq
+  options[:reverse] = Seq.new(seq: options[:reverse_rc], type: :dna).reverse.complement.seq
 end
 
 raise ArgumentError, "no adaptor specified" unless options[:forward] or options[:reverse]
index c0885e3d3bb010a1363af0ff57dd24e8acf819cc..c7c98f0023e7c738f50f9f301c261ec563ed39eb 100755 (executable)
@@ -45,7 +45,7 @@ options = Biopieces.options_parse(ARGV, casts)
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   input.each_record do |record|
     if record[:SEQ]
-      seq = Seq.new(nil, record[:SEQ])
+      seq = Seq.new(seq: record[:SEQ])
 
       longest = Seq::Homopolymer.new("", 0, 0)
       got_one = false
index b2749e984aea9d94e533cf444dde24290681ff94..5804624df40bbacc26feea12c16919ca0febd594 100755 (executable)
@@ -38,7 +38,7 @@ casts << {:long=>'delimiter', :short=>'d', :type=>'string', :mandatory=>true, :d
 options = Biopieces.options_parse(ARGV, casts)
 
 sequences = []
-seq = Seq.new(nil, "")
+seq = Seq.new(seq: "")
 
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   input.each_record do |record|
index 94d5835e53837f84b0e81aa8bffa9200feb557cf..322916426e606dd11259eb6f34757486296e039d 100755 (executable)
@@ -84,7 +84,7 @@ options = Biopieces.options_parse(ARGV, casts)
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   input.each_record do |record|
     if record[:SEQ] and record[:SEQ].length >= options[:size]
-      entry      = Seq.new(record[:SEQ_NAME], record[:SEQ], record[:SCORES])
+      entry      = Seq.new_bp(record)
       entry.type = :dna
 
       entry.shred(options[:size], options[:coverage]) do |subentry|
index 66a53c066497bb8008694d7d556a05974a8d6d3b..80bafeeacbf61485c99e9e7e381853a6b9e22620 100644 (file)
@@ -87,7 +87,7 @@ class EMBL < Filesys
 
     seq = @entry[j + 1 .. i].join.delete(" 0123456789")
 
-    Seq.new(nil, seq, :dna) if seq
+    Seq.new(seq: seq, type: :dna) if seq
   end
 
   # Method to get the base keys from EMBL entry and return these
index 795de75652f1d84f7ec6fd91531e07fc929741b1..9635efd69f92971b6cac9ab54c3331885c77ee28 100644 (file)
@@ -87,7 +87,7 @@ class Genbank < Filesys
 
     seq = @entry[j + 1 .. i].join.delete(" 0123456789")
 
-    Seq.new(nil, seq, :dna) if seq
+    Seq.new(seq: seq, type: :dna) if seq
   end
 
   # Method to get the base keys from Genbank entry and return these
index 70aa861fa736edb1ad547edd8061930d06aa6277..f9fae94890e1a3a01e64165ff535b94a28d743d5 100644 (file)
@@ -35,7 +35,7 @@ class Locator
   def initialize(locator, seq)
     @locator = locator
     @seq     = seq
-    @subseq  = Seq.new(nil, "", :dna)
+    @subseq  = Seq.new(seq: "", type: :dna)
     parse_locator(locator)
   end
 
@@ -107,7 +107,7 @@ class Locator
           int_beg = $1.to_i - 1
           int_end = $2.to_i - 1
 
-          newseq = Seq.new(nil, @seq.seq[int_beg..int_end], :dna)
+          newseq = Seq.new(seq: @seq.seq[int_beg..int_end], type: :dna)
 
                                        unless newseq.seq.nil?
                                                newseq.reverse!.complement! if comp
@@ -117,7 +117,7 @@ class Locator
         when /^(\d+)$/
           pos = $1.to_i - 1
 
-          newseq = Seq.new(nil, @seq.seq[pos], :dna)
+          newseq = Seq.new(seq: @seq.seq[pos], type: :dna)
 
                                        unless newseq.seq.nil?
                newseq.reverse!.complement! if comp 
index 074b999aa58589ea962356655c7f3262ab3b05a3..14a910ffd4a46e7cef036a290da040abf0f632b7 100644 (file)
@@ -393,7 +393,7 @@ class Sam < Filesys
     entry[:RNEXT] = rnext
     entry[:PNEXT] = pnext
     entry[:TLEN]  = tlen
-    entry[:SEQ]   = (qual == '*') ? Seq.new(qname, seq) : Seq.new(qname, seq, qual)
+    entry[:SEQ]   = (qual == '*') ? Seq.new(seq_name: qname, seq: seq) : Seq.new(seq_name: qname, seq: seq, qual: qual)
     entry[:QUAL]  = qual
 
     # Optional fields - where some are really important! HATE HATE HATE SAM!!!
index fd83ba3282d28c561358fb9383c18e324d9a7ed4..a2d5bbac3462d44401d0e1d97a70101f1b7d3af4 100644 (file)
@@ -93,7 +93,7 @@ class Seq
     type     = record[:SEQ_TYPE].to_sym if record[:SEQ_TYPE]
     qual     = record[:SCORES]
 
-    self.new(seq_name, seq, type, qual)
+    self.new(seq_name: seq_name, seq: seq, type: type, qual: qual)
   end
 
   # Class method that generates all possible oligos of a specifed length and type.
@@ -125,19 +125,19 @@ class Seq
     oligos
   end
 
-  # Initialize a sequence object with the following arguments:
-  # - seq_name: Name of the sequence.
-  # - seq: The sequence.
-  # - type: The sequence type - DNA, RNA, or protein
-  # - qual: An Illumina type quality scores string.
-  def initialize(seq_name = nil, seq = nil, type = nil, qual = nil)
-    @seq_name = seq_name
-    @seq      = seq
-    @type     = type
-    @qual     = qual
+  # Initialize a sequence object with the following options:
+  # - :seq_name   Name of the sequence.
+  # - :seq        The sequence.
+  # - :type       The sequence type - DNA, RNA, or protein
+  # - :qual       An Illumina type quality scores string.
+  def initialize(options = {})
+    @seq_name = options[:seq_name]
+    @seq      = options[:seq]
+    @type     = options[:type]
+    @qual     = options[:qual]
 
-    if @qual
-      raise SeqError, "Sequence length and score length mismatch: #{@seq.length} != #{@qual.length}" if @seq.length != @qual.length
+    if @qual and @seq.length != @qual.length
+      raise SeqError, "Sequence length and score length mismatch: #{@seq.length} != #{@qual.length}"
     end
   end
 
@@ -343,7 +343,12 @@ class Seq
 
   # Method to reverse the sequence.
   def reverse
-    Seq.new(self.seq_name, self.seq.reverse, self.type, self.qual ? self.qual.reverse : self.qual)
+    Seq.new(
+      seq_name: self.seq_name,
+      seq:      self.seq.reverse,
+      type:     self.type,
+      qual:     (self.qual ? self.qual.reverse : self.qual)
+    )
   end
 
   # Method to reverse the sequence.
@@ -357,10 +362,11 @@ class Seq
   def complement
     raise SeqError, "Cannot complement 0 length sequence" if self.length == 0
 
-    entry          = Seq.new
-    entry.seq_name = self.seq_name
-    entry.type     = self.type
-    entry.qual     = self.qual
+    entry = Seq.new(
+      seq_name: self.seq_name,
+      type:     self.type,
+      qual:     self.qual
+    )
 
     if self.is_dna?
       entry.seq = self.seq.tr('AGCUTRYWSMKHDVBNagcutrywsmkhdvbn', 'TCGAAYRWSKMDHBVNtcgaayrwskmdhbvn')
@@ -424,7 +430,12 @@ class Seq
 
   # Method to return a new Seq object with shuffled sequence.
   def shuffle
-    Seq.new(self.seq_name, self.seq.split('').shuffle!.join, self.type, self.qual)
+    Seq.new(
+      seq_name: self.seq_name,
+      seq:      self.seq.split('').shuffle!.join,
+      type:     self.type,
+      qual:     self.qual
+    )
   end
 
   # Method to shuffle a sequence randomly inline.
@@ -491,7 +502,7 @@ class Seq
 
     seq_name = self.seq_name.nil? ? nil : self.seq_name.dup
 
-    Seq.new(seq_name, seq, self.type, qual)
+    Seq.new(seq_name: seq_name, seq: seq, type: self.type, qual: qual)
   end
 
   # Method that replaces a sequence with a subsequence from a given start position
index b5ddb7d706c03b3b4ea633149b8e55f7741785e6..bd1baf0649390f0a2cbabc382af0d9cce9b551a8 100755 (executable)
@@ -8,34 +8,34 @@ require 'pp'
 
 class TestAssemble < Test::Unit::TestCase 
   test "Assemble.pair without overlap returns nil" do
-    assert_nil(Assemble.pair(Seq.new("test1", "aaaa"), Seq.new("test2", "tttt")))
+    assert_nil(Assemble.pair(Seq.new(seq: "aaaa"), Seq.new(seq: "tttt")))
   end
 
-  test "Assemble.pair with overlap returns the correctly" do
-    assert_equal("atcGatc", Assemble.pair(Seq.new("test1", "atcg"), Seq.new("test2", "gatc")).seq)
-    assert_equal("atCGat",  Assemble.pair(Seq.new("test1", "atcg"), Seq.new("test2", "cgat")).seq)
-    assert_equal("aTCGa",   Assemble.pair(Seq.new("test1", "atcg"), Seq.new("test2", "tcga")).seq)
-    assert_equal("ATCG",    Assemble.pair(Seq.new("test1", "atcg"), Seq.new("test2", "atcg")).seq)
+  test "Assemble.pair with overlap returns correctly" do
+    assert_equal("atcGatc", Assemble.pair(Seq.new(seq_name: "t1", seq: "atcg"), Seq.new(seq_name: "t2", seq: "gatc")).seq)
+    assert_equal("atCGat",  Assemble.pair(Seq.new(seq_name: "t1", seq: "atcg"), Seq.new(seq_name: "t2", seq: "cgat")).seq)
+    assert_equal("aTCGa",   Assemble.pair(Seq.new(seq_name: "t1", seq: "atcg"), Seq.new(seq_name: "t2", seq: "tcga")).seq)
+    assert_equal("ATCG",    Assemble.pair(Seq.new(seq_name: "t1", seq: "atcg"), Seq.new(seq_name: "t2", seq: "atcg")).seq)
   end
 
   test "Assemble.pair with overlap and overlap_min returns correctly" do
-    assert_nil(Assemble.pair(Seq.new("test1", "atcg"), Seq.new("test2", "gatc"), :overlap_min => 2))
-    assert_equal("atCGat", Assemble.pair(Seq.new("test1", "atcg"), Seq.new("test2", "cgat"), :overlap_min => 2).seq)
+    assert_nil(Assemble.pair(Seq.new(seq: "atcg"), Seq.new(seq: "gatc"), :overlap_min => 2))
+    assert_equal("atCGat", Assemble.pair(Seq.new(seq_name: "t1", seq: "atcg"), Seq.new(seq_name: "t2", seq: "cgat"), :overlap_min => 2).seq)
   end
 
   test "Assemble.pair with overlap and overlap_max returns correctly" do
-    assert_equal("aTCGa", Assemble.pair(Seq.new("test1", "atcg"), Seq.new("test2", "tcga"), :overlap_max => 3).seq)
-    assert_nil(Assemble.pair(Seq.new("test1", "atcg"), Seq.new("test2", "atcg"), :overlap_max => 3))
+    assert_equal("aTCGa", Assemble.pair(Seq.new(seq_name: "t1", seq: "atcg"), Seq.new(seq_name: "t2", seq: "tcga"), :overlap_max => 3).seq)
+    assert_nil(Assemble.pair(Seq.new(seq: "atcg"), Seq.new(seq: "atcg"), :overlap_max => 3))
   end
 
   test "Assemble.pair with overlap returns correct quality" do
-    assert_equal("?", Assemble.pair(Seq.new("test1", "a", :dna, "I"), Seq.new("test2", "a", :dna, "5")).qual)
-    assert_equal("GH??43", Assemble.pair(Seq.new("test1", "atcg", :dna, "GHII"), Seq.new("test2", "cgat", :dna, "5543")).qual)
-    assert_equal("I???5", Assemble.pair(Seq.new("test1", "atcg", :dna, "IIII"), Seq.new("test2", "tcga", :dna, "5555")).qual)
+    assert_equal("?", Assemble.pair(Seq.new(seq_name: "t1", seq: "a", qual: "I"), Seq.new(seq_name: "t2", seq: "a", qual: "5")).qual)
+    assert_equal("GH??43", Assemble.pair(Seq.new(seq_name: "t1", seq: "atcg", qual: "GHII"), Seq.new(seq_name: "t2", seq: "cgat", qual: "5543")).qual)
+    assert_equal("I???5", Assemble.pair(Seq.new(seq_name: "t1", seq: "atcg", qual: "IIII"), Seq.new(seq_name: "t2", seq: "tcga", qual: "5555")).qual)
   end
 
   test "Assemble.pair with mismatch returns the highest scoring" do
-    assert_equal("ATCGA", Assemble.pair(Seq.new("t1", "atcga", :dna, "IIIII"), Seq.new("t2", "attga", :dna, "55555"), :mismatches_max => 20).seq)
-    assert_equal("ATTGA", Assemble.pair(Seq.new("t1", "atcga", :dna, "55555"), Seq.new("t2", "attga", :dna, "IIIII"), :mismatches_max => 20).seq)
+    assert_equal("ATCGA", Assemble.pair(Seq.new(seq_name: "t1", seq: "atcga", qual: "IIIII"), Seq.new(seq_name: "t2", seq: "attga", qual: "55555"), :mismatches_max => 20).seq)
+    assert_equal("ATTGA", Assemble.pair(Seq.new(seq_name: "t1", seq: "atcga", qual: "55555"), Seq.new(seq_name: "t2", seq: "attga", qual: "IIIII"), :mismatches_max => 20).seq)
   end
 end
index f244aab38a5ea1cc1ecf0ba283283746229238a7..6000dc025cdc5ab3af7309ed6b66a7be94d4c451 100644 (file)
@@ -31,9 +31,9 @@ require 'maasha/seq'
 
 class BackTrackTest < Test::Unit::TestCase
   def setup
-    #                       0         1
-    #                       01234567890123456789
-    @seq = Seq.new("test", "tacgatgctagcatgcacgg")
+    #                    0         1
+    #                    01234567890123456789
+    @seq = Seq.new(seq: "tacgatgctagcatgcacgg")
     @seq.extend(BackTrack)
   end
 
index ca590424f2ea45fe54a3ef5f1f295fb5157c43c3..8cb75ad7659b8e1fec320b03e300ed737f3564e7 100755 (executable)
@@ -36,17 +36,17 @@ class TestDigest < Test::Unit::TestCase
   end
 
   test "#each_digest dont raise on ok pattern residue" do
-    entry = Seq.new("test", "atcg")
+    entry = Seq.new(seq: "atcg")
     assert_nothing_raised { entry.each_digest("AGCUTRYWSMKHDVBNagcutrywsmkhdvbn", 4) }
   end
 
   test "#each_digest with no match returns correctly" do
-    entry = Seq.new("test", "aaaaaaaaaaa")
+    entry = Seq.new(seq: "aaaaaaaaaaa")
     assert_equal(entry.seq, entry.each_digest("CGCG", 1).first.seq)
   end
 
   test "#each_digest with matches returns correctly" do
-    entry = Seq.new("test", "TTTTaaaaTTTTbbbbTTTT")
+    entry = Seq.new(seq: "TTTTaaaaTTTTbbbbTTTT")
     seqs  = entry.each_digest("TTNT", 1)
     assert_equal("T", seqs[0].seq)
     assert_equal("TTTaaaaT", seqs[1].seq)
index 417b1b206b0691db95e34c16f68b279e2c21e819..9879c7565dc11f18dc1d99d4c04e2b2e78519791 100755 (executable)
@@ -31,7 +31,7 @@ require 'test/helper'
 
 class TestDynamic < Test::Unit::TestCase
   def setup
-    @p = Seq.new("test", "atcg")
+    @p = Seq.new(seq_name: "test", seq: "atcg")
     @p.extend(Dynamic)
   end
 
@@ -120,13 +120,13 @@ class TestDynamic < Test::Unit::TestCase
   end
 
   test "#patscan locates three patterns ok" do
-    p = Seq.new("test", "ataacgagctagctagctagctgactac")
+    p = Seq.new(seq_name: "test", seq: "ataacgagctagctagctagctgactac")
     p.extend(Dynamic)
     assert_equal(3, p.patscan("tag").count)
   end
 
   test "#patscan with pos locates two patterns ok" do
-    p = Seq.new("test", "ataacgagctagctagctagctgactac")
+    p = Seq.new(seq_name: "test", seq: "ataacgagctagctagctagctgactac")
     p.extend(Dynamic)
     assert_equal(2, p.patscan("tag", 10).count)
   end
index a574fd8c5041f01103e9aefeb3a33ca8c3b3c6f4..cae533ee36dce50a609e5a4abfdbf2503f6c8c03 100755 (executable)
@@ -31,9 +31,9 @@ require 'maasha/seq'
 
 class HomopolymerTest < Test::Unit::TestCase
   def setup
-    #                         0         1
-    #                         01234567890123456789
-    @entry = Seq.new("test", "tacgatgctagcatgcacgg")
+    #                      0         1
+    #                      01234567890123456789
+    @entry = Seq.new(seq: "tacgatgctagcatgcacgg")
     @entry.extend(Homopolymer)
   end
 
index dc0fe14ba20d7d7cf2b93d27c89f61710da00569..7517417bfba2aa5d79304316a1e8614b5e93766d 100755 (executable)
@@ -32,7 +32,7 @@ require 'test/helper'
 
 class TestLocator < Test::Unit::TestCase 
   def setup
-    @seq = Seq.new(nil, "tcatgatcaagatctaacagcagaagtacacttctattta", :dna)
+    @seq = Seq.new(seq: "tcatgatcaagatctaacagcagaagtacacttctattta", type: :dna)
   end
 
   test "#new with single position returns correctly" do
index d773ae2298e77c84b206be12ff32108b600ffd87..e50271d647e1b253798f06a1aa8864d4cc0dcbe5 100755 (executable)
@@ -35,7 +35,7 @@ class TestSeq < Test::Unit::TestCase
   end
 
   test "Seq.new with differnet length SEQ and SCORES raises" do
-    assert_raise(SeqError) { Seq.new("test", "ATCG", "dna", "hhh") }
+    assert_raise(SeqError) { Seq.new(seq_name: "test", seq: "ATCG", type: :dna, qual: "hhh") }
   end
 
   test "Seq.new_bp returns correctly" do
@@ -218,7 +218,7 @@ class TestSeq < Test::Unit::TestCase
   end
 
   test "#to_fasta wraps correctly" do
-    entry = Seq.new("test", "ATCG")
+    entry = Seq.new(seq_name: "test", seq: "ATCG")
     assert_equal(">test\nAT\nCG\n", entry.to_fasta(2))
   end
 
@@ -230,12 +230,12 @@ class TestSeq < Test::Unit::TestCase
   end
 
   test "#to_key with bad residue raises" do
-    entry = Seq.new("test", "AUCG")
+    entry = Seq.new(seq_name: "test", seq: "AUCG")
     assert_raise(SeqError) { entry.to_key }
   end
 
   test "#to_key returns correctly" do
-    entry = Seq.new("test", "ATCG")
+    entry = Seq.new(seq_name: "test", seq: "ATCG")
     assert_equal(54, entry.to_key)
   end
 
@@ -303,22 +303,22 @@ class TestSeq < Test::Unit::TestCase
   end
 
   test "#hamming_distance returns correctly" do
-    seq1 = Seq.new("test1", "ATCG")
-    seq2 = Seq.new("test2", "atgg")
+    seq1 = Seq.new(seq: "ATCG")
+    seq2 = Seq.new(seq: "atgg")
     assert_equal(1, seq1.hamming_distance(seq2))
   end
 
   test "#hamming_distance with ambiguity codes return correctly" do
-    seq1 = Seq.new("test1", "ATCG")
-    seq2 = Seq.new("test2", "atng")
+    seq1 = Seq.new(seq: "ATCG")
+    seq2 = Seq.new(seq: "atng")
 
     assert_equal(1, seq1.hamming_distance(seq2))
     assert_equal(0, seq1.hamming_distance(seq2, ambiguity: true))
   end
 
   test "#edit_distance returns correctly" do
-    seq1 = Seq.new("test1", "ATCG")
-    seq2 = Seq.new("test2", "tgncg")
+    seq1 = Seq.new(seq: "ATCG")
+    seq2 = Seq.new(seq: "tgncg")
     assert_equal(2, seq1.edit_distance(seq2))
   end
 
@@ -351,7 +351,7 @@ class TestSeq < Test::Unit::TestCase
   end
 
   test "#+ without qual returns correctly" do
-    entry = Seq.new("test1", "at") + Seq.new("test2", "cg")
+    entry = Seq.new(seq_name: "test1", seq: "at") + Seq.new(seq_name: "test2", seq: "cg")
     assert_nil(entry.seq_name)
     assert_equal("atcg", entry.seq)
     assert_nil(entry.type)
@@ -359,7 +359,7 @@ class TestSeq < Test::Unit::TestCase
   end
 
   test "#+ with qual returns correctly" do
-    entry = Seq.new("test1", "at", :dna, "II") + Seq.new("test2", "cg", :dna, "JJ")
+    entry = Seq.new(seq_name: "test1", seq: "at", type: :dna, qual: "II") + Seq.new(seq_name: "test2", seq: "cg", type: :dna, qual: "JJ")
     assert_nil(entry.seq_name)
     assert_equal("atcg", entry.seq)
     assert_equal(:dna,   entry.type)
@@ -368,32 +368,32 @@ class TestSeq < Test::Unit::TestCase
 
   test "#<< with different types raises" do
     @entry.seq = "atcg"
-    assert_raise(SeqError) { @entry << Seq.new("test", "atcg", :dna) }
+    assert_raise(SeqError) { @entry << Seq.new(seq_name: "test", seq: "atcg", type: :dna) }
   end
 
   test "#<< with missing qual in one entry raises" do
     @entry.seq  = "atcg"
     @entry.type = :dna
-    assert_raise(SeqError) { @entry << Seq.new("test", "atcg", :dna, "IIII") }
+    assert_raise(SeqError) { @entry << Seq.new(seq_name: "test", seq: "atcg", type: :dna, qual: "IIII") }
     @entry.qual = "IIII"
-    assert_raise(SeqError) { @entry << Seq.new("test", "atcg", :dna) }
+    assert_raise(SeqError) { @entry << Seq.new(seq_name: "test", seq: "atcg", type: :dna) }
   end
 
   test "#<< with nil qual in both entries dont raise" do
     @entry.seq = "atcg"
-    assert_nothing_raised { @entry << Seq.new("test", "atcg") }
+    assert_nothing_raised { @entry << Seq.new(seq_name: "test", seq: "atcg") }
   end
 
   test "#<< with qual in both entries dont raise" do
     @entry.seq  = "atcg"
     @entry.type = :dna
     @entry.qual = "IIII"
-    assert_nothing_raised { @entry << Seq.new("test", "atcg", :dna, "IIII") }
+    assert_nothing_raised { @entry << Seq.new(seq_name: "test", seq: "atcg", type: :dna, qual: "IIII") }
   end
 
   test "#<< without qual returns correctly" do
     @entry.seq  = "atcg"
-    @entry <<  Seq.new("test", "ATCG")
+    @entry <<  Seq.new(seq_name: "test", seq: "ATCG")
     assert_equal("atcgATCG", @entry.seq)
   end
 
@@ -401,13 +401,13 @@ class TestSeq < Test::Unit::TestCase
     @entry.seq  = "atcg"
     @entry.type = :dna
     @entry.qual = "HHHH"
-    @entry <<  Seq.new("test", "ATCG", :dna, "IIII")
+    @entry <<  Seq.new(seq_name: "test", seq: "ATCG", type: :dna, qual: "IIII")
     assert_equal("atcgATCG", @entry.seq)
     assert_equal("HHHHIIII", @entry.qual)
   end
 
   test "#[] with qual returns correctly" do
-    entry = Seq.new("test", "atcg", :dna, "FGHI")
+    entry = Seq.new(seq_name: "test", seq: "atcg", type: :dna, qual: "FGHI")
 
     e = entry[2]
 
@@ -420,7 +420,7 @@ class TestSeq < Test::Unit::TestCase
   end
 
   test "#[] without qual returns correctly" do
-    entry = Seq.new("test", "atcg")
+    entry = Seq.new(seq_name: "test", seq: "atcg")
 
     e = entry[2]
 
@@ -431,9 +431,9 @@ class TestSeq < Test::Unit::TestCase
   end
 
   test "[]= with qual returns correctly" do
-    entry = Seq.new("test", "atcg", :dna, "FGHI")
+    entry = Seq.new(seq_name: "test", seq: "atcg", type: :dna, qual: "FGHI")
 
-    entry[0] = Seq.new("foo", "T", :dna, "I")
+    entry[0] = Seq.new(seq_name: "foo", seq: "T", type: :dna, qual: "I")
 
     assert_equal("test", entry.seq_name)
     assert_equal("Ttcg", entry.seq)
@@ -442,9 +442,9 @@ class TestSeq < Test::Unit::TestCase
   end
 
   test "[]= without qual returns correctly" do
-    entry = Seq.new("test", "atcg")
+    entry = Seq.new(seq_name: "test", seq: "atcg")
 
-    entry[0] = Seq.new("foo", "T")
+    entry[0] = Seq.new(seq_name: "foo", seq: "T")
 
     assert_equal("test", entry.seq_name)
     assert_equal("Ttcg", entry.seq)