Difference between revisions of "BrowseDev/Using a Database With JBrowse"

From GMOD
Jump to: navigation, search
Line 1: Line 1:
This page describes how to create a JBrowse configuration file by using an example with inline comments.
+
##REDIRECT [[JBrowse_Configuration_Guide#Using_JBrowse_with_Existing_Databases]]
 
+
=Summary=
+
 
+
In the context of JBrowse, a config file is a set of instructions in [[Glossary#JSON|JSON]] syntax that first indicates the location of the feature data, and then specifies a list of JBrowse tracks that can use the referenced feature data. The options for the feature tracks are virtually the same in the config file as they are in flatfile-to-json.pl. The difference is that, instead of inputting the feature tracks one at a time with flatfile-to-json.pl, the tracks are specified all at once in a file. This greatly reduces the amount of typing needed to change a track, especially for tracks that use several options. It also makes it easier to manage a large number of tracks, since the options used for those tracks are all recorded in a human-readable way.
+
 
+
=Example=
+
 
+
Here is a sample config file with each line explained. Note that, in order for this config file to work, it would be necessary to remove the grey comments (since JSON does not support them).
+
 
+
{
+
  <span style="color:#888888">This is the header. It contains information about the database.</span><br />
+
  <span style="color:#888888">description: a brief textual description of the data source.</span>
+
  "description": "D. melanogaster (release 5.37)",
+
  <span style="color:#888888">db_adaptor: a perl module with methods for opening databases and extracting<br>  information. This will normally be either Bio::DB::SeqFeature::Store,<br>  Bio::DB::Das::Chado, or Bio::DB::GFF, but it can also be the name of any<br>  other perl module that implements the Bio::SeqFeatureI interface.</span>
+
  "db_adaptor": "Bio::DB::SeqFeature::Store",
+
  <span style="color:#888888">db_args: arguments required to produce an instance of the db_adaptor. The<br>  required arguments can be found by searching for the db_adaptor on the CPAN<br>  website.</span>
+
  "db_args": {
+
              <span style="color:#888888">adaptor: With Bio::DB::SeqFeature::Store, a value of "memory"<br>              for the adaptor indicates that the data is stored somewhere in<br>              the file system. Alternatively, it might have been stored in a<br>              database such as MySQL or BerkeleyDB.</span>
+
              "-adaptor": "memory",
+
              <span style="color:#888888">dir: given the "memory" argument for the adaptor, this is the<br>              file system path to the location in memory where the data is<br>              stored. Data will automatically be extracted from any *.gff<br>              or *.gff3 files in this directory.</span>
+
              "-dir": "/Users/stephen/Downloads/dmel_r5.37"
+
            }, <br />
+
  <span style="color:#888888">This is the body. It contains information about the feature tracks.</span><br />
+
  <span style="color:#888888">TRACK DEFAULTS: The default options for every track.</span>
+
  "TRACK DEFAULTS": {
+
    <span style="color:#888888">class: same as 'cssClass' in flatfile-to-json.pl.</span>
+
    "class": "feature"
+
  },
+
  <span style="color:#888888">tracks: information about each individual track.</span>
+
  "tracks": [
+
    <span style="color:#888888">Information about the first track.</span>
+
    {
+
      <span style="color:#888888">track: same as 'tracklabel' in flatfile-to-json.pl.</span>
+
      "track": "gene",
+
      <span style="color:#888888">key: same meaning as in flatfile-to-json.pl.</span>
+
      "key": "Gene Span",
+
      <span style="color:#888888">feature: an array of the feature types that will be used for the track.<br>      Similar to 'type' in flatfile-to-json.pl.</span>
+
      "feature": ["gene"],
+
      <span style="color:#888888">autocomplete: same meaning as in flatfile-to-json.pl.</span>
+
      "autocomplete": "all",
+
      "class": "feature2",
+
      <span style="color:#888888">urlTemplate: same meaning as in flatfile-to-json.pl. Note how <br>      urlTemplate is being used with a variable called "feature_id" defined<br>      in extraData. In this way, different features in the same track can<br>      be linked to different pages on FlyBase.</span>
+
      "urlTemplate": <nowiki>"http://flybase.org/cgi-bin/fbidq.html?{feature_id}",</nowiki>
+
      <span style="color:#888888">extraData: same as in flatfile-to-json.pl.</span>
+
      "extraData": {"feature_id": "sub {shift-&gt;attributes(\"load_id\");}"}
+
    },
+
    <span style="color:#888888">Information about the second track.</span>
+
    {
+
      "track": "mRNA",
+
      "feature": ["mRNA"],
+
      "autocomplete": "alias",
+
      <span style="color:#888888">subfeatures: similar to 'getSubs' in flatfile-to-json.pl.</span>
+
      "subfeatures": true,
+
      "key": "mRNA",
+
      "class": "transcript",
+
      <span style="color:#888888">subfeature_classes: same as 'subfeatureClasses' in flatfile-to-json.pl.</span>
+
      "subfeature_classes": {
+
        "CDS": "transcript-CDS",
+
        "five_prime_UTR": "transcript-five_prime_UTR",
+
        "three_prime_UTR": "transcript-three_prime_UTR"
+
      },
+
      <span style="color:#888888">arrowheadClass: same meaning as in flatfile-to-json.pl.</span>
+
      "arrowheadClass": "transcript-arrowhead",
+
      <span style="color:#888888">clientConfig: same meaning as in flatfile-to-json.pl.</span>
+
      "clientConfig": {
+
        "histScale":5
+
      },
+
      "urlTemplate": <nowiki>"http://flybase.org/cgi-bin/fbidq.html?{feature_id}",</nowiki>
+
      "extraData": {"feature_id": "sub {shift-&gt;attributes(\"load_id\");}"}
+
    }
+
  ]
+
}
+
 
+
Note how the config file is divided into two parts, a header section that contains information about the database, and a body section that contains information about the feature tracks.
+
 
+
=See also=
+
 
+
* [[JBrowseDev/Current|Documentation Page for the Current Version of JBrowse]]
+
 
+
=External Links=
+
 
+
* [http://jbrowse.org/code/jbrowse-master/docs/config.html Configuration File Documentation From the JBrowse Package]
+
  
 
[[Category:JBrowse]]
 
[[Category:JBrowse]]

Revision as of 15:54, 1 April 2013

    1. REDIRECT JBrowse_Configuration_Guide#Using_JBrowse_with_Existing_Databases