Skip to content

NanoCount command line usage

Activate virtual environment

conda activate NanoCount
(NanoCount) 

Running NanoCount

Basic command

NanoCount -i ./data/aligned_reads.bam -o ./output/tx_counts.tsv
head ./output/tx_counts.tsv
## Checking options and input files ##
## Initialise Nanocount ##
    Parse Bam file and filter low quality hits
    Generate initial read/transcript compatibility index
## Start EM abundance estimate ##
    Progress: 3.00 rounds [00:00, 5.57 rounds/s]
    Exit EM loop after 3 rounds
    Convergence value: 0.0019235550878568812
## Summarize data ##
    Convert results to dataframe
    Compute estimated counts and TPM
    Write file
(NanoCount) transcript_name raw est_count   tpm
YHR174W_mRNA    0.5953263925577137  52155.35459919618   595326.3925577137
YGR192C_mRNA    0.02051266206449663 1797.073298146421   20512.66206449663
YLR110C_mRNA    0.009451191671993415    827.9999999999991   9451.191671993416
YOL086C_mRNA    0.00827549995434206 724.9999999999992   8275.49995434206
YKL060C_mRNA    0.00659757099808236 577.9999999999994   6597.57099808236
YPR080W_mRNA    0.005222125833257232    457.49999999999955  5222.1258332572315
YBR118W_mRNA    0.005222125833257232    457.49999999999955  5222.1258332572315
YLR044C_mRNA    0.0050680303168660346   443.99999999999955  5068.030316866035
YKL152C_mRNA    0.004166286183910141    364.99999999999966  4166.2861839101415
(NanoCount) 

Adding extra transcripts information

The extra_tx_info option adds a columns with the transcript lengths and also includes all the zero-coverage transcripts in the results

NanoCount -i ./data/aligned_reads.bam -o ./output/tx_counts.tsv --extra_tx_info
head ./output/tx_counts.tsv
## Checking options and input files ##
## Initialise Nanocount ##
    Parse Bam file and filter low quality hits
    Generate initial read/transcript compatibility index
## Start EM abundance estimate ##
    Progress: 3.00 rounds [00:00, 4.31 rounds/s]
    Exit EM loop after 3 rounds
    Convergence value: 0.0019235550878568812
## Summarize data ##
    Convert results to dataframe
    Compute estimated counts and TPM
    Write file
(NanoCount)     raw est_count   tpm transcript_length
YHR174W_mRNA    0.5953263925577137  52155.35459919618   595326.3925577137   1314
YGR192C_mRNA    0.02051266206449663 1797.073298146421   20512.66206449663   999
YLR110C_mRNA    0.009451191671993415    827.9999999999991   9451.191671993416   402
YOL086C_mRNA    0.00827549995434206 724.9999999999992   8275.49995434206    1047
YKL060C_mRNA    0.00659757099808236 577.9999999999994   6597.57099808236    1080
YBR118W_mRNA    0.005222125833257232    457.49999999999955  5222.1258332572315  1377
YPR080W_mRNA    0.005222125833257232    457.49999999999955  5222.1258332572315  1377
YLR044C_mRNA    0.0050680303168660346   443.99999999999955  5068.030316866035   1692
YKL152C_mRNA    0.004166286183910141    364.99999999999966  4166.2861839101415  744
(NanoCount) 

Relaxing the equivalence threshold

The default value is 0.9 (90% of the alignment score of the primary alignment) but this value could be lowered to allow more secondary alignments to be included in the uncertainty calculation. Lowering the value bellow 0.75 might not be relevant and will considerably increase the computation time.

NanoCount -i ./data/aligned_reads.bam -o ./output/tx_counts.tsv --equivalent_threshold 0.8
head ./output/tx_counts.tsv
## Checking options and input files ##
## Initialise Nanocount ##
    Parse Bam file and filter low quality hits
    Generate initial read/transcript compatibility index
## Start EM abundance estimate ##
    Progress: 17.0 rounds [00:03, 4.28 rounds/s]
    Exit EM loop after 17 rounds
    Convergence value: 0.004988077857734706
## Summarize data ##
    Convert results to dataframe
    Compute estimated counts and TPM
    Write file
(NanoCount) transcript_name raw est_count   tpm
YHR174W_mRNA    0.5847481080119605  51228.61224671184   584748.1080119605
YGR192C_mRNA    0.015286737423038144    1339.2404921575258  15286.737423038145
YGR254W_mRNA    0.011624369387633806    1018.3877533118225  11624.369387633806
YLR110C_mRNA    0.00945119167199341 827.9999999999986   9451.19167199341
YJR009C_mRNA    0.009088112600958011    796.1913687447295   9088.112600958011
YOL086C_mRNA    0.008275499954342055    724.9999999999987   8275.499954342056
YKL060C_mRNA    0.006597570998082356    577.9999999999991   6597.570998082356
YPR080W_mRNA    0.005222125833257228    457.49999999999926  5222.125833257228
YBR118W_mRNA    0.005222125833257228    457.49999999999926  5222.125833257228
(NanoCount) 

verbose mode

Print additional information for QC and debugging

NanoCount -i ./data/aligned_reads.bam -o ./output/tx_counts.tsv --equivalent_threshold 0.8  --verbose
## Checking options and input files ##
    [DEBUG]: Options summary
    [DEBUG]:    Package name: NanoCount
    [DEBUG]:    Package version: 0.2.0
    [DEBUG]:    Timestamp: 2020-05-04 17:50:28.732014
    [DEBUG]:    quiet: False
    [DEBUG]:    verbose: True
    [DEBUG]:    extra_tx_info: False
    [DEBUG]:    max_em_rounds: 100
    [DEBUG]:    convergence_target: 0.005
    [DEBUG]:    scoring_value: alignment_score
    [DEBUG]:    equivalent_threshold: 0.8
    [DEBUG]:    min_query_fraction_aligned: 0.5
    [DEBUG]:    min_read_length: 50
    [DEBUG]:    count_file: ./output/tx_counts.tsv
    [DEBUG]:    alignment_file: ./data/aligned_reads.bam
## Initialise Nanocount ##
    Parse Bam file and filter low quality hits
    [DEBUG]: Summary of reads parsed in input bam file
    [DEBUG]:    Mapped hits: 156,984
    [DEBUG]:    Valid best hit: 87,608
    [DEBUG]:    Valid secondary hit: 50,657
    [DEBUG]:    Invalid secondary hit: 15,746
    [DEBUG]:    Unmapped hits: 9,545
    [DEBUG]:    Wrong strand hits: 4,515
    [DEBUG]:    Best hit with low query fraction aligned: 1,628
    Generate initial read/transcript compatibility index
## Start EM abundance estimate ##
    [DEBUG]: EM Round: 1 / Convergence value: 1
    [DEBUG]: EM Round: 2 / Convergence value: 0.0907318210858972
    [DEBUG]: EM Round: 3 / Convergence value: 0.07354276996650695
    [DEBUG]: EM Round: 4 / Convergence value: 0.06026990671840486
    [DEBUG]: EM Round: 5 / Convergence value: 0.04950001350157995
    [DEBUG]: EM Round: 6 / Convergence value: 0.04069150240883942
    [DEBUG]: EM Round: 7 / Convergence value: 0.03347231888298066
    [DEBUG]: EM Round: 8 / Convergence value: 0.027551111299293083
    [DEBUG]: EM Round: 9 / Convergence value: 0.022692444013615403
    [DEBUG]: EM Round: 10 / Convergence value: 0.01870436600002255
    [DEBUG]: EM Round: 11 / Convergence value: 0.015429950966955779
    [DEBUG]: EM Round: 12 / Convergence value: 0.012740756287666424
    [DEBUG]: EM Round: 13 / Convergence value: 0.010531631581908925
    [DEBUG]: EM Round: 14 / Convergence value: 0.008716356976576946
    [DEBUG]: EM Round: 15 / Convergence value: 0.007224220701882046
    [DEBUG]: EM Round: 16 / Convergence value: 0.005997296467165983
    [DEBUG]: EM Round: 17 / Convergence value: 0.004988077857734706
    Exit EM loop after 17 rounds
    Convergence value: 0.004988077857734706
## Summarize data ##
    Convert results to dataframe
    Compute estimated counts and TPM
    Write file
(NanoCount) 

NanoCount help

NanoCount --help
usage: NanoCount [-h] [--version] -i ALIGNMENT_FILE [-o COUNT_FILE]
                 [-l MIN_READ_LENGTH] [-f MIN_QUERY_FRACTION_ALIGNED]
                 [-t EQUIVALENT_THRESHOLD] [-s SCORING_VALUE]
                 [-c CONVERGENCE_TARGET] [-e MAX_EM_ROUNDS] [-x] [-v] [-q]

EM based transcript abundance from nanopore reads mapped to a transcriptome
with minimap2

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit

Input/Output options:
  -i ALIGNMENT_FILE, --alignment_file ALIGNMENT_FILE
                        BAM or SAM file containing aligned ONT dRNA-Seq reads
                        including secondary and supplementary alignment
                        (required) [str]
  -o COUNT_FILE, --count_file COUNT_FILE
                        Output file path where to write estimated counts (TSV
                        format) (default: None) [str]

Misc options:
  -l MIN_READ_LENGTH, --min_read_length MIN_READ_LENGTH
                        Minimal length of the read to be considered valid
                        (default: 50) [int]
  -f MIN_QUERY_FRACTION_ALIGNED, --min_query_fraction_aligned MIN_QUERY_FRACTION_ALIGNED
                        Minimal fraction of the primary hit query aligned to
                        consider the read valid (default: 0.5) [float]
  -t EQUIVALENT_THRESHOLD, --equivalent_threshold EQUIVALENT_THRESHOLD
                        Fraction of the alignment score or the alignment
                        length of secondary hits compared to the primary hit
                        to be considered valid hits (default: 0.9) [float]
  -s SCORING_VALUE, --scoring_value SCORING_VALUE
                        Value to use for score thresholding of secondary hits
                        either "alignment_score" or "alignment_length"
                        (default: alignment_score) [str]
  -c CONVERGENCE_TARGET, --convergence_target CONVERGENCE_TARGET
                        Convergence target value of the cummulative difference
                        between abundance values of successive EM round to
                        trigger the end of the EM loop. (default: 0.005)
                        [float]
  -e MAX_EM_ROUNDS, --max_em_rounds MAX_EM_ROUNDS
                        Maximum number of EM rounds before triggering stop
                        (default: 100) [int]
  -x, --extra_tx_info   Add transcripts length and zero coverage transcripts
                        to the output file (required valid bam/sam header)
                        (default: False) [boolean]

Verbosity options:
  -v, --verbose         Increase verbosity for QC and debugging (default:
                        False) [boolean]
  -q, --quiet           Reduce verbosity (default: False) [boolean]
(NanoCount)