esrice / PBJelly

a fork of the gap-closing pipeline PBJelly
Other
13 stars 3 forks source link

PBJelly

a fork of the gap-closing pipeline PBJelly

PBJelly is software for closing gaps in genome assemblies using long reads. The last release of PBSuite was in 2015, and it no longer appears to be supported. I was trying to use it but had trouble installing the old versions of blasr and networkx as they are not available on anaconda like newer versions are, so I gave up and just edited the source code to work with blasr 5.3.2 and networkx 2.2. It works for me now, so I'm putting the edited code here in case others run into the same issue.

The original PBSuite license still applies; please cite the PBJelly paper if you're using this software as it is still >99% the work of these authors:

English, Adam C., Stephen Richards, Yi Han, Min Wang, Vanesa Vee, Jiaxin Qu, Xiang Qin, et al. "Mind the Gap: Upgrading Genomes with Pacific Biosciences RS Long-Read Sequencing Technology." PLoS ONE 7, no. 11 (November 21, 2012): e47768. (link)

Running the pipeline works just like before; the original README, slightly modified, is below.

Contents

  1. Using This README
  2. Requirements
  3. Installation
  4. Quick Start
  5. Running Jelly
  6. Extras

1. Using This README

Toy Data: Provided with this distribution of Jelly is a toy example inside of docs/jellyExample directory. Use this once you've setup Jelly to test that everything is working as expected and to become familiar with the software.

2. Requirements

Blasr I have tested this with blasr 5.3.2. Blasr must be in your environment path.

Python 2.7 Python must be in your environment path and 2.7 should be the default version of python. I recommend making an anaconda environment like this:

conda create -n py27 --python=2.7
source activate py27

Networkx I have tested this with version 2.2. Ought to work with 2.*. If you use the above method to create a python2.7 conda environment it will come with networkx installed.

3. Installation

1) Edit setup.sh and change $SWEETPATH to the full directory where you've placed the package.

2) To automatically place the package into your environment, add source /setup.sh to your .bash_profile.

Be sure to source your .bash_profile (or just setup.sh) before using Jelly.

4. Quick Start

For more details on each step in the pipeline, see Section V below. If, however, you'd like to just run the program do the following.

Create your Protocol.xml

To run the lambdaExample dataset provided, edit the paths in the , and the baseDir attribute in the inputs tag to the full path in which lambdaExample is sitting. See Section V.1 for details about creating Protocol.xml

Run each stage

Sequentially execute each state. One stage must finish executing before continuing to the next. To run a stage, use the command

Jelly.py <stage> yourProtocol.xml

The stages, in order, and their descriptions are

  1. setup: Tag sequence names, find gaps, and index the reference
  2. mapping: Use blasr to map the sequences to the reference
  3. support: Identify which reads support which gaps
  4. extraction: For each gap, consolidate all reads supporting it into a local-assembly folder.
  5. assembly: Build the consensus gap-filling sequence
  6. output: Stitch the reference sequences and gap-fillling sequences together.

To get help with Jelly, simply run Jelly.py --help. Or, for help with any stage, simply run

Jelly.py <stage> --help

Descriptions of each step are in Section 5.

Passing Parameters through Jelly.py

If you would like to pass a parameter to the stage you are running, use "-x". For example, when running the support stage, if you only wanted Jelly to attempt to fill captured-gaps (i.e. no inter-scaffold gaps), and you wanted to require that a read must have a minimum mapping QV of >= 250 to support a gap, you'd use the command:

Jelly.py support Protocol.xml -x "--capturedOnly --minMapqv=250"

All parameters you add need to be enclosed in double quotes after the -x

5. Running Jelly

Pre-Processing

Initial Stats

If you would like to get some size information about your reference and/or input reads run

summarizeAssembly.py <reference.fasta> 
readSummary.py <Protocol.xml>

see summarizeAssembly.py --help and readSummary.py for details

Prepare your input data

Gather the paths to your reference and all of your input sequence files. If using PacBio reads, use filtered subreads where SMRTBell adapters have been removed.

If you have a small number of very large sequence files and you want to speed up processing, split those into several smaller files. Jelly will submit one mapping/support job per sequence file.

Every sequence file you use has the following requirements:

Create Your Protocol

This is by far the longest and most involved step. Once you get past this, Jelly makes the rest of the workflow super easy. See TemplateProtocol.xml for an idea of what a protocol should look like. You can name your protocol whatever you'd like.

Below are the elements needed for a Protocol.

Setup your files

Jelly.py setup Protocol.xml

All of the files Jelly creates regarding your reference will be placed in the same directory beside the reference

Mapping your data

Jelly.py mapping Protocol.xml

Remember to wait until given stage is finished before running the next stage. Standard Error and Standard Output Logs for each step are placed next to the data Jelly creates. For the mapping step, this is found in /mapping/

Support The Gaps

Jelly.py support Protocol.xml

Extract Useful Reads

Jelly.py extraction Protocol.xml

Assemble The Gaps

Jelly.py assembly Protocol.xml

If you have access to more than one core per gap to be assembled, be sure to tell Jelly to pass the nproc parameter to the assembly stage via:

Jelly.py assembly Protocol.xml -x "--nproc=4"

Where 4 can be replaced by the number of cores you're using.

Output Your Results =

Jelly.py output Protocol.xml

At the head of your log file, you can find information about how many gaps were addressed, filled, etc. The output stage collects all of your results into 3 files:

/pbjelly.out.fasta /pbjelly.out.qual /liftOverTable.json ## 6. Extras blasrToBed.py This script will convert blasr's .m4 or .m5 format into a BED Format file ( http://genome.ucsc.edu/FAQ/FAQformat.html#format1 ) If you would like to visualize the alignments, I reccommend using IGB ( http://bioviz.org/igb/index.html ). bedToCoverageWig.py Turn a bed file with alignments into a depth of coverage WIG Format file ( http://genome.ucsc.edu/FAQ/FAQformat.html#format6 ).