Length Counts
cfdna lengths writes <prefix>.length_counts.tsv.zst. Load fragment length-count TSV outputs and return counts, fractions, or densities as arrays, matrices, vectors, or data frames.
This is loader API documentation, not command-line help. See cfdna lengths for command flags and output generation.
Quick Use
- Python
- R
import cfdnalab as cfl
lengths = cfl.read_lengths("sample.length_counts.tsv.zst")
bins = lengths.length_bins()
counts = lengths.counts_array(with_length_range=(100, 221))
fractions = lengths.data_frame(value="fraction")
library(cfdnalab)
lengths <- read_lengths("sample.length_counts.tsv.zst")
bins <- length_bins(lengths)
counts <- length_counts_matrix(lengths, with_length_range = c(100L, 221L))
fractions <- length_data_frame(lengths, value = "fraction")
Notes
- Use
with_lengths,with_length_range, or direct length-bin indices to select bins. - For fractions and densities,
denominatorcontrols whether totals use all bins or selected bins.
Function Index
- Python
- R
| Symbol | Type | Summary |
|---|---|---|
read_lengths | function | Read a cfDNAlab length-count TSV and return the matching loader class. |
LengthCounts | class | Common API for global, windowed, and grouped length-count outputs. |
GlobalLengthCounts | class | Length counts for global output. |
WindowedLengthCounts | class | Length counts for fixed-size or BED-window output. |
GroupedLengthCounts | class | Length counts for grouped BED output. |
Full details: Python API.
| Topic | Summary |
|---|---|
read_lengths | Loads a <prefix>.length_counts.tsv.zst file created with the cfdna lengths CLI command. |
length_bins | Return length-bin metadata. |
length_bin_idx | Look up the length-bin index containing a fragment length. |
length_counts_matrix | Return length-count values as a matrix. |
length_counts_vector | Return global length-count values as a vector. |
length_data_frame | Return length-count values as a data frame. |
window_metadata | Return window metadata. |
group_metadata | Return group metadata. |
group_idx | Look up a group index. |
Full details: R API.