Quickstart¶
FinaleToolkit works the same way from the command line or from Python. Pick whichever fits your workflow. The features and results are identical.
Command line¶
List the available subcommands:
$ finaletoolkit --help
A few representative runs:
$ finaletoolkit coverage sample.bam intervals.bed -o coverage.bed
$ finaletoolkit wps sample.bam tss.bed --chrom-sizes hg38.chrom.sizes -o wps.bw -t 8
$ finaletoolkit end-motifs sample.bam hg38.2bit -k 4 -o motifs.tsv
$ finaletoolkit delfi sample.bam autosomes.chrom.sizes hg19.2bit bins.bed -g hg19 -o delfi.tsv
Every subcommand has its own --help with a worked example. Flags are
consistent across commands, so once you learn them they transfer everywhere:
Flag |
Meaning |
|---|---|
|
Output file path. Use |
|
Reference FASTA file (required for CRAM input). |
|
Minimum mapping quality. |
|
Fragment-length bounds, in base pairs. |
|
Number of worker processes. |
|
Increase verbosity. Repeat for more detail ( |
|
k-mer length (motif commands). |
Tip
- as an output means “write to standard output” instead of a file, so
you can pipe results into another tool, for example
finaletoolkit mds motifs.tsv -o - | less.
See the CLI Reference for the complete reference.
Python API¶
Everything is reachable from the top-level finaletoolkit namespace:
import finaletoolkit as ftk
cov = ftk.coverage("sample.bam", "intervals.bed", output_file=None)
motifs = ftk.end_motifs("sample.bam", "hg38.2bit", k=4)
mds = motifs.motif_diversity_score()
The package is also organized into submodules, which remain importable:
Submodule |
Contents |
|---|---|
|
Fragmentomic feature generation. |
|
Utilities for genome tracks and gaps. |
|
Helpers that simplify feature generation. |
|
Reference and alignment or fragment wrappers. |
|
Command-line interface. |
To load a specific function from its submodule:
>>> from finaletoolkit.frag import delfi
See also
For end-to-end tutorials, see the wiki. For the full Python surface, see the API Reference.