Skip to content

Commit

Permalink
read() accepts streams in addition to filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhodak committed Aug 20, 2015
1 parent ece4973 commit 12cf879
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.gem
2 changes: 1 addition & 1 deletion absee.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'absee'
s.version = '1.0'
s.version = '1.1'
s.date = '2012-11-14'
s.summary = ".ab1 reader / ABIF reader"
s.description = ".ab1 reader / ABIF reader; extracts the peak indexes, called sequence, quality scores, and ACGT values from sequencing files"
Expand Down
11 changes: 9 additions & 2 deletions lib/absee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ class ABSee
#== Returns:
# Six arrays: trace data for A, C, G, T, called sequence, and peak indexes
def read(filename)
#opens ab1 as a File object
abFile = open(filename)
if filename.instance_of?(StringIO) or filename.instance_of?(File)
abFile = filename
elsif filename.instance_of? String
#opens ab1 as a File object
abFile = open(filename)
else
raise "Don't know what to do with input type #{filename.class}"
end

byteArray = ""
#// here we read the first four bytes. It is important
#// to remember that we do not seek back the file, just
Expand Down

0 comments on commit 12cf879

Please sign in to comment.