GBrowse

 view release on metacpan or  search on metacpan

contrib/SynView/cgi-lib/DAS/GUS/Segment/Feature.pm  view on Meta::CPAN

	Title	: get_SeqFeatures
	Function: aliased to sub_SeqFeature() for Bio::SeqFeatureI compatibility

=cut

*get_SeqFeatures = \&sub_SeqFeature;

=head2 get_tag_values()
	
	Title	: get_tag_values
	Usage	:
	Function:
	Returns	:
	Args	:

=cut

sub get_tag_values {
  my $self = shift;
  my $tag = shift;

  return $self->$tag() if $CONSTANT_TAGS{$tag};

  return $self->attributes($tag);
}

=head2 get_tagset_values()
	
	Title	: get_tagset_values
	Usage	:
	Function:
	Returns	:
	Args	:

=cut

sub get_tagset_values {
	my ($self, %arg) = @_;

	$self->throw_not_implemented();
}

=head2 gff_string()
	
	Title	: gff_string
	Usage	: $string = $feature->gff_string
	Function: return GFF3 representation of feature
	Returns	: a string
	Args	: none
	Status  : Public

=cut

sub gff_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; 
	if (my $g = $self->group) { 
		$name = $self->id;
    push @group,[ID => $name] if !defined($parent) || $name ne $parent;

		my $display_name = $self->name;
		push @group,[Name => $display_name] if $name !~ /$display_name$/;
	}

	push @group,[Parent => $parent] if defined $parent && $parent ne '';

	my @attributes = $self->attributes;

	while (@attributes) { 
		push @group,[shift(@attributes),shift(@attributes)] 
	}

	my $pattern = "^a-zA-Z0-9,. :^*!+_?-";

	my $group_field = join ';',map {join '=', uri_escape($_->[0], $pattern), uri_escape($_->[1], $pattern)} grep {$_->[0] =~ /\S/ and $_->[1] =~ /\S/} @group;

	my $type = $self->method;
	$type =~ s/:\S+//;

  my $string = join("\t",$n,$self->source||'.',$type||'.',$start||'.',$stop||'.', $self->score||'.',$strand||'.',$phase||'.',$group_field);

	$string .= "\n";

  if ($recurse) { 
		foreach ($self->sub_SeqFeature) {
      $string .= $_->gff_string(1,$name);
    }
	}
  $string;
}

=head2 has_tag()
	
	Title	: has_tag
	Usage	:
	Function:
	Returns	:
	Args	:

=cut

sub has_tag {
	my $self = shift;
	my $tag = shift;



( run in 2.528 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )