NAME

Bio::Graphics::Browser2::GFFhelper -- Helps gbrowse plugins handle GFF

SYNOPSIS

  package Bio::Graphics::Browser2::Plugin::MyPlugin;

  use vars qw/@ISA $ROLLBACK/;

  @ISA = qw/ Bio::Graphics::Browser2::Plugin 
             Bio::Graphics::Browser2::GFFhelper /;

  $ROLLBACK = '/tmp/';

  # other plugin subs skipped...

  sub save_segment {
    my ($self, $segment) = @_;
    return 0 unless $ROLLBACK;
    $self->{rb_loc} ||= $ROLLBACK;
    $self->save_state($segment);
    1;
  }

  sub gff_from_rollback {
    my $self = shift;
    my $conf = $self->configuration;

    # don't save a persistent rb_id, look for a CGI param each time
    my $rollback = $self->config_param('rb_id');

    my $gff = $self->rollback($rollback);

    # this is a rollback to an earlier version of an existing segment
    # we don't need DNA, just the GFF
    $gff;
  }

  # read GFF2 dialects
  sub gff {
    my $self = shift;
    my $gff  = shift;

    # set a flag to add a header to the GFF
    $self->{header} = 1;

    # set sequence name in case the GFF does not have it
    $self->refseq('L16622');

    # process the GFF, convert it to GFF3, get the sequence
    my ($newGFF, $dna) = $self->read_gff($gff);
    return ($newGFF, $dna);
  }

DESCRIPTION

This modules helps process GFF prior to loading into the database and provides rollback capability for feature editors/loaders

GFF help

This module deals with the different GFF2 dialects and changes them to GFF3 format. It also allows conversion of Bio::DB::GFF::Feature objects to Bio::SeqFeature::Generic objects, which is required for consistent feature and attribute handling across different input/output formats.

Sequence Extraction

If DNA is appended to the GFF, it will be extracted. The read_gff method returns a string containing processed GFF and also a sequence string.

Rollbacks

The state of a segment can be captured and saved in case the user wishes to revert to an earlier version of the segment after editing/deleting features. The last 10 modified segments are saved in a round-robin rotation. In plugins that inherit methods from this module, the $ROLLBACK variable must be defined with a string containing the path to a directory where the web user ('apache', 'nobody', etc.) has write access. If $ROLLBACK is undefined, the rollback functionality is disabled.

FEEDBACK

See the GMOD website for information on bug submission http://www.gmod.org

AUTHOR - Sheldon McKay

Email smckay@bcgsc.bc.ca

This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.