Allow specifying custom exporter classes outside the JBrowse namespace #682

Merged
merged 1 commit into from Feb 2, 2016

Conversation

Projects
None yet
3 participants
@cmdcolin
Contributor

cmdcolin commented Feb 1, 2016

We saw a scenario where one of our track types had a quirk with "Save track data" and I thought that it would be useful to have the ability to specify a custom exporter class.

This PR simply checks whether the name of the class that is specified by the track type contains slashes, and if it does, then we assume it is a full path to a exporter module rather than something that already exists in JBrowse namespace.

For example, I could have a class like this that inherits from the default gff3 exporter

define([
            "dojo/_base/declare",
            "JBrowse/View/Export/GFF3"
       ],
       function(
            declare,
            ExportGFF3
       ) {
return declare(ExportGFF3, {

    constructor: function() {
        console.log("Initialized");
    },
    writeFeature: function(feature) { /* do custom exporter things... */ }
});

});

And then use it for some custom trackType by overriding _exportFormats

_exportFormats: function() {
    return [ {name: 'WebApollo/View/Export/CustomExporter', label: 'GFF sequence alterations', fileExt: 'gff3'} ];
}
@nathandunn

This comment has been minimized.

Show comment
Hide comment
@nathandunn

nathandunn Feb 1, 2016

Contributor

I agree that this would be helpful. @enuggetry . . . do you see any problems with this?

Contributor

nathandunn commented Feb 1, 2016

I agree that this would be helpful. @enuggetry . . . do you see any problems with this?

enuggetry added a commit that referenced this pull request Feb 2, 2016

Merge pull request #682 from GMOD/allow_custom_exporters
Allow specifying custom exporter classes outside the JBrowse namespace

@enuggetry enuggetry merged commit 6977d85 into master Feb 2, 2016

1 check passed

continuous-integration/travis-ci/push The Travis CI build passed
Details

@cmdcolin cmdcolin deleted the allow_custom_exporters branch Feb 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment