Bio/DB/Flat/BDB/fasta.pm

filter: Statementstmt 100% 6 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 8 / 8 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Bio/DB/Flat/BDB/embl.pm ↑ Summary Bio/DB/Flat/BDB/genbank.pm »
1 #
2 #
3 # BioPerl module for Bio::DB::Flat::BDB
4 #
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 #
7 # Cared for by Lincoln Stein <lstein@cshl.org>
8 #
9 # You may distribute this module under the same terms as perl itself
10  
11 # POD documentation - main docs before the code
12  
13 =head1 NAME
14  
15 Bio::DB::Flat::BDB::fasta - fasta adaptor for Open-bio standard BDB-indexed flat file
16  
17 =head1 SYNOPSIS
18  
19 See Bio::DB::Flat.
20  
21 =head1 DESCRIPTION
22  
23 This module allows fasta files to be stored in Berkeley DB flat files
24 using the Open-Bio standard BDB-indexed flat file scheme. You should
25 not be using this directly, but instead use it via Bio::DB::Flat.
26  
27 =head1 FEEDBACK
28  
29 =head2 Mailing Lists
30  
31 User feedback is an integral part of the evolution of this and other
32 Bioperl modules. Send your comments and suggestions preferably to one
33 of the Bioperl mailing lists. Your participation is much appreciated.
34  
35 bioperl-l@bioperl.org - General discussion
36 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
37  
38 =head2 Support
39  
40 Please direct usage questions or support issues to the mailing list:
41  
42 I<bioperl-l@bioperl.org>
43  
44 rather than to the module maintainer directly. Many experienced and
45 reponsive experts will be able look at the problem and quickly
46 address it. Please include a thorough description of the problem
47 with code and data examples if at all possible.
48  
49 =head2 Reporting Bugs
50  
51 Report bugs to the Bioperl bug tracking system to help us keep track
52 the bugs and their resolution. Bug reports can be submitted via the
53 web:
54  
55 https://github.com/bioperl/bioperl-live/issues
56  
57 =head1 SEE ALSO
58  
59 L<Bio::DB::Flat>,
60  
61 =head1 AUTHOR - Lincoln Stein
62  
63 Email - lstein@cshl.org
64  
65 =cut
66  
67 package Bio::DB::Flat::BDB::fasta;
68 $Bio::DB::Flat::BDB::fasta::VERSION = '1.7.8';
69 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
70  
71 1 ▶use base qw(Bio::DB::Flat::BDB);
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 sub default_file_format { "fasta" }
74  
75 sub seq_to_ids {
76 my $self = shift;
77 my $seq = shift;
78 my %ids;
79 $ids{$self->primary_namespace} = $seq->primary_id;
80 \%ids;
81 }
82  
83 sub parse_one_record {
84 my $self = shift;
85 my $fh = shift;
86
87 # fasta parses by changing $/ to '\n>', need to adjust accordingly
88 my $adj = -1;
89 my $parser =
90 $self->{cached_parsers}{fileno($fh)}
91 ||= Bio::SeqIO->new(-fh=>$fh,-format=>$self->default_file_format);
92 my $seq = $parser->next_seq or return;
93 $self->{flat_alphabet} ||= $seq->alphabet;
94 my $ids = $self->seq_to_ids($seq);
95 return ($ids, $adj);
96 }
97  
98 1;
« Bio/DB/Flat/BDB/embl.pm ↑ Summary Bio/DB/Flat/BDB/genbank.pm »