Skip to content

Commit

Permalink
Rename functions and document them
Browse files Browse the repository at this point in the history
  • Loading branch information
molecules committed Aug 17, 2017
1 parent 96b05ab commit ca663a7
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 11 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Bio::IRCF::FASTQ::Tiny

# VERSION

version 0.016
version 0.018

# SYNOPSIS

Expand Down Expand Up @@ -71,7 +71,7 @@ occurs in a FASTQ file.

# SUBROUTINES/METHODS

## iterator()
## iterator

positional parameters:
file name
Expand All @@ -93,7 +93,7 @@ occurs in a FASTQ file.
Returns an iterator which applies the coderef to one FASTQ entry at a
time, returning the result.

## process\_fastq()
## process\_fastq

Takes the same arguments as iterator. However, instead of returning
an iterator, it builds one internally and then exhaustively applies it to
Expand Down Expand Up @@ -127,6 +127,22 @@ occurs in a FASTQ file.

Returns a coderef compatible with C<process_fastq> or C<iterator>.

## open\_input

positional parameter:

filename (if last extension is 'gz', uses IO::Uncompress::Gunzip)

Returns a readable filehandle

## open\_output

positional parameter:

filename (if last extension is 'gz', uses IO::Compress::Gzip)

Returns a writable filehandle

# RATIONALE

Speed and flexibility. To change quality score formats, for example, this
Expand Down
2 changes: 1 addition & 1 deletion dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ author = Christopher Bottoms <molecules <at> cpan <dot> org>
license = Perl_5
copyright_holder = Christopher Bottoms
copyright_year = 2012
version = 0.017
version = 0.018

[Encoding]
encoding = bytes
Expand Down
30 changes: 23 additions & 7 deletions lib/Bio/IRCF/FASTQ/Tiny.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ our @EXPORT_OK = qw( iterator
coderef_print_altered_quality
coderef_print_barcoded_entry
coderef_print_entry
open_input_file
open_output_file
open_input
open_output
);
#=============================================================================

Expand All @@ -35,7 +35,7 @@ sub iterator {
my $filename = shift // croak 'file name required';
my $coderef = shift // sub { shift() }; # Default returns hashref of FASTQ entry

my $fh = open_input_file($filename);
my $fh = open_input($filename);

# create a line-by-line iterator for the file
my $next_chomped_line = _coderef_next_chomped_line($fh);
Expand Down Expand Up @@ -204,7 +204,7 @@ sub to_fasta {
}

# Open file for reading (as gzipped compressed if name ends in '.gz')
sub open_input_file {
sub open_input {
my $filename = shift;

# Return decompressing filehandle if applicable
Expand All @@ -216,7 +216,7 @@ sub open_input_file {
}

# Open writable file (as gzipped compressed if name ends in '.gz')
sub open_output_file {
sub open_output {
my $filename = shift;

if ($filename =~ /\.gz$/xms ) {
Expand Down Expand Up @@ -309,7 +309,7 @@ occurs in a FASTQ file.
=head1 SUBROUTINES/METHODS
=head2 iterator()
=head2 iterator
positional parameters:
file name
Expand All @@ -331,7 +331,7 @@ occurs in a FASTQ file.
Returns an iterator which applies the coderef to one FASTQ entry at a
time, returning the result.
=head2 process_fastq()
=head2 process_fastq
Takes the same arguments as iterator. However, instead of returning
an iterator, it builds one internally and then exhaustively applies it to
Expand Down Expand Up @@ -365,6 +365,22 @@ occurs in a FASTQ file.
Returns a coderef compatible with C<process_fastq> or C<iterator>.
=head2 open_input
positional parameter:
filename (if last extension is 'gz', uses IO::Uncompress::Gunzip)
Returns a readable filehandle
=head2 open_output
positional parameter:
filename (if last extension is 'gz', uses IO::Compress::Gzip)
Returns a writable filehandle
=head1 RATIONALE
Speed and flexibility. To change quality score formats, for example, this
Expand Down

0 comments on commit ca663a7

Please sign in to comment.