# gbrowse config file for  genome maps
[GENERAL]

description = Dros. species assembly on D.mel, 2005-08

header = 

footer = <hr>
  <table width="100%">
  <TR>
  <TD align="LEFT" class="databody">
  For the source code for this browser, see the <a href="http://www.gmod.org">
  Generic Model Organism Database Project.</a>  For other questions, send
  mail to <a href="mailto:lstein@cshl.org">lstein@cshl.org</a>.
  </TD>
  </TR>
  </table>
  <hr>
  <pre>$Id: dros_spp.conf,v1.0 gbrowseconf.xml Exp $</pre>


## dnalib; add all spp to it, with dbid prefix to scaffold.raw
# lucegene GFF adaptor
db_adaptor    = Bio::DB::GFF
db_args       = 
    -adaptor    lucegene
    -FORMAT     gff
    -LIB_NAME   dros_spp0508
    -INDEX_ROOT /bio/argos/species/indices/lucene
    -JAVA_LIB   /bio/argos/common/perl/gbrowse/lib/java
    -DNA_LIB    /bio/argos/species/web/data/dmel-dspp/dna
    -use_server 1
    -dbport     7155
    -LOGFILE    /tmp/lugene-drospege.log
    
#    -DNA_LIB    /bio/argos/flybase/data/genomes/dmel/current/dna

## mysql adaptor for same data
# adaptor     = dbi::mysqlopt
# database    = dbi:mysql:database=dros_spp;host=localhost
# user        = 
# passwd      =

#test caching images; ggb now supports only overview cache
cache_overview = 360
cache_all = 1

default_name = 2L:1..50000 
default_range = 1-500000

# examples to show in the introduction
examples =  chromosome_arm:2L 2L:1..50000 2L 2R 3L 3R 4 X 
# chromosomes = chromosome_arm:2L 2L:1..50000 2L 2R 3L 3R 4 X 

#Aligner -- cant get to work (20k too big?)
plugins = 
 BatchDumper TextMapDumper FeatureFastaDumper FastaDumper GFFDumper 

# and below,later
#[Aligner:plugin]
#alignable_tracks   = scaffold blastdere blastdana
#upcase_tracks      = scaffold 
#upcase_default     = scaffold

## option for these? transcript05 replaces transcript
##aggregators =  matchparts transcript05 alignment orf
## read the docs: can do it here instead of perl.pm
aggregators =  transcript05 alignment orf
     matches{match_part,assembly_component/match}

uploads = 1

## need this for  Chado segment lookup in Browser.pm _feature_get ...
reference class = chromosome_arm

## need options here
default features =  gene scaffold chromosome_band 
	            blastdvir blastdere blastdgri 
                    blastdsim blastdyak blastdana blastdmoj
		    markers:overview
primary_feature = gene

# ? these are flybase-specials ?
# scale_feature = cytoband
dumpviews = FastA GenBank GFF FFF
dataviews = "Default" "Collapse All" "Expand All" 

# Web site configuration info; urk FIXME ... installer
help        = /gbrowse
stylesheet  = /gbrowse/gbrowse.css
buttons     = /gbrowse/images/buttons
tmpimages   = /species/tmp/gbrowse

# stylesheet  = /gbrowse/gbrowse.css
# buttons     = /gbrowse/images/buttons
# tmpimages   = /gbrowse/tmp


# max and default segment sizes for detailed view
max segment     = 1000001
default segment = 100000

# low-res boundary
low res = 200000

zoom levels = 100 200 1000 2000 5000 10000 20000 40000 100000 200000 500000 1000000

searchhelp = Search using Chromosome:base_start..end or Gene name/ID.

#panel property
pad_left    = 20
pad_right   = 30
key_style = between
key bgcolor = whitesmoke
overview bgcolor = whitesmoke
grid = 1

# put reversed features on same track or below ?
mix_strand = 1

# # where to link to when user clicks in detailed view
link    = AUTO
# # default dummy link to get popup title view
# link = sub { return "#"; }
# link = sub {
#   my $f= shift;
#   my $d= $f->primary_id() if $f->can('primary_id');
#   $d= $f->source() unless($d);
#   if ($d) { return '/cgi-bin/lookup?id='.$d; }
#   $d= $f->name();
#   if ($d) { return '/cgi-bin/lookup?name='.$d; }
#   }

# title = sub { my $f= shift;
#   return $f->class .":". $f->info . " ". $f->seq_id .':'.$f->start."..".$f->end;
#   }
title = sub { my $f= shift;
  my $loc= " " .$f->seq_id .':'.$f->start."..".$f->end;
  my $nm; my @na;
  my($id)= $f->each_tag_value('ID'); $id= $f->primary_id() unless($id);
  $id =~ s/\.\d+$//; # local id
  @na= $f->each_tag_value('Name'); if (@na>0) { $nm= shift @na; }
  unless($nm) { @na= $f->each_tag_value('Alias'); if (@na>0) { $nm= shift @na;  } }
  $nm= $f->name unless($nm);
  $nm .= " ($id)" unless($id =~ /$nm/);
  return $f->method .":$nm $loc";
  }

## NOTE: this is used by TextMapDumper plugin
#  my $link  = $browser->config->code_setting($label,'dbx_link');
#  $link     = $browser->config->code_setting(general=>'dbx_link') unless defined $link;
dbx_link = sub {
  my $dbx= shift; my $f= shift; #?
  my $r='';
  foreach my $x (split(/[,;]\s*/,$dbx)) {
    my($h,$v);
    my($db,$ac)= split/:/,$x,2;
    if ($db eq 'GB_protein') { 
      $v= $ac;
      $h= 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Search&db=Protein&doptcmdl=GenBank&tool=GMOD&term='.$ac;
      }
    elsif ($db eq 'GB') { 
      $v= $ac;
      $h= 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Search&db=Nucleotide&doptcmdl=GenBank&tool=GMOD&term='.$ac;
      }
    elsif ($db eq 'GO') { 
      $v= $ac;
      $h= '/cgi-bin/goreport?id='.$ac;
      }
    if ($h && $v) { $r.= '<a href="'.$h.'">'.$v.'</a>, '; }
    else { $r.= $x.', '; }
    }
  return $r;
  }
  
  

# colors of the overview, detailed map and key
overview units   = M
overview bgcolor = lightgrey
detailed bgcolor = lightgoldenrodyellow
key bgcolor      = beige

# "automatic" classes to try when an unqualified identifier is given
automatic classes = gene

language = en

# Default glyph settings
glyph       = generic
height      = 5
bgcolor     = palegoldenrod
fgcolor     = cyan
boxcolor    = blue
label density = 20
bump density  = 50
overview label density = 160

image widths  = 450 640 800 950 1024
default width = 800

# Various places where you can insert your own HTML -- see configuration docs
html1 = 
html2 = 
html3 = 
html4 = 
html5 = 
html6 = 


[BatchDumper:plugin]
fileformat = embl                

[GFFDumper:plugin]
version     = 3


### TRACK CONFIGURATION ####
# the remainder of the sections configure individual tracks
  
#[chromosome_arm]
#feature  = chromosome_arm
#glyph    = segments
#bgcolor  = lightslategray
#fgcolor  = black
#key      = chromosome_arm
#citation = chromosome_arm
#category = Genome features


[chromosome_band]
feature  = chromosome_band
#glyph    = segments
glyph = revcomp_arrow
bgcolor  = lightslategray
fgcolor  = black
label density = 200
height      = 2
bump density  = 0
key      = chromosome_band
citation = chromosome_band
category = Genome features
label = sub { my $f = shift;
    my @na= ($f->attributes('Name'),  $f->display_name);
    my $na= shift @na; $na =~ s/band-//;
    return $na;
    }
label_align = center
no_tick_label = 1
#tick = 2
#both = 1
#linewidth = 2


[gene]
#feature       = gene transcript  
#feature       = gene mRNA
feature       = gene:.
glyph         = transcript2
bgcolor       = lightblue
fgcolor       = blue
#secondary     = mRNA
#secondary_bgcolor = mediumblue
#secondary_fgcolor = mediumblue
highlight_color = red
higlighted = 1
label = 1
label density = 50
key           = D.melanogaster Genes
category = Genome features
citation     = Gene and mRNA (transcript) features  

[markers:overview]
feature = gene:marker
glyph         = generic
bgcolor       = green
height        = 5
key           = Dmel. marker
label density = 520
bump density  = 550
label = sub { my $f = shift;
    my @na= ($f->attributes('ID'), $f->attributes('Name')); 
    return $na[0] || $f->display_name;
    }
#?? marker Name or ID

[markers]
feature = gene:marker
bgcolor  = green
glyph    = segments
stranded = 1
key      = Dmel. marker
citation = Dmel. marker
category = Analysis
label = sub { my $f = shift;
    my @na= ($f->attributes('ID'), $f->attributes('Name')); 
    return $na[0] || $f->display_name;
    }


#[match]
#feature  = match
#glyph    = segments
#bgcolor  = lightslategray
#fgcolor  = black
#key      = match
#citation = match
#category = Analysis

# and later
#[Aligner:plugin]
##alignable_tracks   = scaffold blastdere blastdana
#alignable_tracks   = gene blastdere blastdana
#upcase_tracks      = gene
#upcase_default     = gene

[blastdvir]
feature  = cross_genome_match:dvir_ag0508
glyph    = segments 
stranded     = 1
label density = 50
bgcolor  = slateblue
# turquoise # lightslategray
fgcolor  = black
key      = D.virilis cross_genome
category = Analysis
link = sub {
  my $f= shift; 
  my ($t)= $f->attributes('Target');
  if ($t) { 
    $t=~s/^\w+://; $t=~s/[\s+]/:/; $t=~s/[\s+]/../;
    return '/species/cgi-bin/gbrowse/dvir/?name='.$t;}
  my ($r)= $f->attributes('ID');
  if ($r) { 
     $r=~s/\..*$//; 
     return '/species/cgi-bin/gbrowse/dvir/?name='.$r;
     }
  }

[blastdmoj]
feature  = cross_genome_match:dmoj_ag01aug05
glyph    = segments
stranded     = 1
label density = 50
bgcolor  = blanchedalmond
# turquoise
fgcolor  = black
key      = D.mojavensis cross_genome
category = Analysis
link = sub {
  my $f= shift; 
  my ($t)= $f->attributes('Target');
  if ($t) { 
    $t=~s/^\w+://; $t=~s/[\s+]/:/; $t=~s/[\s+]/../;
    return '/species/cgi-bin/gbrowse/dmoj/?name='.$t;}
  my ($r)= $f->attributes('ID');
  if ($r) { 
     $r=~s/\..*$//; 
     return '/species/cgi-bin/gbrowse/dmoj/?name='.$r;
     }
  }

[blastdere]
feature  = cross_genome_match:dere_ag01aug05
glyph    = segments
stranded     = 1
label density = 50
bgcolor  = mediumspringgreen
# turquoise
fgcolor  = black
key      = D.erecta cross_genome
category = Analysis
link = sub {
  my $f= shift; 
  my ($t)= $f->attributes('Target');
  if ($t) { 
    $t=~s/^\w+://; $t=~s/[\s+]/:/; $t=~s/[\s+]/../;
    return '/species/cgi-bin/gbrowse/dere/?name='.$t;}
  my ($r)= $f->attributes('ID');
  if ($r) { 
     $r=~s/\..*$//; 
     return '/species/cgi-bin/gbrowse/dere/?name='.$r;
     }
  }

[blastdgri]
feature  = cross_genome_match:dgri_ag01aug05
glyph    = segments
stranded     = 1
label density = 50
bgcolor  = orange
fgcolor  = black
key      = D.grimshawi cross_genome
category = Analysis
link = sub {
  my $f= shift;
  my ($t)= $f->attributes('Target');
  if ($t) { 
    $t=~s/^\w+://; $t=~s/[\s+]/:/; $t=~s/[\s+]/../;
    return '/species/cgi-bin/gbrowse/dgri/?name='.$t;}
  my ($r)= $f->attributes('ID');
  if ($r) {  
     $r=~s/\..*$//; 
     return '/species/cgi-bin/gbrowse/dgri/?name='.$r;
     }
  }


[blastdana]   
feature  = cross_genome_match:dana_ag01aug05
glyph    = segments
stranded     = 1
label density = 50
bgcolor  = plum
#seashell # palevioletred # royalblue  peachpuff
fgcolor  = black
key      = D.annanasae cross_genome
category = Analysis
link = sub {    
  my $f= shift;
  my ($t)= $f->attributes('Target');
  if ($t) { 
    $t=~s/^\w+://; $t=~s/[\s+]/:/; $t=~s/[\s+]/../;
    return '/species/cgi-bin/gbrowse/dana/?name='.$t;}
  my ($r)= $f->attributes('ID');
  if ($r) {
     $r=~s/\..*$//; 
     return '/species/cgi-bin/gbrowse/dana/?name='.$r;
     }
  }


[blastdyak]
#feature  = matches:blastn:dyak_wu040407
#glyph    = graded_segments
feature  = cross_genome_match:dyak_wu040407
glyph    = segments
stranded     = 1
label density = 50
bgcolor  = wheat
# gainsboro lightyellow  # wheat
fgcolor  = black
key      = D.yakuba cross_genome
category = Analysis
label = sub { my $f = shift;
    my @na= ($f->attributes('Name'),  $f->display_name);
    my $na= shift @na; $na =~ s/^\w+://;
    return $na;
    }
link = sub {    
  my $f= shift;
  my ($t)= $f->attributes('Target');
  if ($t) { 
    $t=~s/^\w+://; $t=~s/[\s+]/:/; $t=~s/[\s+]/../;
    return '/species/cgi-bin/gbrowse/dyak/?name='.$t;}
  my ($r)= $f->attributes('ID');
  if ($r) {  
     $r=~s/\..*$//; 
     return '/species/cgi-bin/gbrowse/dyak/?name='.$r;
     }
  }


[blastdsim]
feature  = cross_genome_match:dsim_dgpg20040929
glyph    = segments
stranded     = 1
label density = 50
bgcolor  = goldenrod
# gainsboro lightyellow  # wheat
fgcolor  = black
key      = D.simulans cross_genome
category = Analysis
link = sub {
  my $f= shift;
  my ($t)= $f->attributes('Target');
  if ($t) { 
    $t=~s/^\w+://; $t=~s/[\s+]/:/; $t=~s/[\s+]/../;
    return '/species/cgi-bin/gbrowse/dsim/?name='.$t;}
  my ($r)= $f->attributes('ID');
  if ($r) {  
     $r=~s/\..*$//; 
     return '/species/cgi-bin/gbrowse/dsim/?name='.$r;
     }
  }


[mrna]
feature  = mrna
glyph    = segments
bgcolor  = lightslategray
fgcolor  = black
key = D.melanogaster mRNA
citation = D.melanogaster mRNA
category = Genome features


[scaffold]
## aug04 - renamed to SO equivalent golden_path; 
## sep04 - golden_path_fragment is better, or supercontig ?
feature  = scaffold golden_path_fragment 
glyph         = anchored_arrow
no_arrows     = 1
base          = 0
fgcolor       = black
bgcolor       = black
linewidth     = 2
bump          = 1
label         = 1
height        = 4
key           = D. melanogaster Scaffold
citation     = GenBank submission unit, a golden_path_fragment  
category = Genome features
#link = sub { my $f= shift; return ($f->name())?'/cgi-bin/fbannq.html?ARM='.$f->name() : ''; }


[transposable]
feature  = transposable_element
bgcolor       = magenta
fgcolor       = magenta
label = 1
glyph         = anchored_arrow
key           = Natural transposon
citation     = Natural transposon 
category = Genome features


#-----------
# melon.% $gbl/bin/lucegene-search.sh -lib dros_spp0508  -c 'terms feature:;terms source:;'
#-------------
# Terms in dictionary for 'feature:'
# start=0 for total docs 57222
# #docs           Field:Value
# 6           feature:chromosome_arm
# 5770           feature:chromosome_band
# 16421           feature:cross_genome_match
# 14066           feature:gene
# 18941           feature:mrna
# 437           feature:scaffold
# 1571           feature:transposable_element
#  found=7
# Terms in dictionary for 'source:'
# start=0 for total docs 57222
# #docs           Field:Value
# 40791           source:.
# 2792           source:dana_ag01aug05
# 1207           source:dere_ag01aug05
# 3591           source:dgri_ag01aug05
# 3238           source:dmoj_ag01aug05
# 495           source:dsim_dgpg20040929
# 3922           source:dvir_ag0508
# 1176           source:dyak_wu040407
#  found=8
.
