Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom tracks with .gff suffix are always treated as GFF2 #39

Open
nathanweeks opened this issue Mar 13, 2014 · 0 comments
Open

Custom tracks with .gff suffix are always treated as GFF2 #39

nathanweeks opened this issue Mar 13, 2014 · 0 comments

Comments

@nathanweeks
Copy link
Member

A custom track uploaded from a file will be loaded with Bio::DB::SeqFeature::Store::GFF2Loader if it has a .gff suffix, even if the file contains "##gff-version 3" as the first line.

Since it is not uncommon for a GFF3 files to have a ".gff" suffix, the loader should detect this.

The following patch accomplishes this for uncompressed .gff files; ideally, this could be accomplished somehow for compressed files as well:

diff --git a/lib/Bio/Graphics/Browser2/UserTracks.pm b/lib/Bio/Graphics/Browser2/UserTracks.pm
index b63915e..7883335 100644
--- a/lib/Bio/Graphics/Browser2/UserTracks.pm
+++ b/lib/Bio/Graphics/Browser2/UserTracks.pm
@@ -754,6 +754,8 @@ sub _guess_upload_type {
               :$filename =~ /\.(?:tar|tgz|tbz|tbz2|zip)(?:\.(gz|bz2))?$/i ? 'archive'
               :undef;

+    # .gff file may be GFF3 if first line contains the gff-version pragma
+    return ('gff3',\@lines,$eol) if $filename =~ /\.gff$/i && $lines[0] =~ /^\#\#gff-version\s+3/;
     return ($ftype,\@lines,$eol) if $ftype;

     # otherwise scan the thing until we find a pattern we know about
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant