fibertools-rs
fibertools-rs a CLI tool for creating and interacting with fiberseq bam files.
Install
From crates.io 
Installation from crates.io requires the rust package manager cargo. You can find how to install cargo here.
Furthermore, a recent version of gcc and cmake is required. I have tested and recommend gcc v10.2.0 and cmake v3.21.1, though other versions may work.
cargo install fibertools-rs
From bioconda 
mamba install -c conda-forge -c bioconda fibertools-rs
From github (active development)
cargo install --git https://github.com/mrvollger/fibertools-rs
Usage
Subcommands for fibertools-rs
ft predict-m6a
Help page for predict-m6a. Predict m6A positions using HiFi kinetics data and encode the results in the MM and ML bam tags.
We recommend filtering out ML scores less than 250 for the XGBoost model.
Installing with support for CNN m6A prediction
To allow for m6A predictions with the CNN model you must follow these modified installation instructions.
- Get
libtorchv1.13.0 from the PyTorch website download section and extract the content of the zip file.- On my linux system with a cuda gpu this is what I downloaded:
wget https://download.pytorch.org/libtorch/cu116/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcu116.zip
- Add the following to your
.bashrcor equivalent, where/path/to/libtorchis the path to the directory that was created when unzipping the file:
# e.g. export LIBTORCH=/Users/mrvollger/lib/libtorch
And install fibertools-rs from cargo with the cnn feature enabled:
Adding nucleosome calls to the BAM files
To add nucleosome calls to the BAM files you can use the python package fibertools. See that repository for installation and instructions.
ft extract
Help page for extract. Extracts fiberseq data from a bam file into plain text.
ft extract --all
The extract all option is a special option that tries to extract all the fiberseq data into a tabular format. The following is an image of the output. Note that the column names will be preserved across different software versions (unless otherwise noted); however, the order may change and new columns may be added. Therefore, when loading the data (with pandas e.g.) be sure to use the column names as opposed to indexes for manipulation.

ft center
Help page for center. Center fiberseq reads (bam) around reference position(s).

Read the fibertools docs
You can find the docs for the latest release here: https://docs.rs/fibertools-rs/latest/fibertools_rs/ or download from source and run:
cargo doc --open --features cnn
and the docs will open in your browser.
TODO items
- Use new iterator for
ft extractand group writes to try and improve the speed - Set filters for ML depending on the model used
- long format extract command
- Add
rustybamstats to ftallas an option - add option result to bamlift
- Add more test cases, learn about test modules in folders
- Test GPU support, see if I can simplify or statically link PyTorch.
- Improve progress bar for predict-m6a.
- Get size of bam, say how far we are through the bam in terms of MB/GB?
- Add unaligned, secondary, supplemental reads to the test bam.
- Detect GPU memory to set batch size dynamically.