Skip to content

Commit

Permalink
In Fastq formatter, default width value changed to nil
Browse files Browse the repository at this point in the history
 * In Bio::Sequence#output(:fastq) (Fastq output formatter),
   default width value is changed from 70 to nil, which means
   "without wrapping".  close [Feature #3191]
   (https://redmine.open-bio.org/issues/3191)
  • Loading branch information
ngoto committed Aug 17, 2011
1 parent 0fb6521 commit 7e8ba7c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
8 changes: 6 additions & 2 deletions RELEASE_NOTES.rdoc
Expand Up @@ -56,9 +56,13 @@ Google Summer of Code 2010.

== Incompatible changes

=== Bio::SPTR
=== Bio::Sequence#output(:fastq)

==== CC line topic "WEB RESOURCE"
In Fastq output formatter, default width value is changed from 70 to nil.
The nil means "without wrapping". The new default behavior without wrapping
is generally good with many recent applications that read fastq.

=== Bio::SPTR CC line topic "WEB RESOURCE"

In the return value of Bio::SPTR#cc('WEB RESOURCE'), "NAME" and "NOTE"
are now renamed to "Name" and "Note", respectively. The change is due to
Expand Down
4 changes: 2 additions & 2 deletions lib/bio/db/fastq/format_fastq.rb
Expand Up @@ -26,7 +26,7 @@ class Fastq < Bio::Sequence::Format::FormatterBase
# *Arguments*:
# * _sequence_: Bio::Sequence object
# * (optional) :repeat_title => (true or false) if true, repeating title in the "+" line; if not true, "+" only (default false)
# * (optional) :width => _width_: (Fixnum) width to wrap sequence and quality lines; nil to prevent wrapping (default 70)
# * (optional) :width => _width_: (Fixnum) width to wrap sequence and quality lines; nil to prevent wrapping (default nil)
# * (optional) :title => _title_: (String) completely replaces title line with the _title_ (default nil)
# * (optional) :default_score => _score_: (Integer) default score for bases that have no valid quality scores or error probabilities; false or nil means the lowest score, true means the highest score (default nil)
def initialize; end if false # dummy for RDoc
Expand All @@ -43,7 +43,7 @@ def initialize; end if false # dummy for RDoc
# *Returns*:: String object
def output
title = @options[:title]
width = @options.has_key?(:width) ? @options[:width] : 70
width = @options.has_key?(:width) ? @options[:width] : nil
seq = @sequence.seq.to_s
entry_id = @sequence.entry_id ||
"#{@sequence.primary_accession}.#{@sequence.sequence_version}"
Expand Down
12 changes: 12 additions & 0 deletions test/unit/bio/db/test_fastq.rb
Expand Up @@ -369,6 +369,18 @@ def test_to_biosequence
end
end

def test_to_biosequence_and_output
@ff.each_with_index do |e, i|
id_line = IDLINES[i]
seq_line = SEQS[i]
qual_line = QUALITY_STRINGS[i]
# Changed default width to nil (no wrapping)
expected = "@#{id_line}\n#{seq_line}\n+\n#{qual_line}\n"
actual = e.to_biosequence.output(:fastq_sanger)
assert_equal(expected, actual)
end
end

def test_roundtrip
@ff.each_with_index do |e, i|
str_orig = @ff.entry_raw
Expand Down

0 comments on commit 7e8ba7c

Please sign in to comment.