Last active
August 29, 2015 14:04
-
-
Save zhoujj2013/5e2c1f861fbe904e7de5 to your computer and use it in GitHub Desktop.
import gff3 file to jbrowser by chr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use Data::Dumper; | |
## Written by [email protected] | |
# import gff3 file to jbrowser by chr | |
# default jbrowser installation diretory is /var/www/jbrowser/ | |
my ($gff3_f,$outdir) = @ARGV; | |
my %chr; | |
open IN,"$gff3_f" || die $!; | |
while(<IN>){ | |
chomp; | |
next if(/^#/); | |
my @t = split /\t/; | |
$chr{$t[0]} = 1; | |
} | |
close IN; | |
my @chr_gff3; | |
mkdir "./chr_gff3" if(! -e "./chr_gff3"); | |
open SH,">","import_gff3.sh" || die $!; | |
foreach my $c (keys %chr){ | |
open OUT,">","./chr_gff3/$c.gff3" || die $!; | |
print SH "perl /var/www/jbrowser/bin/flatfile-to-json.pl --out $outdir --gff ./chr_gff3/$c.gff3 --type mRNA --autocomplete all --trackLabel EnsemblTrans --key 'EnsemblTrans' --getSubfeatures --className transcript --subfeatureClasses '{\"CDS\": \"transcript-CDS\"}' --arrowheadClass arrowhead --urltemplate \"http://asia.ensembl.org/Homo_sapiens/Transcript/Summary?t={id}&db=core\" --maxLookback 2000\n"; | |
open IN,"$gff3_f" ||die $!; | |
my $conti = ""; | |
while(<IN>){ | |
chomp; | |
if(/^#/ && $conti eq ""){ | |
print OUT "$_\n"; | |
$conti = "####"; | |
} | |
my @t = split /\t/; | |
my $id = $t[0]; | |
if($t[0] eq $c){ | |
print OUT "$_\n"; | |
$conti = ""; | |
} | |
} | |
close OUT; | |
} | |
close SH; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment