From: martinahansen Date: Tue, 22 Nov 2011 14:56:12 +0000 (+0000) Subject: got rid of type in filesys.rb X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=178225ead000ff26d6e76a654fceb10000bfc87d;p=biopieces.git got rid of type in filesys.rb git-svn-id: http://biopieces.googlecode.com/svn/trunk@1676 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_ruby/lib/maasha/fasta.rb b/code_ruby/lib/maasha/fasta.rb index 05655f6..d4c443b 100644 --- a/code_ruby/lib/maasha/fasta.rb +++ b/code_ruby/lib/maasha/fasta.rb @@ -42,9 +42,9 @@ class Fasta < Filesys raise FastaError, "Bad FASTA format" if seq_name.nil? or seq.nil? entry = Seq.new - entry.type = @type.nil? ? nil : @type.downcase entry.seq = seq.gsub(/\s/, '') entry.seq_name = seq_name.sub(/^>/, '').rstrip + entry.type = nil raise FastaError, "Bad FASTA format" if entry.seq_name.empty? raise FastaError, "Bad FASTA format" if entry.seq.empty? diff --git a/code_ruby/lib/maasha/fastq.rb b/code_ruby/lib/maasha/fastq.rb index a6b3610..e2a96ea 100644 --- a/code_ruby/lib/maasha/fastq.rb +++ b/code_ruby/lib/maasha/fastq.rb @@ -39,10 +39,10 @@ class Fastq < Filesys qual = @io.gets.chomp! entry = Seq.new - entry.type = @type.nil? ? nil : @type.downcase entry.seq = seq entry.seq_name = seq_name[1 .. seq_name.length] entry.qual = qual + entry.type = nil entry rescue diff --git a/code_ruby/lib/maasha/filesys.rb b/code_ruby/lib/maasha/filesys.rb index 00530d6..bed11f0 100644 --- a/code_ruby/lib/maasha/filesys.rb +++ b/code_ruby/lib/maasha/filesys.rb @@ -65,10 +65,8 @@ class Filesys end end - # TODO figure out what type is for. - def initialize(io, type=nil) - @io = io - @type = type + def initialize(io) + @io = io end # Method to close ios. diff --git a/code_ruby/test/maasha/test_fasta.rb b/code_ruby/test/maasha/test_fasta.rb index a8ba01c..e52440d 100755 --- a/code_ruby/test/maasha/test_fasta.rb +++ b/code_ruby/test/maasha/test_fasta.rb @@ -46,11 +46,6 @@ class FastaTest < Test::Unit::TestCase assert_equal("ATCG", fasta.get_entry.seq) end - def test_Fasta_get_entry_obtains_the_correct_type - fasta = Fasta.new(StringIO.new(">test\nATCG\n"), 'DNA') - assert_equal("dna", fasta.get_entry.type) - end - def test_Fasta_get_entry_rstrips_whitespace_from_seq_name fasta = Fasta.new(StringIO.new(">test\n\r\t ATCG\n")) assert_equal("test", fasta.get_entry.seq_name) diff --git a/code_ruby/test/maasha/test_fastq.rb b/code_ruby/test/maasha/test_fastq.rb index 2316fc7..8432207 100755 --- a/code_ruby/test/maasha/test_fastq.rb +++ b/code_ruby/test/maasha/test_fastq.rb @@ -40,11 +40,6 @@ class FastqTest < Test::Unit::TestCase assert_equal("test1", @fastq.get_entry.seq_name) end - def test_Fasta_get_entry_obtains_the_correct_type - fastq = Fastq.new(@io, 'DNA') - assert_equal("dna", fastq.get_entry.type) - end - def test_Fastq_get_entry_with_two_entries_obtain_correct assert_equal("ATCG", @fastq.get_entry.seq) assert_equal("atcg", @fastq.get_entry.seq)