Bio::FeatureIO
vecscreen_simple
Toolbar
Summary
Bio::FeatureIO::vecscreen_simple - read/write features from NCBI vecscreen -f 3
output
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
# read features
my $fin = Bio::FeatureIO->new(-file=>'vecscreen.out',
-format=>'vecscreen_simple');
my @vec_regions;
while (my $f = $fin->next_feature) {
push @vec_regions, $f;
}
# write features NOT IMPLEMENTED
Description
vecscreen is a system for quickly identifying segments of a nucleic
acid sequence that may be of vector origin. NCBI developed vecscreen
to minimize the incidence and impact of vector contamination in public
sequence databases. GenBank Annotation Staff use vecscreen to verify
that sequences submitted for inclusion in the database are free from
contaminating vector sequence. Any sequence can be screened for vector
contamination using vecscreen.
This module provides parsing for vecscreen '-f 3' output, described in
the vecscreen documentation as 'Text list, no alignments'
Methods
Methods description
Title : _initialize Function: Reading? parses the header of the input Writing? |
Title : next_feature Usage : $io->next_feature() Function: read the next feature from the vecscreen output file Args : none Returns : Bio::SeqFeatureI object |
Title : write_feature Usage : $io->write_feature($feature) Function: write a Bio::SeqFeatureI object in vecscreen -f 3 format Example : Args : Bio::SeqFeatureI object Returns : |
Methods code
sub _initialize
{ my($self,%arg) = @_;
$self->SUPER::_initialize(%arg);
if ($self->mode eq 'r') {
$self->{parse_state}->{seqname} = '';
$self->{parse_state}->{matchtype} = '';
}
else {
$self->throw('vecscreen_simple feature writing not implemented');
}} |
sub next_feature
{ my $self = shift;
return unless $self->mode eq 'r';
while ( my $line = $self->_readline() ) {
chomp $line;
if ( $line =~ /^>Vector (\S+)/ ) {
$self->{parse_state}{seqname} = $1;
} elsif ( $line =~ /^\s*WARNING/ ) {
$self->warn("$self->{parse_state}{seqname}: vecscreen says: $line\n");
} elsif ( $line =~ /\S/ ) {
$self->{parse_state}{seqname}
or $self->throw("Unexpected line in vecscreen output '$line'");
my $lcline = lc $line;
if ( $line =~ /^(\d+)\s+(\d+)\s*$/ ) {
my ($s,$e) = ($1,$2);
my $matchtype = $self->{parse_state}{matchtype};
$matchtype =~ s/\s/_/g; return Bio::SeqFeature::Generic->new( -start => $s,
-end => $e,
-primary => $matchtype,
-seq_id => $self->{parse_state}{seqname},
);
} elsif ( $lcline eq 'no hits found' ) {
$self->{parse_state}{seqname} = '';
} elsif ( grep $lcline eq $_, 'strong match', 'moderate match', 'weak match', 'suspect origin') {
$self->{parse_state}{matchtype} = $lcline;
} else {
$self->throw("Parse error. Expected a match type or coordinate line but got '$line'");
}
} else {
$self->{parse_state}{seqname} = ''; $self->{parse_state}{matchtype} = '';
}
}
return; } |
sub write_feature
{ shift->throw_not_implemented;
}
1;
} |
General documentation
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via
the web:
https://redmine.open-bio.org/projects/bioperl/
Email rmb32 AT cornell.edu
Based on ptt.pm by Torsten Seeman
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _