view release on metacpan or search on metacpan
Bio/DB/GFF/Feature.pm view on Meta::CPAN
$self->{stop} = $high
if (!defined($self->{stop})) || $high > $self->{stop};
} else {
$self->{start} = $high
if (!defined($self->{start})) || $high > $self->{start};
$self->{stop} = $low
if (!defined($self->{stop})) || $low < $self->{stop};
}
}
# fix up endpoints of targets too (for homologies only)
my $h = $feat->group;
next unless $h && $h->isa('Bio::DB::GFF::Homol');
next unless $g && $g->isa('Bio::DB::GFF::Homol');
($start,$stop) = ($h->{start},$h->{stop});
if ($shrink && !$tfirst++) {
$g->{start} = $start;
$g->{stop} = $stop;
} else {
if ($start <= $stop) {
Bio/DB/GFF/Feature.pm view on Meta::CPAN
sub gff_string {
my $self = shift;
my $version = $self->version;
# gff3_string and gff_string are synonymous if the version is set to 3
return $self->gff3_string(@_) if $version == 3;
my ($start,$stop) = ($self->start,$self->stop);
# the defined() tests prevent uninitialized variable warnings, when dealing with clone objects
# whose endpoints may be undefined
($start,$stop) = ($stop,$start) if defined($start) && defined($stop) && $start > $stop;
my ($class,$name) = ('','');
my $strand = ('-','.','+')[$self->strand+1];
my @group;
if (my $t = $self->target) {
push @group, $version == 2.5 ? $self->flatten_target($t,2.5)
: $self->flatten_target($t);
Bio/DB/GFF/Feature.pm view on Meta::CPAN
Status : Public
=cut
sub gff3_string {
my $self = shift;
my ($recurse,$parent) = @_;
my ($start,$stop) = ($self->start,$self->stop);
# the defined() tests prevent uninitialized variable warnings, when dealing with clone objects
# whose endpoints may be undefined
($start,$stop) = ($stop,$start) if defined($start) && defined($stop) && $start > $stop;
my $strand = ('-','.','+')[$self->strand+1];
my $ref = $self->refseq;
my $n = ref($ref) ? $ref->name : $ref;
my $phase = $self->phase;
$phase = '.' unless defined $phase;
my ($class,$name) = ('','');
my @group;
Bio/DB/SeqFeature/Store.pm view on Meta::CPAN
This method fetches features based on a location range lookup. You
call it using a positional list of arguments, or a list of
(-argument=E<gt>$value) pairs.
The positional form is as follows:
$db->get_features_by_location($seqid [[,$start,]$end])
The $seqid is the name of the sequence on which the feature resides,
and start and end are optional endpoints for the match. If the
endpoints are missing then any feature on the indicated seqid is
returned.
Examples:
get_features_by_location('chr1'); # all features on chromosome 1
get_features_by_location('chr1',5000); # features between 5000 and the end
get_features_by_location('chr1',5000,8000); # features between 5000 and 8000
Location lookups are overlapping. A feature will be returned if it
partially or completely overlaps the indicated range.
Bio/DB/SeqFeature/Store.pm view on Meta::CPAN
-range_type Type of range to search over
The B<-strand> argument, if present, can be one of "0" to find
features that are on both strands, "+1" to find only plus strand
features, and "-1" to find only minus strand features. Specifying a
strand of undef is the same as not specifying this argument at all,
and retrieves all features regardless of their strandedness.
The B<-range_type> argument, if present, can be one of "overlaps" (the
default), to find features whose positions overlap the indicated
range, "contains," to find features whose endpoints are completely
contained within the indicated range, and "contained_in" to find
features whose endpoints are both outside the indicated range.
=cut
sub get_features_by_location {
my $self = shift;
my ($seqid,$start,$end,$strand,$rangetype) =
rearrange([['SEQ_ID','SEQID','REF'],'START',['STOP','END'],'STRAND','RANGE_TYPE'],@_);
$self->_features(-seqid=>$seqid,
-start=>$start||undef,
-end=>$end||undef,
Bio/DB/SeqFeature/Store.pm view on Meta::CPAN
Title : segment
Usage : $segment = $db->segment($seq_id [,$start] [,$end] [,$absolute])
Function: restrict the database to a sequence range
Returns : a Bio::DB::SeqFeature::Segment object
Args : sequence id, start and end ranges (optional)
Status : public
This is a convenience method that can be used when you are interested
in the contents of a particular sequence landmark, such as a
contig. Specify the ID of a sequence or other landmark in the database
and optionally a start and endpoint relative to that landmark. The
method will look up the region and return a
Bio::DB::SeqFeature::Segment object that spans it. You can then use
this segment object to make location-restricted queries on the database.
Example:
$segment = $db->segment('contig23',1,1000); # first 1000 bp of contig23
my @mRNAs = $segment->features('mRNA'); # all mRNAs that overlap segment
Although you will usually want to fetch segments that correspond to
Bio/DB/SeqFeature/Store/GFF3Loader.pm view on Meta::CPAN
# contiguous feature, so add a segment
warn $old_feat if defined $old_feat and !ref $old_feat;
if (defined $old_feat) {
# set this to 1 to disable split-location behavior
if (0 && @parent_ids) { # If multiple features are held together by the same ID
$feature_id = $ld->{TemporaryID}++; # AND they have a Parent attribute, this causes an undesirable
} # additional layer of aggregation. Changing the ID fixes this.
elsif (
$old_feat->seq_id ne $refname ||
$old_feat->start != $start ||
$old_feat->end != $end # make sure endpoints are distinct
)
{
$self->add_segment($old_feat,$self->sfclass->new(@args));
return;
}
}
# we get here if this is a new feature
# first of all, store the current feature if it is there
$self->store_current_feature() if defined $ld->{CurrentID};
Bio/Location/Atomic.pm view on Meta::CPAN
sub start_pos_type {
my($self) = @_;
return 'EXACT';
}
=head2 min_end
Title : min_end
Usage : my $minend = $location->min_end();
Function: Get minimum ending location of feature endpoint
Returns : integer or undef if no minimum ending point.
Args : none
=cut
sub min_end {
my($self,$value) = @_;
if(defined($value)) {
$self->{'_end'} = $value;
}
return $self->{'_end'};
}
=head2 max_end
Title : max_end
Usage : my $maxend = $location->max_end();
Function: Get maximum ending location of feature endpoint
In this implementation this is exactly the same as min_end().
Returns : integer or undef if no maximum ending point.
Args : none
=cut
sub max_end {
my($self,@args) = @_;
Bio/Location/Fuzzy.pm view on Meta::CPAN
if(defined($value)) {
$self->{'_start_pos_type'} = $value;
}
return $self->{'_start_pos_type'};
}
=head2 min_end
Title : min_end
Usage : my $minend = $location->min_end();
Function: Get/set minimum ending location of feature endpoint
Returns : integer or undef if no minimum ending point.
Args : integer or undef on set
=cut
sub min_end {
my ($self,@args) = @_;
if(@args) {
$self->{'_min_end'} = $args[0]; # the value may be undef!
}
return $self->{'_min_end'};
}
=head2 max_end
Title : max_end
Usage : my $maxend = $location->max_end();
Function: Get/set maximum ending location of feature endpoint
Returns : integer or undef if no maximum ending point.
Args : integer or undef on set
=cut
sub max_end {
my ($self,@args) = @_;
if(@args) {
$self->{'_max_end'} = $args[0]; # the value may be undef!
Bio/Location/Fuzzy.pm view on Meta::CPAN
=cut
=head2 _fuzzypointdecode
Title : _fuzzypointdecode
Usage : ($type,$min,$max) = $self->_fuzzypointdecode('<5');
Function: Decode a fuzzy string.
Returns : A 3-element array consisting of the type of location, the
minimum integer, and the maximum integer describing the range
of coordinates this start or endpoint refers to. Minimum or
maximum coordinate may be undefined.
: Returns empty array on fail.
Args : fuzzypoint string
=cut
sub _fuzzypointdecode {
my ($self, $string) = @_;
return () if( !defined $string);
# strip off leading and trailing space
Bio/Location/FuzzyLocationI.pm view on Meta::CPAN
Returns : type of position coded as text
('BEFORE', 'AFTER', 'EXACT','WITHIN', 'BETWEEN')
Args : none
=cut
=head2 min_end
Title : min_end
Usage : my $minend = $location->min_end();
Function: Get minimum ending location of feature endpoint
Returns : integer or undef if no minimum ending point.
Args : none
=cut
=head2 max_end
Title : max_end
Usage : my $maxend = $location->max_end();
Function: Get maximum ending location of feature endpoint
Returns : integer or undef if no maximum ending point.
Args : none
=cut
=head2 end_pos_type
Title : end_pos_type
Usage : my $end_pos_type = $location->end_pos_type();
Function: Get end position type (ie <,>, ^)
Bio/Location/Simple.pm view on Meta::CPAN
Returns : type of position coded as text
('BEFORE', 'AFTER', 'EXACT','WITHIN', 'BETWEEN')
Args : none
=cut
=head2 min_end
Title : min_end
Usage : my $minend = $location->min_end();
Function: Get minimum ending location of feature endpoint
Returns : integer or undef if no minimum ending point.
Args : none
=cut
=head2 max_end
Title : max_end
Usage : my $maxend = $location->max_end();
Function: Get maximum ending location of feature endpoint
In this implementation this is exactly the same as min_end().
Returns : integer or undef if no maximum ending point.
Args : none
=cut
=head2 end_pos_type
Bio/Location/Split.pm view on Meta::CPAN
# (like "join(2006035..2007700,1..257)"). Sorting is user responsability.
# Assume Start to be 1st segment start and End to be last segment End.
my @locs = $self->sub_Location(0);
return ( @locs ) ? $locs[0]->start_pos_type : undef;
}
=head2 min_end
Title : min_end
Usage : my $minend = $location->min_end();
Function: Get minimum ending location of feature endpoint
Returns : integer or undef if no minimum ending point.
Args : none
=cut
sub min_end {
my ($self,$value) = @_;
if( defined $value ) {
$self->throw( "Trying to set the minimum end point of a split location, "
Bio/Location/Split.pm view on Meta::CPAN
@same_id_locs = ($first_id ? grep { $_->seq_id eq $first_id } @locs
: @locs);
}
return ( @same_id_locs ) ? $same_id_locs[-1]->min_end : undef;
}
=head2 max_end
Title : max_end
Usage : my $maxend = $location->max_end();
Function: Get maximum ending location of feature endpoint
Returns : integer or undef if no maximum ending point.
Args : none
=cut
sub max_end {
my ($self,$value) = @_;
if( defined $value ) {
$self->throw( "Trying to set the maximum end point of a split location, "
Bio/Location/SplitLocationI.pm view on Meta::CPAN
Returns : type of position coded as text
('BEFORE', 'AFTER', 'EXACT','WITHIN', 'BETWEEN')
Args : none
=cut
=head2 min_end
Title : min_end
Usage : my $minend = $location->min_end();
Function: Get minimum ending location of feature endpoint
Returns : integer or undef if no minimum ending point.
Args : none
=cut
=head2 max_end
Title : max_end
Usage : my $maxend = $location->max_end();
Function: Get maximum ending location of feature endpoint
Returns : integer or undef if no maximum ending point.
Args : none
=cut
=head2 end_pos_type
Title : end_pos_type
Usage : my $end_pos_type = $location->end_pos_type();
Function: Get end position type (ie <,>, ^)
Bio/Search/HSP/BlastHSP.pm view on Meta::CPAN
The resulting BlastHSPs are then accessed via
L<Bio::Search::Hit::BlastHit>). Therefore, you do not need to
use L<Bio::Search::HSP::BlastHSP>) directly. If you need to construct
BlastHSPs directly, see the new() function for details.
For L<Bio::SearchIO> BLAST parsing usage examples, see the
C<examples/searchio> directory of the Bioperl distribution.
=head2 Start and End coordinates
Sequence endpoints are swapped so that start is always less than
end. This affects For TBLASTN/X hits on the minus strand. Strand
information can be recovered using the strand() method. This
normalization step is standard Bioperl practice. It also facilitates
use of range information by methods such as match().
=over 1
=item * Supports BLAST versions 1.x and 2.x, gapped and ungapped.
=back
Bio/Search/HSP/BlastHSP.pm view on Meta::CPAN
Purpose : Sets sequence information for both the query and sbjct sequences.
: Directly counts the number of gaps in each sequence (if gapped Blast).
Argument : $seq_type = 'query' or 'sbjct'
: @data = all seq lines with the form:
: Query: 61 SPHNVKDRKEQNGSINNAISPTATANTSGSQQINIDSALRDRSSNVAAQPSLSDASSGSN 120
Throws : Exception if data strings cannot be parsed, probably due to a change
: in the Blast report format.
Comments : Uses first argument to determine which data members to set
: making this method sensitive data member name changes.
: Behavior is dependent on the type of BLAST analysis (TBLASTN, BLASTP, etc).
Warning : Sequence endpoints are normalized so that start < end. This affects HSPs
: for TBLASTN/X hits on the minus strand. Normalization facilitates use
: of range information by methods such as match().
See Also : L</_set_seq_data>, L</matches>, L</range>, L</start>, L</end>
=cut
#-------------
sub _set_seq {
#-------------
Bio/Search/HSP/BlastHSP.pm view on Meta::CPAN
$self->{$seqType.'Length'} /= 3;
} elsif($prog eq 'BLASTX' and $seqType eq '_query') {
$self->{$seqType.'Length'} /= 3;
} elsif($prog eq 'TBLASTX') {
$self->{$seqType.'Length'} /= 3;
}
if( $prog ne 'BLASTP' ) {
$self->{$seqType.'Strand'} = 'Plus' if $prog =~ /BLASTN/;
$self->{$seqType.'Strand'} = 'Plus' if ($prog =~ /BLASTX/ and $seqType eq '_query');
# Normalize sequence endpoints so that start < end.
# Reverse complement or 'minus strand' HSPs get flipped here.
if($self->{$seqType.'Start'} > $self->{$seqType.'Stop'}) {
($self->{$seqType.'Start'}, $self->{$seqType.'Stop'}) =
($self->{$seqType.'Stop'}, $self->{$seqType.'Start'});
$self->{$seqType.'Strand'} = 'Minus';
}
}
## Count number of gaps in each seq. Only need to do this for gapped Blasts.
# if($self->{'_gapped'}) {
Bio/Search/HSP/GenericHSP.pm view on Meta::CPAN
sub _calculate_seq_positions {
my ($self,@args) = @_;
return unless ( $self->{'_sequenceschanged'} );
$self->{'_sequenceschanged'} = 0;
my ($seqString, $qseq,$sseq) = ( $self->homology_string(),
$self->query_string(),
$self->hit_string() );
my ($mlen, $qlen, $slen) = (CORE::length($seqString), CORE::length($qseq), CORE::length($sseq));
my $qdir = $self->query->strand || 1;
my $sdir = $self->hit->strand || 1;
my ($resCount_query, $endpoint_query) = ($qdir <=0) ? ($self->query->end, $self->query->start)
: ($self->query->start, $self->query->end);
my ($resCount_sbjct, $endpoint_sbjct) = ($sdir <=0) ? ($self->hit->end, $self->hit->start)
: ($self->hit->start, $self->hit->end);
my $prog = $self->algorithm;
if( $prog =~ /FAST|SSEARCH|SMITH-WATERMAN/i ) {
# we infer the end of the regional sequence where the first and last
# non spaces are in the homology string
# then we use the HSP->length to tell us how far to read
# to cut off the end of the sequence
Bio/Search/HSP/PsiBlastHSP.pm view on Meta::CPAN
L<Bio::Search::Hit::BlastHit>). Therefore, you do not need to
use L<Bio::Search::HSP::PsiBlastHSP>) directly. If you need to construct
PsiBlastHSPs directly, see the new() function for details.
For L<Bio::SearchIO> BLAST parsing usage examples, see the
C<examples/search-blast> directory of the Bioperl distribution.
=head2 Start and End coordinates
Sequence endpoints are swapped so that start is always less than
end. This affects For TBLASTN/X hits on the minus strand. Strand
information can be recovered using the strand() method. This
normalization step is standard Bioperl practice. It also facilitates
use of range information by methods such as match().
=over 1
=item * Supports BLAST versions 1.x and 2.x, gapped and ungapped.
=back
Bio/Search/HSP/PsiBlastHSP.pm view on Meta::CPAN
Purpose : Sets sequence information for both the query and sbjct sequences.
: Directly counts the number of gaps in each sequence (if gapped Blast).
Argument : $seq_type = 'query' or 'sbjct'
: @data = all seq lines with the form:
: Query: 61 SPHNVKDRKEQNGSINNAISPTATANTSGSQQINIDSALRDRSSNVAAQPSLSDASSGSN 120
Throws : Exception if data strings cannot be parsed, probably due to a change
: in the Blast report format.
Comments : Uses first argument to determine which data members to set
: making this method sensitive data member name changes.
: Behavior is dependent on the type of BLAST analysis (TBLASTN, BLASTP, etc).
Warning : Sequence endpoints are normalized so that start < end. This affects HSPs
: for TBLASTN/X hits on the minus strand. Normalization facilitates use
: of range information by methods such as match().
See Also : L</_set_seq_data>, L</matches>, L</range>, L</start>, L</end>
=cut
#-------------
sub _set_seq {
#-------------
Bio/Search/HSP/PsiBlastHSP.pm view on Meta::CPAN
$self->{$seqType.'Length'} /= 3;
} elsif($prog eq 'BLASTX' and $seqType eq '_query') {
$self->{$seqType.'Length'} /= 3;
} elsif($prog eq 'TBLASTX') {
$self->{$seqType.'Length'} /= 3;
}
if( $prog ne 'BLASTP' ) {
$self->{$seqType.'Strand'} = 'Plus' if $prog =~ /BLASTN/;
$self->{$seqType.'Strand'} = 'Plus' if ($prog =~ /BLASTX/ and $seqType eq '_query');
# Normalize sequence endpoints so that start < end.
# Reverse complement or 'minus strand' HSPs get flipped here.
if($self->{$seqType.'Start'} > $self->{$seqType.'Stop'}) {
($self->{$seqType.'Start'}, $self->{$seqType.'Stop'}) =
($self->{$seqType.'Stop'}, $self->{$seqType.'Start'});
$self->{$seqType.'Strand'} = 'Minus';
}
}
## Count number of gaps in each seq. Only need to do this for gapped Blasts.
# if($self->{'_gapped'}) {
Bio/Search/Tiling/MapTileUtils.pm view on Meta::CPAN
=cut
### what if the input intervals don't overlap?? They MUST overlap; that's
### what interval_tiling() is for.
sub decompose_interval {
return unless $_[0]; # no input
my @ints = @{$_[0]};
my (%flat,@flat);
### this is ok, but need to handle the case where a lh and rh endpoint
### coincide...
# decomposition --
# flatten:
# every lh endpoint generates (lh-1, lh)
# every rh endpoint generates (rh, rh+)
foreach (@ints) {
$flat{$$_[0]-1}++;
$flat{$$_[0]}++;
$flat{$$_[1]}++;
$flat{$$_[1]+1}++;
}
# sort, create singletons if nec.
my @a;
@a = sort {$a<=>$b} keys %flat;
# throw out first and last (meeting a boundary condition)
Bio/Search/Tiling/MapTiling.pm view on Meta::CPAN
my $c = $self->mapping($type);
# create the possible maps
for my $context ($self->contexts($type)) {
@map = ();
@hsps = ($self->hsps)[$self->contexts($type, $context)];
@intervals = get_intervals_from_hsps( $type, @hsps );
# the "frame"
my $f = ($intervals[0]->[0] - 1) % $c;
# convert interval endpoints...
for (@intervals) {
$$_[0] = ($$_[0] - $f + $c - 1)/$c;
$$_[1] = ($$_[1] - $f)/$c;
}
# determine the minimal set of disjoint intervals that cover the
# set of hsp intervals
my @dj_set = interval_tiling(\@intervals);
# decompose each disjoint interval into another set of disjoint
Bio/SeqFeature/Lite.pm view on Meta::CPAN
=over 4
=item url()
Get/set the URL that the graphical rendering of this feature will link to.
=item add_segment(@segments)
Add one or more segments (a subfeature). Segments can either be
Feature objects, or [start,stop] arrays, as in the -segments argument
to new(). The feature endpoints are automatically adjusted.
=item segments()
An alias for sub_SeqFeature().
=item get_SeqFeatures()
Alias for sub_SeqFeature()
=item get_all_SeqFeatures()
Bio/Structure/SecStr/DSSP/Res.pm view on Meta::CPAN
my $pdbId = ( $self->_pdbNum( $dssp_key ).
$self->_pdbInsCo( $dssp_key ) );
my $chain = $self->_pdbChain( $dssp_key );
$pdbId = "$pdbId:$chain" if $chain;
return $pdbId;
}
=head2 _contSegs
Title : _contSegs
Usage : find the endpoints of continuous regions of this structure
Function : returns pointer to array of 3 element array.
Elements are the dssp keys of the start and end points of each
continuous element and its PDB chain id (may be blank).
Note that it is common to have several
continuous elements with the same chain id. This occurs
when an internal region is disordered and no structural
information is available.
Example : $cont_seg_ptr = $dssp_obj->_contSegs();
Returns : pointer to array of arrays
Args : none
examples/subsequence.cgi view on Meta::CPAN
close $TEMPORARY;
print "</tt>\n";
unlink $filename;
}
sub print_form {
print p("This web page permits you to extract a short subsequence of DNA from a large GenBank entry. This is especially useful in an era of huge \"contigs\" of genomic DNA, where you only want to extract a few hundred base pairs for subsequent ana...
print p,"This program also illustrates the power of ",a({-href => 'http://www.BioPerl.org/'}, "BioPerl"), ", a powerful set of tools for molecular biology analysis. The ", a({-href => 'subsequence.pl.txt'}, "source code"), " for this program is le...
print p,"You must specify the GenBank accession number along with a start position. You may specify either the length of the subsequence you wish to extract or, equivalently, the endpoint.\n";
print "The sequence may be reverse-complemented if you wish, e.g., the reverse complement of <font color=green>ATCGC</font> is <font color=yellow>GCGAT</font>.\n";
print p,"To test this web page, try accession NT_004002, start 50000, length 400.\n";
print start_form,table(
Tr(td("Enter your GenBank accession"),td(textfield(-name => 'accession',-size => 20))),
Tr(td("Start position"),td(textfield(-name => 'start',-size => 10))),
Tr(td("Specify length or end position"), td(radio_group (-name => 'length_or_end_choice',-values => [Length, End], default => Length))),
Tr(td("Length or end position"), td(textfield (-name => length_or_end_value,-size => 20))),
travis_scripts/trigger-dockerhub.sh view on Meta::CPAN
#!/bin/bash
set -e
# the Docker Hub API endpoint
dockerapi="https://registry.hub.docker.com/u/bioperl/bioperl/trigger"
## Travis runs a build for several versions of Perl, but we want to
## trigger only for the same version of Perl as is running in the
## Docker container
docker_perl="5.18"
if [[ ${TRAVIS_PERL_VERSION:0:4} != "$docker_perl" ]] ; then
echo "Triggering Docker Hub only for Perl $docker_perl, not $TRAVIS_PERL_VERSION"
exit 0