Skip to main content

PhantomBuster is a bioinformatical tool that removes phantom barcode combinations that occur due to single-nucleotide sequencing errors and index hopping. It is written for lineage-tracing experiments and CRISPR-screens, but can be used for any experimental setups in which only barcodes and no genetic DNA is measured.

Installation

PhantomBuster is available via pypi and can be installed with standard python tools like pip or pipx.

pipx install phantombuster

QuickStart

PhantomBuster is a command line tool which can be run via the phantombuster command. It consists of four main steps: (1) demultplexing, (2) error correction of random barcodes, (3) hopping removal and (4) thresholding. For CRISPR-screens a separate script can calculate p-values for guides.

Demultiplexing

PhantomBuster demultiplexes BAM or FASTQ files, extracts all specified barcodes while error correcting barcodes with known reference sequences. For demultiplexing additional worker processes must be started.

phantombuster demultiplex [INPUTFILE] --outdir [DIR] --barcode-hierarchy-file [FILE] --regex-file [FILE] 
phantombuster worker --outdir [DIR]

INPUTFILE must be a csv file that lists all BAM and FASTQ files that are processed.

Example input_files.csv:

file
101.bam

The barcode hierarchy file is a csv file that lists all barcodes to be extracted. The order of the barcodes creates a hierarchy, in which barcodes higher up the hierarchy are more general, while barcodes lower in the hierarchy are more specific. The hierarchy is used in the second step error correction, in which two random barcode sequences are only compared, if all barcode sequences higher up the hierarchy are the same. Example barcode_hierarchy.csv

barcode,type,referencefile,threshold,min_length,max_length
sample,reference,sample_barcodes.csv,auto,-,-
lib,reference,library_barcodes.csv,1,-,-
lid,random,-,-,50,50

The regex file is a csv file that specifies for each read region how to extract barcodes by a regular expression.

Example regexes.csv:

tag,regex
b2,"^[ACGTN]{3}(?P<sample>[ACGTN]{5})"
query,"(?P<lid>[ACGTN]{5,6}(?P<lib>ACGT|GTAC){s<=1}[ACGTN]+)"

The outdir is a directory that contains all output and temporary files. The same out directory must be passed to all stages of phantombuster.

Error Correction

The error correction step employs the UMI-tools error correction algorithm to error correct random barcode sequences. For error correction additional worker processes must be started.

phantombuster error-correct --outdir [DIR] --barcode-hierarchy-file [FILE]
phantombuster worker --outdir [DIR]

The out dir and barcode hierarchy file must be the same as in the demultiplexing step.

Index Hopping Removal

The index hopping removal step removes barcode combinations that likely arised due to index hopping. For index hopping removal no worker processes need to be started.

phantombuster hopping-removal --outdir [DIR] [HOPPING_BARCODES]

The out dir must be the same as in the previous steps. The barcodes to test must correspond to one or a combination of barcodes of the barcode hierarchy (sample). Combinations can be given seperated by commas (sample,lid). Multiple barcodes or combinations can be given and are then processed one after another (sample,lid lib) It is recommended to test the combination of barcodes on the i5 index and then the combination of barcodes on the i7 index.

Thresholding

Thresholding removes all barcode combinations with a read count below a user defined threshold. Seperate Thresholds can be chosen for different values of barcodes, for example for each sample. For tresholding no worker processes need to be started.

phantombuster threshold --outdir [DIR] --threshold-file [FILE]

Example thresholds.csv:

sample,threshold
sample1,10

Metadata

Release files for phantombuster 0.20.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phantombuster 0.20.5
File Size Uploaded
phantombuster-0.20.5.tar.gz 67.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phantombuster 0.20.5
File Interpreter ABI Platform
phantombuster-0.20.5-py3-none-any.whl Python 3 none any Details

Total release size: 135.8 kB

Release files / phantombuster-0.20.5.tar.gz

Download URL phantombuster-0.20.5.tar.gz
Size 67.0 kB
Tags Source
SHA-256 checksum
How to use checksums
11a2265305bee2f1a1dc2e0feb0bafb06de5d656b909650ca532f55f636a900d
BLAKE2b-256 checksum
How to use checksums
f70102bfd33da73532cb7263c9eaaef1c79f374840c92e86a340f4e28b6f1d80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / phantombuster-0.20.5-py3-none-any.whl

Download URL phantombuster-0.20.5-py3-none-any.whl
Size 68.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fbe51c386e7c37364a7e228e94a4c47d63ba6355a28733e2bbd3143309aac6f
BLAKE2b-256 checksum
How to use checksums
a45e4c1e36efa001b9a64cb67557140fb03049ad02cd61950f5837f6c3667810
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.20.5 This release

2 release files

0.20.4

2 release files

0.20.3

2 release files

0.20.2

2 release files

0.20.1

1 release file

0.20.0

1 release file

0.17.2

1 release file

0.16.4

1 release file

0.16.1

5 release files

0.14.0

5 release files

0.13.2

5 release files

0.12.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page