# chimera_utils

[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Build Status](https://travis-ci.org/friend1ws/chimera_utils.svg?branch=devel)](https://travis-ci.org/friend1ws/chimera_utils)


## Introduction 

This is a suite of tools for processing chimeric reads generated at a STAR alignment step (Chimeric.out.sam files).

## Dependency

### Python
Python (>= 2.7), pysam, [annot_utils](https://github.com/friend1ws/annot_utils), [fusionfusion](https://github.com/Genomon-Project/fusionfusion)

### Software
[htslib](http://www.htslib.org), [bedtools](http://bedtools.readthedocs.io/en/latest/)


## Install

```
pip install chimera_utils
```

Alternatively you can download from the source code:
```
wget https://github.com/friend1ws/chimera_utils/archive/v0.5.0.tar.gz
tar zxvf v0.5.0.tar.gz
cd chimera_utils-0.5.0
python setup.py build install
```

For the last command, you may need to add --user if using a shared computing cluster.

## Commands

### count
Count supporting read pairs for each chimera junction

```
chimera_utils count [-h] [--abnormal_insert_size ABNORMAL_INSERT_SIZE]
                          [--min_major_clipping_size MIN_MAJOR_CLIPPING_SIZE]
                          [--min_read_pair_num MIN_READ_PAIR_NUM]
                          [--min_cover_size MIN_COVER_SIZE]
                          [--anchor_size_thres ANCHOR_SIZE_THRES]
                          [--min_chimeric_size MIN_CHIMERIC_SIZE] [--debug]
                          Chimeric.out.sam output_file
```

### merge_control
Merge chimeric junction cout file (generated by `count` command) of control data (typically) for later filtering

```
chimera_utils merge_control [-h] chimeric_count_list.txt output_file
```

### associate
Associate chimeric junctions with the output of GenomonSV

```
chimera_utils associate [-h] [--margin MARGIN]
                               [--sv_margin_major SV_MARGIN_MAJOR]
                               [--sv_margin_minor SV_MARGIN_MINOR]
                               [--genome_id {hg19,hg38,mm10}] [--grc]
                               [--debug]
                               chimera.txt genomonSV.result.txt output.txt
```
