Skip to main content

falcon

falcon

For more information:

The falcon spectrum clustering tool uses advanced algorithmic techniques for highly efficient processing of millions of MS/MS spectra. First, high-resolution spectra are binned and converted to low-dimensional vectors using feature hashing. Next, the spectrum vectors are used to construct nearest neighbor indexes for fast similarity searching. The nearest neighbor indexes are used to efficiently compute a sparse pairwise distance matrix without having to exhaustively compare all spectra to each other. Finally, density-based clustering is performed to group similar spectra into clusters.

The software is available as open-source under the BSD license.

If you use falcon in your work, please cite the following publication:

  • Wout Bittremieux, Kris Laukens, William Stafford Noble, Pieter C. Dorrestein. Large-scale tandem mass spectrum clustering using fast nearest neighbor searching. publication pending (2021).

Installation

falcon requires Python 3.8+ and is available on the Linux and OSX platforms.

You can easily install falcon with pip:

pip install falcon-ms

Running falcon

falcon can be run from the command line, with settings specified as command-line arguments or set in an INI config file. falcon takes peak files (in the mzML, mzXML, or MGF format) as input and exports the clustering result as a comma-separated file with each MS/MS spectrum and its cluster label on a single line. Representative spectra for each cluster can optionally be exported to an MGF file.

Example falcon run with some relevant command-line arguments:

falcon peak/*.mzml falcon --export_representatives --precursor_tol 20 ppm --fragment_tol 0.05 --eps 0.10

This will cluster all MS/MS spectra in mzML files in the peak directory with the specified settings and write (i) the cluster assignments to the falcon.csv file, and (ii) the cluster representatives to the falcon.mgf file.

For detailed information on all available settings, run falcon -h or falcon --help.

Important settings

Here we provide information on the most important settings that influence the falcon clustering performance. All settings have sensible default values which should give good results for a wide variety of datasets.

Spectrum comparison

  • precursor_tol: The precursor mass tolerance and unit (in ppm or Dalton) to compare spectra to each other.
  • fragment_tol: The fragment mass tolerance (in Dalton) used during spectrum comparison.

Clustering

  • eps: The maximum cosine distance between two spectra for them to be considered as neighbors of each other. This parameter crucially governs cluster purity (i.e. clusters contain spectra corresponding to only a single peptide). The ideal value of this parameter depends on the spectral characteristics of your data and optional spectrum preprocessing configured in falcon. Values between 0.05 and 0.15 will typically generate a pure clustering result. For more aggressive clustering values up to 0.30 can be used.

Nearest neighbor indexing (see below)

  • n_probe: The maximum number of lists in the inverted index to inspect during querying. Inspecting fewer lists will run faster but will give slightly less accurate clustering results.
  • n_neighbors and n_neighbors_ann: The final number of neighbors to consider for each spectrum and during nearest neighbor searching. Querying less neighbors will run faster but will give slightly less accurate clustering results. n_neighbors_ann should be equal or greater than n_neighbors.
  • hash_len: The length of the hashed vectors used for nearest neighbor searching. Larger vectors will minimize the number of hash collisions and more accurately approximate the true cosine distance, at the expense of longer nearest neighbor searching and memory requirements.

Spectrum preprocessing

  • There are several options to configure spectrum preprocessing prior to the clustering. See the command-line documentation for more information.

How does it work?

falcon spectrum clustering

  1. High-resolution MS/MS spectra are converted to low-dimensional vectors using feature hashing. First, spectra are converted to sparse vectors using small mass bins to tightly capture their fragment masses. Next, the sparse, high-dimensional, vectors are hashed to lower-dimensional vectors by using a hash function (the non-cryptographic MurmurHash3 algorithm) to map the mass bins separately to a small number of hash bins. This feature hashing conserves the cosine similarity between hashed vectors and can be used to approximate the similarity between the original spectra.
  2. Vectors are split into buckets based on the precursor m/z of the corresponding spectra to construct nearest neighbor indexes for highly efficient spectrum comparison. The spectrum vectors in each bucket are partitioned into data subspaces to create a Voronoi diagram, and all vectors are assigned to their nearest representative vector in an inverted index.
  3. A sparse pairwise distance matrix is computed by retrieving similarities to neighboring spectra using the nearest neighbor indexes. The accuracy and speed of similarity searching is governed by the number of neighboring cells to explore during searching: exploring more cells during searching decreases the chance of missing a nearest neighbor in the high-dimensional space, at the expense of a longer searching time.
  4. Density-based clustering using the pairwise distance matrix is performed to find spectrum clusters. The DBSCAN algorithm is used to find spectra that are close to each other and that form a dense data subspace, and group them into clusters.

Contact

For more information you can visit the official code website or send an email to wbittremieux@health.ucsd.edu.

Metadata

Release files for falcon-ms 0.1.3

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

Source distribution (sdist)

Source distribution for falcon-ms 0.1.3
File Size Uploaded Provenance
falcon-ms-0.1.3.tar.gz 584.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for falcon-ms 0.1.3
File Interpreter ABI Platform
falcon_ms-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 611.2 kB

Release files / falcon-ms-0.1.3.tar.gz

Download URL falcon-ms-0.1.3.tar.gz
Size 584.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f51109144549be037be7d8f0ce13598fb48d5c460f2b801222a8880aa61b8373
BLAKE2b-256 checksum
How to use checksums
6a35650f11394252edd370e446effb773c560c49f039297df0fc0fe30d333aab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / falcon_ms-0.1.3-py3-none-any.whl

Download URL falcon_ms-0.1.3-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e66d343002b5ec7e328f9d2526262e47285e9f41e4d5bd6ddff92b1a3b7005ab
BLAKE2b-256 checksum
How to use checksums
2c9b69d92bcc557ce7bf56b6925b8f708c2d0995bc593a9bb88a6a5cdd7791c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Security for falcon-ms 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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