Author: Jackson Killian

The python script, get_reads.py, was designed to facilitate extraction of reads local 
to a user-specified fusion junction.

IMPORTANT NOTES: 

	1. get_reads.py accesses reads based on their location and thus requires
	   aligned files to be in bam format in a directory with a matching index file.

	2. This download comes with a file of all known exons: "exons_hg19.bed". After
	   saving this file on your system, direct get_reads.py to this file with the
	   -b option or edit the constant EXON_BEDFILE on line 39 to equal the location
	   where you saved the bed file.

	3. To make passing the coordinates of a given junction to get_reads.py clean and 
	   easy, a simple file format should be used, described below.

	4. IMPORTANT: Coordinates should be given with respect to hg19.
	
	5. get_reads.py uses PySAM to facilitate read extraction. Before running this 
	   script, please install the PySAM python module (try: pip install pysam)

	6. get_reads.py requires python2.7.

FORMAT SPECIFICATIONS for the fusion "breakpoint" file.
	- Must be tab delimited and have the following fields in this order:
		- Chromosome
		- Position
		- Reference Length (base pairs away from the breakpoint from which to 
		  extract reads in both directions.)
	- Additional Fields (optional, but useful for documenting breakpoint information 
	  to input to FuSpot website.)
                - Strand
                - Gene Name

Example for a fusion point over the genes THRB -> ADC:
chr3	24185110	300	-   THRB
chr1	33585662	250	+   ADC


OPTIONS:

get_reads.py also provides options to help speed up extraction time if input bam files
are large:
	- Smart-binning: For file sizes > 1gb and for regions having > 500 reads, take
	  only one read from each window of 10 base pairs (use -sbin or --smart-binning).
	- Force-binning: Engage binning regardless of file size or number of reads in 
	  region (use -fbin or --force-binning).

	Note: Activating either of the above options will potentially skip mates that may
	align over the fusion point. Leave these deactivated to see ALL reads from the
	given regions at the expense of extraction speed.


EXAMPLE COMMAND LINE RUN:

python get_reads.py -sbin breakpoint.txt Chimeric.out.bam
