5
Bio::FeatureIO::vecscreen_simple - read/write features from NCBI vecscreen -f 3
11
my $fin = Bio::FeatureIO->new(-file=>'vecscreen.out',
12
-format=>'vecscreen_simple');
14
while (my $f = $fin->next_feature) {
15
push @vec_regions, $f;
18
# write features NOT IMPLEMENTED
22
vecscreen is a system for quickly identifying segments of a nucleic
23
acid sequence that may be of vector origin. NCBI developed vecscreen
24
to minimize the incidence and impact of vector contamination in public
25
sequence databases. GenBank Annotation Staff use vecscreen to verify
26
that sequences submitted for inclusion in the database are free from
27
contaminating vector sequence. Any sequence can be screened for vector
28
contamination using vecscreen.
30
This module provides parsing for vecscreen '-f 3' output, described in
31
the vecscreen documentation as 'Text list, no alignments'
37
User feedback is an integral part of the evolution of this and other
38
Bioperl modules. Send your comments and suggestions preferably to
39
the Bioperl mailing list. Your participation is much appreciated.
41
bioperl-l@bioperl.org - General discussion
42
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
46
Please direct usage questions or support issues to the mailing list:
48
I<bioperl-l@bioperl.org>
50
rather than to the module maintainer directly. Many experienced and
51
reponsive experts will be able look at the problem and quickly
52
address it. Please include a thorough description of the problem
53
with code and data examples if at all possible.
57
Report bugs to the Bioperl bug tracking system to help us keep track
58
of the bugs and their resolution. Bug reports can be submitted via
61
https://redmine.open-bio.org/projects/bioperl/
63
=head1 AUTHOR - Robert Buels
65
Email rmb32 AT cornell.edu
69
Based on ptt.pm by Torsten Seeman
73
The rest of the documentation details each of the object methods.
74
Internal methods are usually preceded with a _
78
# Let the code begin...
80
package Bio::FeatureIO::vecscreen_simple;
83
use base qw(Bio::FeatureIO);
84
use Bio::SeqFeature::Generic;
89
Function: Reading? parses the header of the input
97
$self->SUPER::_initialize(%arg);
99
if ($self->mode eq 'r') {
100
$self->{parse_state}->{seqname} = '';
101
$self->{parse_state}->{matchtype} = '';
104
$self->throw('vecscreen_simple feature writing not implemented');
111
Usage : $io->next_feature()
112
Function: read the next feature from the vecscreen output file
114
Returns : Bio::SeqFeatureI object
120
return unless $self->mode eq 'r'; # returns if can't read next_feature when we're in write mode
122
while ( my $line = $self->_readline() ) {
124
if ( $line =~ /^>Vector (\S+)/ ) {
125
$self->{parse_state}{seqname} = $1;
126
} elsif ( $line =~ /^\s*WARNING/ ) {
127
$self->warn("$self->{parse_state}{seqname}: vecscreen says: $line\n");
128
} elsif ( $line =~ /\S/ ) {
130
$self->{parse_state}{seqname}
131
or $self->throw("Unexpected line in vecscreen output '$line'");
133
#if it's not a vector line, it should be either a match type or
135
my $lcline = lc $line;
137
if ( $line =~ /^(\d+)\s+(\d+)\s*$/ ) {
138
my ($s,$e) = ($1,$2);
140
my $matchtype = $self->{parse_state}{matchtype};
141
$matchtype =~ s/\s/_/g; #replace whitespace with underscores for the primary tag
142
return Bio::SeqFeature::Generic->new( -start => $s,
144
-primary => $matchtype,
145
-seq_id => $self->{parse_state}{seqname},
147
} elsif ( $lcline eq 'no hits found' ) {
148
$self->{parse_state}{seqname} = '';
149
} elsif ( grep $lcline eq $_, 'strong match', 'moderate match', 'weak match', 'suspect origin') {
150
$self->{parse_state}{matchtype} = $lcline;
152
$self->throw("Parse error. Expected a match type or coordinate line but got '$line'");
155
#blank line, ignore it and reset parser
157
$self->{parse_state}{seqname} = ''; #< a line with whitespace
158
#indicates a boundary
161
$self->{parse_state}{matchtype} = '';
168
=head2 write_feature (NOT IMPLEMENTED)
170
Title : write_feature
171
Usage : $io->write_feature($feature)
172
Function: write a Bio::SeqFeatureI object in vecscreen -f 3 format
174
Args : Bio::SeqFeatureI object
180
shift->throw_not_implemented;