remove-unspliced-rnas

Remove unspliced RNAs from a coordinate-sorted BAM file of RNA reads (or assembled transcripts). A read is kept when one of its primary or supplementary alignments reaches the minimum mapping quality and either splices (has an N CIGAR operation) or overlaps a single-exon reference transcript. Secondary alignments are ignored and are not written. The output BAM holds the kept reads’ primary and supplementary alignments, in the order of the input; an output file that is one of the input files is refused. The single-exon transcripts are those that pass the four annotation filters. At the default filter (protein_coding, levels 1 and 2) every read on chrM is removed: the mitochondrial protein-coding genes are GENCODE level 3 and their mRNAs are unspliced. Exacto translates with the standard genetic code only, so mitochondrial proteins are out of scope.

Usage

Template:

exacto remove-unspliced-rnas \
    --bam-file <bam_file> \
    --bam-bai-file <bam_bai_file> \
    --reference-gene-annotation-file <reference_gene_annotation_file> \
    --reference-gene-annotation-source <reference_gene_annotation_source> \
    --reference-gene-annotation-assembly <reference_gene_annotation_assembly> \
    --reference-gene-annotation-version <reference_gene_annotation_version> \
    --output-bam-file <output_bam_file> \
    --output-bam-bai-file <output_bam_bai_file> \
    [--num-threads NUM_THREADS] \
    [--min-mapping-quality MIN_MAPPING_QUALITY] \
    [--gene-types GENE_TYPES [GENE_TYPES ...]] \
    [--gene-levels GENE_LEVELS [GENE_LEVELS ...]] \
    [--transcript-types TRANSCRIPT_TYPES [TRANSCRIPT_TYPES ...]] \
    [--transcript-levels TRANSCRIPT_LEVELS [TRANSCRIPT_LEVELS ...]]

Example:

exacto remove-unspliced-rnas \
    --bam-file tumor_rna.sorted.bam \
    --bam-bai-file tumor_rna.sorted.bam.bai \
    --reference-gene-annotation-file gencode.gtf.gz \
    --reference-gene-annotation-source gencode \
    --reference-gene-annotation-assembly hg38 \
    --reference-gene-annotation-version v45 \
    --output-bam-file tumor_rna.spliced.sorted.bam \
    --output-bam-bai-file tumor_rna.spliced.sorted.bam.bai

Description

Remove unspliced RNAs from a coordinate-sorted BAM file of RNA reads (or assembled transcripts). A read is kept when one of its primary or supplementary alignments reaches the minimum mapping quality and either splices (has an N CIGAR operation) or overlaps a single-exon reference transcript. Secondary alignments are ignored and are not written. The output BAM holds the kept reads’ primary and supplementary alignments, in the order of the input; an output file that is one of the input files is refused. The single-exon transcripts are those that pass the four annotation filters. At the default filter (protein_coding, levels 1 and 2) every read on chrM is removed: the mitochondrial protein-coding genes are GENCODE level 3 and their mRNAs are unspliced. Exacto translates with the standard genetic code only, so mitochondrial proteins are out of scope.

NoteAt a glance

Inputs: *.bam, *.bam.bai (coordinate-sorted RNA reads or assembled transcripts), *.gtf.gz (gene annotation)

Outputs: Filtered *.bam, *.bam.bai (new files; an output that is one of the inputs is refused)

Typical next step: cluster-rna-reads with --remove-unspliced-rnas no (it applies the same filter by default)

Required arguments

Flag Type Description
--bam-file str Input coordinate-sorted BAM file of RNA reads (or assembled transcripts).
--bam-bai-file str Input BAM.BAI file.
--reference-gene-annotation-file str Reference gene annotation file.
--reference-gene-annotation-source str Reference gene annotation source.
--reference-gene-annotation-assembly str Reference gene annotation assembly (e.g. ‘hg38’).
--reference-gene-annotation-version str Reference gene annotation version (e.g. ‘v41’).
--output-bam-file str Output BAM file (must not be the input BAM file).
--output-bam-bai-file str Output BAM.BAI file.

Optional arguments

Flag Type Default Description
--num-threads int 4 Number of threads.
--min-mapping-quality int 30 Minimum mapping quality.
--gene-types str protein_coding Reference gene types to include in annotation; give the flag with no values for no filter.
--gene-levels int 1, 2 Reference gene levels to include in annotation; give the flag with no values for no filter.
--transcript-types str protein_coding Reference transcript types to include in annotation; give the flag with no values for no filter.
--transcript-levels int 1, 2 Reference transcript levels to include in annotation; give the flag with no values for no filter.