Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
84 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
# Buffered FastaGenomeReader | |||
# | |||
|
|||
class BufferMissed < Exception | |||
end | |||
|
|||
class FastaGenomeReader | |||
|
|||
# Initalize the reader of FASTA file | |||
def initialize fn, parse_descriptor_func, bufsize=64_000 | |||
@f = File.open(fn) | |||
@parse_descriptor = parse_descriptor_func | |||
@bufsize = bufsize | |||
@buf = read_next | |||
end | |||
|
|||
# Returns the reference nucleotide. When the buffer is missed a BufferMissed | |||
# exception is thrown. | |||
def ref chr,pos | |||
end | |||
|
|||
private | |||
|
|||
# Fill the next buffer until the next descriptor is reached or the buffer | |||
# is full | |||
def read_next | |||
while (line = @f.gets) | |||
p line | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,14 @@ | |||
|
|||
require 'rspec' | |||
|
|||
$: << "../lib" | |||
|
|||
require 'bigbio' | |||
|
|||
describe FastaGenomeReader, "when reading a full genome" do | |||
|
|||
it "should load the genome file" do | |||
FastaGenomeReader.new("test/data/fasta/nt.fa", -> {}) | |||
end | |||
|
|||
end |