Skip to content

Commit

Permalink
get SeqIO working again as well
Browse files Browse the repository at this point in the history
  • Loading branch information
cjfields committed Aug 10, 2015
1 parent d3cdcd9 commit 0055530
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Bio/Role/IO.pm6
Expand Up @@ -5,7 +5,7 @@ use Bio::Role::Temp;
role Bio::Role::IO does Bio::Role::Temp {

# TODO: not sure we need to curry everything here, but list of methods is a rakudo bug
has IO::Handle $.fh; # handles IO::Handle;
has IO::Handle $.fh;

# At the moment we force all IO consumers to initialize-io if they have this
# simple signature
Expand Down
2 changes: 1 addition & 1 deletion lib/Bio/SeqIO.pm6
Expand Up @@ -6,7 +6,7 @@ use Bio::Role::IO;

class Bio::SeqIO does Bio::Role::Pluggable['SeqIO']
does Bio::Role::RecordFormat
does Bio::Role::IO
#does Bio::Role::IO
{

has $!plugin handles <next-Seq write-Seq>;
Expand Down
8 changes: 5 additions & 3 deletions lib/Bio/SeqIO/fasta.pm6
@@ -1,6 +1,7 @@
use v6;

use Bio::Role::SeqStream;
use Bio::Role::IO;
use Bio::Grammar::Fasta;
use Bio::PrimarySeq;

Expand All @@ -14,7 +15,7 @@ class Bio::Grammar::Fasta::Actions::PrimarySeq {
}
}

class Bio::SeqIO::fasta does Bio::Role::SeqStream {
class Bio::SeqIO::fasta does Bio::Role::SeqStream does Bio::Role::IO {
has $.buffer is rw;
has $!actions = Bio::Grammar::Fasta::Actions::PrimarySeq.new();
has $.width = 60;
Expand All @@ -30,9 +31,9 @@ class Bio::SeqIO::fasta does Bio::Role::SeqStream {
# time; two future optimizations require implementation in Rakudo:
# 1) Chunking in IO::Handle using nl => "\n>"
# 2) Grammar parsing of a stream of data (e.g. Cat), which is now considered
# a close post-6.0 update
# a post-6.0 update
method !chunkify {
return if $.eof();
return if $.fh.eof();
my $current_record;
while $.fh.get -> $line {
if $.buffer {
Expand All @@ -49,6 +50,7 @@ class Bio::SeqIO::fasta does Bio::Role::SeqStream {
} else {
$current_record ~= $line;
}
say "record: $current_record";
}
return $current_record;
};
Expand Down

0 comments on commit 0055530

Please sign in to comment.