| 1 | # | ||||||||||||||||||||||||||||
| 2 | # Copyright (c) 1997-2001 bioperl, Chad Matsalla. All Rights Reserved. | ||||||||||||||||||||||||||||
| 3 | # This module is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||
| 4 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # Copyright Chad Matsalla | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =head1 NAME | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | Bio::SeqIO::phd - phd file input/output stream | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | Do not use this module directly. Use it via the L<Bio::SeqIO> class. | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | This object can transform .phd files (from Phil Green's phred basecaller) | ||||||||||||||||||||||||||||
| 23 | to and from Bio::Seq::Quality objects. The phd format is described in section 10 | ||||||||||||||||||||||||||||
| 24 | at this url: http://www.phrap.org/phredphrap/phred.html | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =head1 FEEDBACK | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head2 Mailing Lists | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||
| 31 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||||||||||||||||||||
| 32 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||
| 35 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =head2 Support | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||
| 44 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||
| 45 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||
| 46 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||
| 51 | the bugs and their resolution. | ||||||||||||||||||||||||||||
| 52 | Bug reports can be submitted via the web: | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =head1 AUTHOR Chad Matsalla | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | Chad Matsalla | ||||||||||||||||||||||||||||
| 59 | bioinformatics@dieselwurks.com | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head1 CONTRIBUTORS | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | Jason Stajich, jason@bioperl.org | ||||||||||||||||||||||||||||
| 64 | Jean-Marc Frigerio, Frigerio@pierroton.inra.fr | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head1 APPENDIX | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | The rest of the documentation details each of the object | ||||||||||||||||||||||||||||
| 69 | methods. Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =cut | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | # 'Let the code begin... | ||||||||||||||||||||||||||||
| 74 | # | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | package Bio::SeqIO::phd; | ||||||||||||||||||||||||||||
| 77 | 2 | $Bio::SeqIO::phd::VERSION = '1.7.8'; | |||||||||||||||||||||||||||
| 78 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 79 | 2 | ▶ | use Bio::Seq::SeqFactory; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 80 | 2 | ▶ | use Bio::Seq::RichSeq; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 81 | 2 | ▶ | use Bio::Annotation::Collection; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 82 | 2 | ▶ | use Bio::Annotation::Comment; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 83 | 2 | ▶ | use Dumpvalue; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 2 | my $dumper = Dumpvalue->new(); | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 2 | ▶ | use base qw(Bio::SeqIO); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 5 | ▶ | sub _initialize { | ||||||||||||||||||||||||||
|
Subroutine
_initialize: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 90 | 5 | my($self,@args) = @_; | |||||||||||||||||||||||||||
| 91 | 5 | $self->SUPER::_initialize(@args); | |||||||||||||||||||||||||||
| 92 | 5 | ▶ | if( ! defined $self->sequence_factory ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | 5 | $self->sequence_factory(Bio::Seq::SeqFactory->new | |||||||||||||||||||||||||||
| 94 | (-verbose => $self->verbose(), | ||||||||||||||||||||||||||||
| 95 | -type => 'Bio::Seq::Quality')); | ||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =head2 next_seq | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | Title : next_seq() | ||||||||||||||||||||||||||||
| 102 | Usage : $swq = $stream->next_seq() | ||||||||||||||||||||||||||||
| 103 | Function: returns the next phred sequence in the stream | ||||||||||||||||||||||||||||
| 104 | Returns : Bio::Seq::Quality object | ||||||||||||||||||||||||||||
| 105 | Args : NONE | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =cut | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 7 | ▶ | sub next_seq { | ||||||||||||||||||||||||||
|
Subroutine
next_seq: called CC=15 SCAR=27.1
Pod
documented
| |||||||||||||||||||||||||||||
| 110 | 7 | my ($self,@args) = @_; | |||||||||||||||||||||||||||
| 111 | 7 | my $seq; | |||||||||||||||||||||||||||
| 112 | 7 | ▶ | while (my $entry = $self->_readline) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 68 | chomp $entry; | |||||||||||||||||||||||||||
| 114 | 68 | ▶ | if ($entry =~ /^BEGIN_SEQUENCE\s+(\S+)/) { | ||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||
| 115 | 8 | ▶ | if (defined $seq) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | # done with current sequence | ||||||||||||||||||||||||||||
| 117 | 2 | $self->_pushback($entry); | |||||||||||||||||||||||||||
| 118 | 2 | last; | |||||||||||||||||||||||||||
| 119 | } else { | ||||||||||||||||||||||||||||
| 120 | # start new sequence | ||||||||||||||||||||||||||||
| 121 | 6 | my $id = $1; | |||||||||||||||||||||||||||
| 122 | 6 | $seq = $self->sequence_factory->create( | |||||||||||||||||||||||||||
| 123 | -id => $id, | ||||||||||||||||||||||||||||
| 124 | -primary_id => $id, | ||||||||||||||||||||||||||||
| 125 | -display_id => $id, | ||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | } elsif ($entry =~ /^BEGIN_COMMENT/) { | ||||||||||||||||||||||||||||
| 129 | 6 | my $collection = Bio::Annotation::Collection->new; | |||||||||||||||||||||||||||
| 130 | 6 | ▶ | while ($entry = $self->_readline) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | 82 | chomp $entry; | |||||||||||||||||||||||||||
| 132 | 82 | ▶ | if ($entry =~ /^(\w+):\s+(.+)$/) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 133 | 64 | my ($name, $content) = ($1, $2); | |||||||||||||||||||||||||||
| 134 | 64 | my $comment = Bio::Annotation::Comment->new( | |||||||||||||||||||||||||||
| 135 | -text => $content, | ||||||||||||||||||||||||||||
| 136 | -tagname => $name | ||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||
| 138 | 64 | $collection->add_Annotation('header',$comment); | |||||||||||||||||||||||||||
| 139 | } elsif ($entry =~ /^END_COMMENT/) { | ||||||||||||||||||||||||||||
| 140 | 6 | $seq->Bio::Seq::RichSeq::annotation($collection); | |||||||||||||||||||||||||||
| 141 | 6 | last; | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | } elsif ($entry =~ /^BEGIN_DNA/) { | ||||||||||||||||||||||||||||
| 145 | 6 | my $dna = ''; | |||||||||||||||||||||||||||
| 146 | 6 | my @qualities = (); | |||||||||||||||||||||||||||
| 147 | 6 | my @trace_indices = (); | |||||||||||||||||||||||||||
| 148 | 6 | ▶ | while ($entry = $self->_readline) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 5492 | chomp $entry; | |||||||||||||||||||||||||||
| 150 | 5492 | ▶ | if ( $entry =~ /(\S+)\s+(\S+)\s+(\S+)/ ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 151 | # add nucleotide and quality scores to sequence | ||||||||||||||||||||||||||||
| 152 | 5486 | $dna .= $1; | |||||||||||||||||||||||||||
| 153 | 5486 | push @qualities,$2; | |||||||||||||||||||||||||||
| 154 | 5486 | ▶ | push(@trace_indices,$3) if defined $3; # required for phd file | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | } elsif ($entry =~ /^END_DNA/) { | ||||||||||||||||||||||||||||
| 156 | # end of sequence, save it | ||||||||||||||||||||||||||||
| 157 | 6 | $seq->seq($dna); | |||||||||||||||||||||||||||
| 158 | 6 | $seq->qual(\@qualities); | |||||||||||||||||||||||||||
| 159 | 6 | $seq->trace(\@trace_indices); | |||||||||||||||||||||||||||
| 160 | 6 | last; | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | } elsif ($entry =~ /^END_SEQUENCE/) { | ||||||||||||||||||||||||||||
| 165 | # the sequence may be over, but some other info can come after | ||||||||||||||||||||||||||||
| 166 | 6 | next; | |||||||||||||||||||||||||||
| 167 | } elsif ($entry =~ /^WR\{/) { | ||||||||||||||||||||||||||||
| 168 | # Whole-Read items | ||||||||||||||||||||||||||||
| 169 | # Programs like Consed or Autofinish add it to phd file. See doc: | ||||||||||||||||||||||||||||
| 170 | # http://www.phrap.org/consed/distributions/README.16.0.txt | ||||||||||||||||||||||||||||
| 171 | #my ($type, $nane, $date, $time) = split(' ',$self->_readline); | ||||||||||||||||||||||||||||
| 172 | #my $extra_info = ''; | ||||||||||||||||||||||||||||
| 173 | #while ($entry = $self->_readline) { | ||||||||||||||||||||||||||||
| 174 | # chomp $entry; | ||||||||||||||||||||||||||||
| 175 | # last if ($entry =~ /\}/); | ||||||||||||||||||||||||||||
| 176 | # $extra_info .= $entry; | ||||||||||||||||||||||||||||
| 177 | #} | ||||||||||||||||||||||||||||
| 178 | ### fea: save WR somewhere? but where? | ||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | 7 | return $seq; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | =head2 write_header | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | Title : write_header() | ||||||||||||||||||||||||||||
| 188 | Usage : $seqio->write_header() | ||||||||||||||||||||||||||||
| 189 | Function: Write out the header (BEGIN_COMMENTS .. END_COMMENT) part of a phd file | ||||||||||||||||||||||||||||
| 190 | Returns : nothing | ||||||||||||||||||||||||||||
| 191 | Args : a Bio::Seq::Quality object | ||||||||||||||||||||||||||||
| 192 | Notes : These are the comments that reside in the header of a phd file | ||||||||||||||||||||||||||||
| 193 | at the present time. If not provided by the Bio::Seq::Quality object, | ||||||||||||||||||||||||||||
| 194 | the following default values will be used: | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | CHROMAT_FILE : $swq->id() | ||||||||||||||||||||||||||||
| 197 | ABI_THUMBPRINT : 0 | ||||||||||||||||||||||||||||
| 198 | PHRED_VERSION : 0.980904.e | ||||||||||||||||||||||||||||
| 199 | CALL_METHOD : phred | ||||||||||||||||||||||||||||
| 200 | QUALITY_LEVELS : 99 | ||||||||||||||||||||||||||||
| 201 | TIME : <current time> | ||||||||||||||||||||||||||||
| 202 | TRACE_ARRAY_MIN_INDEX : 0 | ||||||||||||||||||||||||||||
| 203 | TRACE_ARRAY_MAX_INDEX : unknown | ||||||||||||||||||||||||||||
| 204 | CHEM : unknown | ||||||||||||||||||||||||||||
| 205 | DYE : unknown | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | =cut | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 1 | ▶ | sub write_header { | ||||||||||||||||||||||||||
|
Subroutine
write_header: called CC=6 SCAR=18.2
Pod
documented
| |||||||||||||||||||||||||||||
| 210 | 1 | my ($self, $swq) = @_; | |||||||||||||||||||||||||||
| 211 | 1 | $self->_print("\nBEGIN_COMMENT\n\n"); | |||||||||||||||||||||||||||
| 212 | #defaults | ||||||||||||||||||||||||||||
| 213 | 1 | my $time = localtime(); | |||||||||||||||||||||||||||
| 214 | 1 | for ([CHROMAT_FILE =>$swq->attribute('CHROMAT_FILE')], | |||||||||||||||||||||||||||
| 215 | [ABI_THUMBPRINT => 0], | ||||||||||||||||||||||||||||
| 216 | [PHRED_VERSION => '0.980904.e'], | ||||||||||||||||||||||||||||
| 217 | [CALL_METHOD => 'phred'], | ||||||||||||||||||||||||||||
| 218 | [QUALITY_LEVELS => '99'], | ||||||||||||||||||||||||||||
| 219 | [TIME => $time], | ||||||||||||||||||||||||||||
| 220 | [TRACE_ARRAY_MIN_INDEX => 0], | ||||||||||||||||||||||||||||
| 221 | [TRACE_ARRAY_MAX_INDEX => 'unknown'], | ||||||||||||||||||||||||||||
| 222 | [CHEM => 'unknown'], | ||||||||||||||||||||||||||||
| 223 | [DYE => 'unknown']) | ||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||
| 225 | 10 | ▶ | $swq->attribute($_->[0],$_->[1]) unless $swq->attribute($_->[0]); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 1 | my @annot = $swq->annotation->get_Annotations('header'); | |||||||||||||||||||||||||||
| 229 | 1 | for (@annot) { | |||||||||||||||||||||||||||
| 230 | 10 | $self->_print($_->tagname,": ",$_->text,"\n"); | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | 1 | $self->_print("\nEND_COMMENT\n\n"); | |||||||||||||||||||||||||||
| 233 | 1 | ▶ | $self->flush if $self->_flush_on_write && defined $self->_fh; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->_flush_on_write and defined $self->_fh
MC/DC0%0/2
$self->_flush_on_write and defined $self->_fh
$self->_flush_on_write
defined $self->_fh
Truth table33%1/3
A and B
A= $self->_flush_on_writeB= defined $self->_fh
| |||||||||||||||||||||||||||||
| 234 | 1 | return 1; | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | =head2 write_seq | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | Title : write_seq() | ||||||||||||||||||||||||||||
| 240 | Usage : $seqio->write_seq($swq); | ||||||||||||||||||||||||||||
| 241 | Function: Write out a phd file. | ||||||||||||||||||||||||||||
| 242 | Returns : Nothing. | ||||||||||||||||||||||||||||
| 243 | Args : a Bio::Seq::Quality object | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | =cut | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 1 | ▶ | sub write_seq { | ||||||||||||||||||||||||||
|
Subroutine
write_seq: called CC=6 SCAR=18.8
Pod
documented
| |||||||||||||||||||||||||||||
| 248 | 1 | my ($self,$swq) = @_; | |||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 1 | ▶ | $self->throw("You must pass a Bio::Seq::Quality object to write_seq") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 251 | unless (ref($swq) eq "Bio::Seq::Quality"); | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 1 | ▶ | $self->throw("Can't create the phd because the sequence and the quality in the Quality object are of different lengths.") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 254 | unless $swq->length() ne 'DIFFERENT'; | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 1 | $self->_print("BEGIN_SEQUENCE ".$swq->id()."\n"); | |||||||||||||||||||||||||||
| 257 | 1 | $self->write_header($swq); | |||||||||||||||||||||||||||
| 258 | 1 | $self->_print("BEGIN_DNA\n"); | |||||||||||||||||||||||||||
| 259 | 1 | for my $curr(1 .. $swq->length()) { | |||||||||||||||||||||||||||
| 260 | 763 | $self->_print (sprintf("%s %s %s\n", | |||||||||||||||||||||||||||
| 261 | uc($swq->baseat($curr)), | ||||||||||||||||||||||||||||
| 262 | $swq->qualat($curr), | ||||||||||||||||||||||||||||
| 263 | $swq->trace_index_at($curr))); | ||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | 1 | $self->_print ("END_DNA\n\nEND_SEQUENCE\n"); | |||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | 1 | ▶ | $self->flush if $self->_flush_on_write && defined $self->_fh; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->_flush_on_write and defined $self->_fh
MC/DC0%0/2
$self->_flush_on_write and defined $self->_fh
$self->_flush_on_write
defined $self->_fh
Truth table33%1/3
A and B
A= $self->_flush_on_writeB= defined $self->_fh
| |||||||||||||||||||||||||||||
| 268 | 1 | return 1; | |||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | =head2 attribute | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | Title : attribute() | ||||||||||||||||||||||||||||
| 274 | Usage : swq->attribute(name[,value]); | ||||||||||||||||||||||||||||
| 275 | Function: Get/Set the name attribute. | ||||||||||||||||||||||||||||
| 276 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 277 | Args : a name or a pair name, value | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | =cut | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | 18 | ▶ | sub Bio::Seq::Quality::attribute { | ||||||||||||||||||||||||||
|
Subroutine
attribute: called CC=6 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 282 | 18 | my ($self, $name, $value) = @_; | |||||||||||||||||||||||||||
| 283 | 18 | my $collection = $self->annotation; | |||||||||||||||||||||||||||
| 284 | 18 | my @annot = $collection->get_Annotations('header'); | |||||||||||||||||||||||||||
| 285 | 18 | my %attribute; | |||||||||||||||||||||||||||
| 286 | my $annot; | ||||||||||||||||||||||||||||
| 287 | 18 | for (@annot) { | |||||||||||||||||||||||||||
| 288 | 180 | $attribute{$_->tagname} = $_->display_text; | |||||||||||||||||||||||||||
| 289 | 180 | ▶ | $annot = $_ if $_->tagname eq $name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 18 | ▶ | unless (defined $attribute{$name}) { #new comment | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 294 | 0 | ▶ | my $comment = | ||||||||||||||||||||||||||
|
Condition0%0/2
$value || 'unknown'
MC/DC0%0/1
$value || 'unknown'
$value
Truth table0%0/2
A
A= $value
| |||||||||||||||||||||||||||||
| 295 | Bio::Annotation::Comment->new(-text => $value || 'unknown'); | ||||||||||||||||||||||||||||
| 296 | 0 | $comment->tagname($name); | |||||||||||||||||||||||||||
| 297 | 0 | $collection->add_Annotation('header',$comment); | |||||||||||||||||||||||||||
| 298 | 0 | return; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | 18 | ▶ | return $attribute{$name} unless (defined $value);#get | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | #print "ATTRIBUTE ",$annot," $name $attribute{$name}\n"; | ||||||||||||||||||||||||||||
| 304 | 4 | $annot->text($value); #set | |||||||||||||||||||||||||||
| 305 | 4 | return; | |||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | =head2 chromat_file | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | Title : chromat_file | ||||||||||||||||||||||||||||
| 312 | Usage : swq->chromat_file([filename]); | ||||||||||||||||||||||||||||
| 313 | Function: Get/Set the CHROMAT_FILE attribute. | ||||||||||||||||||||||||||||
| 314 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 315 | Args : none or a filename | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | =cut | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 3 | ▶ | sub Bio::Seq::Quality::chromat_file { | ||||||||||||||||||||||||||
|
Subroutine
chromat_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 320 | 3 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 321 | 3 | return $self->attribute('CHROMAT_FILE',$arg); | |||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | =head2 abi_thumbprint | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | Title : abi_thumbprint | ||||||||||||||||||||||||||||
| 327 | Usage : swq->abi_thumbprint([value]); | ||||||||||||||||||||||||||||
| 328 | Function: Get/Set the ABI_THUMBPRINT attribute. | ||||||||||||||||||||||||||||
| 329 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 330 | Args : none or a value | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | =cut | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | 0 | ▶ | sub Bio::Seq::Quality::abi_thumbprint { | ||||||||||||||||||||||||||
|
Subroutine
abi_thumbprint: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 335 | 0 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 336 | 0 | return $self->attribute('ABI_THUMBPRINT',$arg); | |||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | =head2 phred_version | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | Title : phred_version | ||||||||||||||||||||||||||||
| 342 | Usage : swq->phred_version([value]); | ||||||||||||||||||||||||||||
| 343 | Function: Get/Set the PHRED_VERSION attribute. | ||||||||||||||||||||||||||||
| 344 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 345 | Args : none or a value | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | =cut | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | 0 | ▶ | sub Bio::Seq::Quality::phred_version { | ||||||||||||||||||||||||||
|
Subroutine
phred_version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 351 | 0 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 352 | 0 | return $self->attribute('PHRED_VERSION', $arg); | |||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | =head2 call_method | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | Title : call_method | ||||||||||||||||||||||||||||
| 359 | Usage : swq->call_method([value]); | ||||||||||||||||||||||||||||
| 360 | Function: Get/Set the CALL_METHOD attribute. | ||||||||||||||||||||||||||||
| 361 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 362 | Args : none or a value | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | =cut | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | 0 | ▶ | sub Bio::Seq::Quality::call_method { | ||||||||||||||||||||||||||
|
Subroutine
call_method: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 367 | 0 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 368 | 0 | return $self->attribute('CALL_METHOD', $arg); | |||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | =head2 quality_levels | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | Title : quality_levels | ||||||||||||||||||||||||||||
| 374 | Usage : swq->quality_levels([value]); | ||||||||||||||||||||||||||||
| 375 | Function: Get/Set the quality_levels attribute. | ||||||||||||||||||||||||||||
| 376 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 377 | Args : none or a value | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | =cut | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | 1 | ▶ | sub Bio::Seq::Quality::quality_levels { | ||||||||||||||||||||||||||
|
Subroutine
quality_levels: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 382 | 1 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 383 | 1 | return $self->attribute('QUALITY_LEVELS', $arg); | |||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | =head2 trace_array_min_index | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | Title : trace_array_min_index | ||||||||||||||||||||||||||||
| 389 | Usage : swq->trace_array_min_index([value]); | ||||||||||||||||||||||||||||
| 390 | Function: Get/Set the trace_array_min_index attribute. | ||||||||||||||||||||||||||||
| 391 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 392 | Args : none or a value | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | =cut | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | 0 | ▶ | sub Bio::Seq::Quality::trace_array_min_index { | ||||||||||||||||||||||||||
|
Subroutine
trace_array_min_index: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 397 | 0 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 398 | 0 | return $self->attribute('TRACE_ARRAY_MIN_INDEX', $arg); | |||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | =head2 trace_array_max_index | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | Title : trace_array_max_index | ||||||||||||||||||||||||||||
| 404 | Usage : swq->trace_array_max_index([value]); | ||||||||||||||||||||||||||||
| 405 | Function: Get/Set the trace_array_max_index attribute. | ||||||||||||||||||||||||||||
| 406 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 407 | Args : none or a value | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | =cut | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | 0 | ▶ | sub Bio::Seq::Quality::trace_array_max_index { | ||||||||||||||||||||||||||
|
Subroutine
trace_array_max_index: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 412 | 0 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 413 | 0 | return $self->attribute('TRACE_ARRAY_MAX_INDEX', $arg); | |||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | =head2 chem | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | Title : chem | ||||||||||||||||||||||||||||
| 419 | Usage : swq->chem([value]); | ||||||||||||||||||||||||||||
| 420 | Function: Get/Set the chem attribute. | ||||||||||||||||||||||||||||
| 421 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 422 | Args : none or a value | ||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | =cut | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 0 | ▶ | sub Bio::Seq::Quality::chem { | ||||||||||||||||||||||||||
|
Subroutine
chem: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 427 | 0 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 428 | 0 | return $self->attribute('CHEM', $arg); | |||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | =head2 dye | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | Title : dye | ||||||||||||||||||||||||||||
| 434 | Usage : swq->dye([value]); | ||||||||||||||||||||||||||||
| 435 | Function: Get/Set the dye attribute. | ||||||||||||||||||||||||||||
| 436 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 437 | Args : none or a value | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | =cut | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | 0 | ▶ | sub Bio::Seq::Quality::dye { | ||||||||||||||||||||||||||
|
Subroutine
dye: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 442 | 0 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 443 | 0 | return $self->attribute('DYE', $arg); | |||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | =head2 time | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | Title : time | ||||||||||||||||||||||||||||
| 449 | Usage : swq->time([value]); | ||||||||||||||||||||||||||||
| 450 | Function: Get/Set the time attribute. | ||||||||||||||||||||||||||||
| 451 | Returns : a string if 1 param, nothing else. | ||||||||||||||||||||||||||||
| 452 | Args : none or a value | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | =cut | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | 0 | ▶ | sub Bio::Seq::Quality::time { | ||||||||||||||||||||||||||
|
Subroutine
time: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 457 | 0 | my ($self,$arg) = @_; | |||||||||||||||||||||||||||
| 458 | 0 | return $self->attribute('TIME', $arg); | |||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||
| 461 | =head2 touch | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | Title : touch | ||||||||||||||||||||||||||||
| 464 | Usage : swq->touch(); | ||||||||||||||||||||||||||||
| 465 | Function: Set the time attribute to current time. | ||||||||||||||||||||||||||||
| 466 | Returns : nothing | ||||||||||||||||||||||||||||
| 467 | Args : none | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | =cut | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | 1 | ▶ | sub Bio::Seq::Quality::touch { | ||||||||||||||||||||||||||
|
Subroutine
touch: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 472 | 1 | my $time = localtime(); | |||||||||||||||||||||||||||
| 473 | 1 | shift->attribute('TIME',$time); | |||||||||||||||||||||||||||
| 474 | 1 | return; | |||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | 2 | 1; | |||||||||||||||||||||||||||