| 1 |
|
| 2 |
=head1 LICENSE |
| 3 |
|
| 4 |
Copyright [2015-2024] EMBL-European Bioinformatics Institute |
| 5 |
|
| 6 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 |
you may not use this file except in compliance with the License. |
| 8 |
You may obtain a copy of the License at |
| 9 |
|
| 10 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
|
| 12 |
Unless required by applicable law or agreed to in writing, software |
| 13 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 14 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 |
See the License for the specific language governing permissions and |
| 16 |
limitations under the License. |
| 17 |
|
| 18 |
=cut |
| 19 |
|
| 20 |
=head1 NAME |
| 21 |
|
| 22 |
Bio::DB::HTS::Kseq - Bindings to Kseq |
| 23 |
|
| 24 |
=head1 DESCRIPTION |
| 25 |
|
| 26 |
Bindings to the Kseq library for iterating through a locally held FASTA/FASTQ file very quickly. Supports compressed and uncompressed files alongside filehandles. |
| 27 |
|
| 28 |
=head1 SYNOPSIS |
| 29 |
|
| 30 |
my $kseq = Bio::DB::HTS::Kseq->new('path/to/file'); |
| 31 |
my $iter = $kseq->iterator(); |
| 32 |
while(my $r = $iter->next_seq()) { |
| 33 |
say $r->name; |
| 34 |
say $r->desc; |
| 35 |
say $r->seq; |
| 36 |
say $r->qual; |
| 37 |
} |
| 38 |
|
| 39 |
# Allowing the object to go out of scope will close down all file handles |
| 40 |
|
| 41 |
=head2 METHODS |
| 42 |
|
| 43 |
=over 8 |
| 44 |
|
| 45 |
=item C<new> |
| 46 |
|
| 47 |
my $kseq = Bio::DB::HTS::Kseq->new('path/to/file'); |
| 48 |
|
| 49 |
Returns an instance of this object from a file path. |
| 50 |
|
| 51 |
=item C<newfh> |
| 52 |
|
| 53 |
open my $fh, '<', 'path' or die "Cannot open path: $!"; |
| 54 |
binmode $fh; |
| 55 |
my $kseq = Bio::DB::HTS::Kseq->newfh($fh); |
| 56 |
|
| 57 |
Returns an instance of this object from an opened file handle. This supports any known Perl glob/filehandle type |
| 58 |
|
| 59 |
=item C<iterator> |
| 60 |
|
| 61 |
my $iter = $kseq->iterator(); |
| 62 |
|
| 63 |
Returns the kseq iterator object |
| 64 |
|
| 65 |
=back |
| 66 |
|
| 67 |
=cut |
| 68 |
|
| 69 |
package Bio::DB::HTS::Kseq; |
| 70 |
|
| 71 |
use Bio::DB::HTS; #load the XS |
| 72 |
use Bio::DB::HTS::Kseq::Record; |
| 73 |
|
| 74 |
$Bio::DB::HTS::Kseq::VERSION = '3.02'; |
| 75 |
|
| 76 |
use strict; |
| 77 |
use warnings; |
| 78 |
|
| 79 |
1; |