JBrowse: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
Line 118: Line 118:
===Wiggle/BigWig tracks (WIG)===
===Wiggle/BigWig tracks (WIG)===


You can load single BigWig-files by following command:
<source lang='bash'>
bin/add-bam-track --label <label> --bam_url <url>
</source>
To load multiple BAM files present in a certain directory use:
<source lang='bash'>
for bam in /<dir>*.bam; do
        ln -s $bam track_symlinks/
        ln -s $bam.bai track_symlinks/
        tissue=`echo $bam | rev | cut -c 5- | rev | cut -d'/' -f9`
        echo '{
                "label" : "'${tissue}'_alignment",
                "key" : "'${tissue}'_alignment",
                "storeClass" : "JBrowse/Store/SeqFeature/BAM",
                "urlTemplate" : "../track_symlinks/'${tissue}.bam'",
                "category" : "3. ENSEMBL RNA-seq alignments",
                "type" : "Alignments2"
        }' | bin/add-track-json.pl data/trackList.json
        echo '{
                "label" : "'${tissue}'_coverage",
                "key" : "'${tissue}'_coverage",
                "storeClass" : "JBrowse/Store/SeqFeature/BAM",
                "urlTemplate" : "../track_symlinks/'${tissue}.bam'",
                "category" : "3. ENSEMBL RNA-seq alignments",
                "type" : "SNPCoverage"
        }' | bin/add-track-json.pl data/trackList.json
done
</source>
Make sure the BAM file can be read by a everybody if not use:
<source lang='bash'>
chmod +r <BAM_file>
</source>
Make sure that all directoryies in the full path of the BAMfile are executable:
<source lang='bash'>
chmod +x <dir>
</source>


===Evidence tracks===
===Evidence tracks===

Revision as of 16:11, 23 February 2016

Typical commands used to set up a JBrowse

Author: Martijn Derks

Install JBrowse

Download the latest JBrowse here: http://jbrowse.org/

Run the setup script to install perl dependencies and required modules

<source lang='bash'> unzip JBrowse-1.12.0.zip ./setup.sh </source>

Add reference sequence

Example code for chicken genome

<source lang='bash'> bin/prepare-refseqs.pl --fasta /lustre/nobackup/WUR/ABGC/shared/public_data_store/genomes/chicken/Ensembl74/Gallus_gallus.Galgal4.74.dna.toplevel.fa </source>

To remove tracks use following command:

<source lang='bash'> bin/remove-track.pl -D --trackLabel 'trackname' </source>

Add annotation files (GFF/BED)

Data can be downloaded from the Ensembl FTP site: http://www.ensembl.org/info/data/ftp/index.html

Add gene features:

<source lang='bash'> bin/flatfile-to-json.pl --key "Gene spans" --className feature5 --type gene --noSubfeatures --config '{ "category": "GalGal4.83 Annotation" }' --trackLabel Genes --gff ../ensembl_data/Gallus_gallus.Galgal4.83.gff3 </source>

Add corresponding transcripts:

<source lang='bash'> bin/flatfile-to-json.pl --key "Transcripts" --className transcript --subfeatureClasses '{"exon": "exon", "CDS": "CDS", "five_prime_UTR": "five_prime_UTR", "three_prime_UTR": "three_prime_UTR"}' --config '{ "category": "GalGal4.83 Annotation" }' --type transcript --trackLabel Transcripts --gff ../ensembl_data/Gallus_gallus.Galgal4.83.gff3 </source>

Alignment tracks (BAM)

You can load single BAM-files by following command: <source lang='bash'> bin/add-bam-track --label <label> --bam_url <url> </source>

To load multiple BAM files present in a certain directory use: <source lang='bash'>

for bam in /<dir>*.bam; do

       ln -s $bam track_symlinks/ ## Make symlinks from the BAM files
       ln -s $bam.bai track_symlinks/ ## Make symlinks to the BAM index files
       tissue=`${bam::-4}` ## USe the name of the file without .bam as trackLabel
       
       ## Add BAM in alignment mode (Alignments2)
       echo '{
               "label" : "'${tissue}'_alignment",
               "key" : "'${tissue}'_alignment",
               "storeClass" : "JBrowse/Store/SeqFeature/BAM",
               "urlTemplate" : "../track_symlinks/'${bam}'",
               "category" : "3. RNA-seq alignments",
               "type" : "Alignments2"
       }' | bin/add-track-json.pl data/trackList.json
       ## Add BAM in coverage mode (SNPCoverage)
       echo '{
               "label" : "'${tissue}'_coverage",
               "key" : "'${tissue}'_coverage",
               "storeClass" : "JBrowse/Store/SeqFeature/BAM",
               "urlTemplate" : "../track_symlinks/'${bam}'",
               "category" : "3. RNA-seq alignments",
               "type" : "SNPCoverage"
       }' | bin/add-track-json.pl data/trackList.json

done </source>

Make sure the BAM file can be read by a everybody if not use: <source lang='bash'> chmod +r <BAM_file> </source>

Make sure that all directoryies in the full path of the BAMfile are executable: <source lang='bash'> chmod +x <dir> </source>

Variant tracks (VCF)

To load a VCF file in JBrowse make sure the file is gzipped and indexed

<source lang='bash'> tabix -p vcf Gallus_gallus_incl_consequences.vcf.gz

echo ' {

      "label" : "Gallus_gallus_incl_consequences",
      "key" : "Gallus_gallus_incl_consequences",
      "storeClass" : "JBrowse/Store/SeqFeature/VCFTabix",
      "urlTemplate" : "../../ensembl_data/VCF/Gallus_gallus_incl_consequences.vcf.gz",
      "category" : "2. Variants",
      "type" : "HTMLVariants"
    } ' | bin/add-track-json.pl data/trackList.json

</source>

Wiggle/BigWig tracks (WIG)

You can load single BigWig-files by following command: <source lang='bash'> bin/add-bam-track --label <label> --bam_url <url> </source>

To load multiple BAM files present in a certain directory use: <source lang='bash'>

for bam in /<dir>*.bam; do

       ln -s $bam track_symlinks/
       ln -s $bam.bai track_symlinks/
       tissue=`echo $bam | rev | cut -c 5- | rev | cut -d'/' -f9`
       echo '{
               "label" : "'${tissue}'_alignment",
               "key" : "'${tissue}'_alignment",
               "storeClass" : "JBrowse/Store/SeqFeature/BAM",
               "urlTemplate" : "../track_symlinks/'${tissue}.bam'",
               "category" : "3. ENSEMBL RNA-seq alignments",
               "type" : "Alignments2"
       }' | bin/add-track-json.pl data/trackList.json
       echo '{
               "label" : "'${tissue}'_coverage",
               "key" : "'${tissue}'_coverage",
               "storeClass" : "JBrowse/Store/SeqFeature/BAM",
               "urlTemplate" : "../track_symlinks/'${tissue}.bam'",
               "category" : "3. ENSEMBL RNA-seq alignments",
               "type" : "SNPCoverage"
       }' | bin/add-track-json.pl data/trackList.json

done </source>

Make sure the BAM file can be read by a everybody if not use: <source lang='bash'> chmod +r <BAM_file> </source>

Make sure that all directoryies in the full path of the BAMfile are executable: <source lang='bash'> chmod +x <dir> </source>

Evidence tracks

Evidence tracks can be loaded in bed, gff and gbk format using

<source lang='bash'> bin/flatfile-to-json.pl </source>

Examples are given above.