Generating list of known fusions for Arriba from COSMIC The RNA-Seq fusion detection program Arriba features the ability to white-list known gene fusions, specifically the authors recommend using COSMIC as a source of these here. Specifically they state:


  A comprehensive list of known fusions can be obtained from CancerGeneCensus in the section titled "Complete Fusion Export". Depending on the gene annotation that is used to run arriba, some gene names need to be adjusted. 


Emphasis is mine to highlight the issue here!

The state the format of the input file they require to be:


  The file has two columns separated by a tab. Each line lists a pair of
  genes. The order of the genes is irrelevant. arriba searches for both
  genes as the 5' end and the 3' end of a fusion. Lines starting with a
  hash (#) are treated as comments. Optionally, the file can be
  gzip-compressed.


However the format of the download from COSMIC is somewhat different:

Sample ID       Sample name     Primary site    Site subtype 1  Site subtype 2  Site subtype 3  Primary histology       Histology subtype 1     Histology subtype 2     Histology subtype 3     Fusion ID       Translocation Name      Fusion Type     PUBMED_PMID     ID_STUDY
WWWWWWW WWWWWWW thyroid NS      NS      NS      carcinoma       papillary_carcinoma     follicular_variant      NS                              16784981
WWWWWWW WWWWWWW thyroid NS      NS      NS      carcinoma       papillary_carcinoma     follicular_variant      NS      1271    CCDC6{ENST00000263102}:r.1_535_RET{ENST00000355710}:r.2369_5659 Observed mRNA   16784981
WWWWWWW WWWWWWW thyroid NS      NS      NS      carcinoma       papillary_carcinoma     follicular_variant      NS      1272    CCDC6{ENST00000263102}:r.1_535_RET{ENST00000355710}:r.2369_5659 Inferred Breakpoint     16784981
XXXXXXX XXXXXXX thyroid NS      NS      NS      carcinoma       papillary_carcinoma     follicular_variant      NS                              16784981
YYYYYYY YYYYYYY thyroid NS      NS      NS      carcinoma       papillary_carcinoma     follicular_variant      NS                              16728576
YYYYYYY YYYYYYY thyroid NS      NS      NS      carcinoma       papillary_carcinoma     follicular_variant      NS      1216    PAX8{NM_003466.2}:r.?_PPARG{NM_015869.2}:r.?    Inferred Breakpoint     16728576


Note: numeric samples IDs have been deliberately replaced with letters here.

Using this file, as is, will cause arriba to spurt out many warnings that the gene names in the first two columns are not recognised:

WARNING: unknown gene in known fusions list: XXXXXXX

From the looks of the rest of my arriba output the currency of gene IDs its using would appear to be gene symbols taken from the gencode.gft I'm supplying it.

I'm thus assuming the format arriba requires for a known gene list to be:

SYMB1   SYMB2
SYMB3   SYMB4


Where the record separator is a tab character \t

My question is how can I reprocess the COSMIC "Complete Fusion Export" .tsv file to the format required for arriba to act as a white-list?
I managed to solve this with a one-liner:

grep -v 'Sample ID' CosmicFusionExport.tsv | cut -f 12 | grep -v -e '^$' | perl -lne '/^(\S+?)\{\S+\d+}\S+_(\S+?)\{/; print "$1\t$2"' | sort -u &gt; CosmicFusionList.tsv 


The various parts of the piped command are as follows:


Remove header:grep -v 'Sample ID' CosmicFusionExport.tsv |
Extract 12th field (Translocation Name):cut -f 12 |
Remove blank entries:grep -v -e '^$' |
Extract gene symbols from 12th column:perl -lne '/^(\S+?)\{\S+\d+}\S+_(\S+?)\{/; print "$1\t$2"' |
Remove duplicate lines:sort -u &gt; CosmicFusionList.tsv
Optionally the final two stages could be:sort -u | gzip -c &gt; CosmicFusionList.tsv.gz to make use of file compression (for what it's worth on a 3.9 kB file)


Since the authors of arriba have neglected to document this necessary data munging step, I've posted it here in Q and A format in the hope that it will be useful to others, and other solutions can be proposed.