JBrowse: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 15: Line 15:
Download the latest JBrowse here: http://jbrowse.org/
Download the latest JBrowse here: http://jbrowse.org/


Make a directory in <code>/cm/shared/apps/jbrowse/</code> for your species of interested (e.g. <code>mkdir Cyprinus_carpio</code>). Move the downloaded JBrowse source files there. All further procedures detailed in this Wiki page assume working from that directory (NOTE: if your species of interest is already there, contact the maintainer of that JBrowse instance).
Make a directory in <code>/shared/apps/jbrowse/</code> for your species of interested (e.g. <code>mkdir Cyprinus_carpio</code>). Move the downloaded JBrowse source files there. All further procedures detailed in this Wiki page assume working from that directory (NOTE: if your species of interest is already there, contact the maintainer of that JBrowse instance).
Run the setup script to install perl dependencies and required modules
Run the setup script to install perl dependencies and required modules


<source lang='bash'>
<pre>
unzip JBrowse-1.12.0.zip
unzip JBrowse-1.12.0.zip
mv JBrowse-1.12.0/* $PWD
mv JBrowse-1.12.0/* $PWD
./setup.sh
./setup.sh
</source>
</pre>


=== Add reference sequence ===
=== Add reference sequence ===
Line 28: Line 28:
Example code for chicken genome
Example code for chicken genome


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


To remove tracks use following command:
To remove tracks use following command:


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


===Add annotation files (GFF/BED)===
===Add annotation files (GFF/BED)===
Line 44: Line 44:
Add gene features:
Add gene features:


<source lang='bash'>
<pre>
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
bin/flatfile-to-json.pl --key "Genes" --type gene --config '{ "category": "GalGal4.83 Annotation" }' --trackLabel Genes --gff ../ensembl_data/Gallus_gallus.Galgal4.83.gff3
</source>
</pre>


Add corresponding transcripts:
Add corresponding transcripts:


<source lang='bash'>
<pre>
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
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>
</pre>


===Alignment tracks (BAM)===
===Alignment tracks (BAM)===


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


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


for bam in /<dir>*.bam; do
for bam in /<dir>*.bam; do
Line 90: Line 90:


done
done
</source>
</pre>


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


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


===Variant tracks (VCF)===
===Variant tracks (VCF)===
Line 106: Line 106:
To load a VCF file in JBrowse make sure the file is gzipped and indexed
To load a VCF file in JBrowse make sure the file is gzipped and indexed


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


Line 117: Line 117:
       "type" : "HTMLVariants"
       "type" : "HTMLVariants"
     } ' | bin/add-track-json.pl data/trackList.json
     } ' | bin/add-track-json.pl data/trackList.json
</source>
</pre>


===Wiggle/BigWig tracks (WIG)===
===Wiggle/BigWig tracks (WIG)===


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


===Evidence tracks===
===Evidence tracks===
Line 130: Line 130:
Evidence tracks can be loaded in bed, gff and gbk format using  
Evidence tracks can be loaded in bed, gff and gbk format using  


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


Examples are given above.
Examples are given above.

Latest revision as of 10:01, 16 June 2023

Typical commands used to set up a JBrowse

Author: Martijn Derks

Install JBrowse

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

Make a directory in /shared/apps/jbrowse/ for your species of interested (e.g. mkdir Cyprinus_carpio). Move the downloaded JBrowse source files there. All further procedures detailed in this Wiki page assume working from that directory (NOTE: if your species of interest is already there, contact the maintainer of that JBrowse instance). Run the setup script to install perl dependencies and required modules

unzip JBrowse-1.12.0.zip
mv JBrowse-1.12.0/* $PWD
./setup.sh

Add reference sequence

Example code for chicken genome

bin/prepare-refseqs.pl --fasta /lustre/nobackup/WUR/ABGC/shared/public_data_store/genomes/chicken/Ensembl74/Gallus_gallus.Galgal4.74.dna.toplevel.fa

To remove tracks use following command:

bin/remove-track.pl -D --trackLabel 'trackname'

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:

bin/flatfile-to-json.pl --key "Genes" --type gene --config '{ "category": "GalGal4.83 Annotation" }' --trackLabel Genes --gff ../ensembl_data/Gallus_gallus.Galgal4.83.gff3

Add corresponding transcripts:

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

Alignment tracks (BAM)

You can load single BAM-files by following command:

bin/add-bam-track --label <label> --bam_url <url>

To load multiple BAM files present in a certain directory use:


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=`echo $bam | rev | cut -c 5- | cut -d'/' -f1 | rev` ## 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/'${tissue}'",
                "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/'${tissue}'",
                "category" : "3. RNA-seq alignments",
                "type" : "SNPCoverage"
        }' | bin/add-track-json.pl data/trackList.json

done

Make sure the BAM file can be read by a everybody if not use:

chmod +r <BAM_file>

Make sure that all directoryies in the full path of the BAMfile are executable:

chmod +x <dir>

Variant tracks (VCF)

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

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

Wiggle/BigWig tracks (WIG)

You can load single BigWig-files by following command:

bin/add-bw-track --label <label> --bw_url <url>

Evidence tracks

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

bin/flatfile-to-json.pl

Examples are given above.