Package: breakfast
breakfast - FAST outBREAK detection and sequence clusteringbreakfastis a simple and fast script developed for clustering SARS-CoV-2 genomes using precalculated sequence features (e.g. nucleotide substitutions) fromcovSonarorNextclade.This project is under development and in experimental stageInstallationInstallation using conda/mambaBreakfast is available inbioconda. You can install it using either the conda command, or if you've installedmambayou can use that:$ conda install breakfast
# or
$ mamba install breakfastInstallation using pipConda is available fromPyPIand can be installed using pip:$ pip install breakfastExample Command Line UsageSimple test runbreakfast \
   --input-file breakfast/test/testfile.tsv  \
   --max-dist 1 \
   --outdir test-run/You will find your results intest-run/cluster.tsv, which should be identical tobreakfast/test/expected_clusters_dist1.tsvUsing breakfast with input from covsonarbreakfast uses pre-calculated sequence features (= mutations) as input rather than raw sequences. These features can be calculated with several different programs, but the one we mainly use iscovSonar. It can be used to maintain a database of mutations for a large number of sequences, which can then be easily queried.conda activate sonar
covsonar/sonar.py add -f genomes.fasta --db mydb --cpus 8
covsonar/sonar.py match --tsv --db mydb > genomic_profiles.tsvClustering with a maximum SNP-distance of 1 and excluding clusters below a size of 5 sequences:breakfast \
   --input-file genomic_profiles.tsv \
   --max-dist 1 \
   --min-cluster-size 5 \
   --outdir covsonar-breakfast-results/Using breakfast with input from NextcladeAn alternative to covsonar that is commonly used isNextclade CLI.conda install -c bioconda nextclade  # If nextclade isn't already installed
nextclade dataset get --name 'sars-cov-2' --output-dir 'data/sars-cov-2'
nextclade \
   --in-order \
   --input-fasta genomes.fasta \
   --input-dataset data/sars-cov-2 \
   --output-tsv output/nextclade.tsv \
   --output-tree output/nextclade.auspice.json \
   --output-dir output/ \
   --output-basename nextcladeAlternatively, you can also useNextclade Webto process your fasta and export the genomic profile as "nextclade.tsv".Clustering with a maximum SNP-distance of 1 and excluding clusters below a size of 5 sequences. Since the input tsv of Nextclade looks a little different from the covSonar tsv, you need to specify the additional parameters--id-col,--clust-coland--sep2for identifying the correct columns.breakfast \
   --input-file output/nextclade.tsv \
   --max-dist 1 \
   --min-cluster-size 5 \
   --id-col "seqName" \
   --clust-col "substitutions" \
   --sep2 "," \
   --outdir nextclade-breakfast-results/Sequence feature formatsTypical input data to breakfast looks something like the following table (example from covsonar with unnecessary columns removed):accession	dna_profile
example1	C241T T606C C913T C3037T del:11288:9 C13515T
example2	C241T T606C del:1000:10
example3	C241T T606C del:1001:20breakfast has parameters to allow the user to ignore deletions (--skip-del), insertions (--skip-ins) or mutations at the end of the sequences (which can sometimes be error-prone) when calculating the distance between sequences. To be able to do this, we need to know what kind of input is being provided (using the--var-typeoption), and then parse the mutations themselves. Since the format of how mutations are represented by upstream programs differs, we have implemented program-specific parsers for covsonar DNA and AA, as well as nextclade DNA and AA. Examples are shown below, in case you want to use some other program as input to breakfast you can see if the format matches one of the existing feature formats. As a fallback, you can use the "raw" format, which disables parsing and does not allow you to use breakfast's indel skipping or trimming features.covsonarmutation typeDNA (covsonar_dna)AA (covsonar_aa)substitutionC241TS:N501Ydeletiondel:11288:9ORF1:del:12:7insertionC241TATN:A34AKNextclademutation typeDNA (nextclade_dna)AA (nextclade_aa)substitutionC241TS:N501Ydeletion11288-11297 or 22492S:V70-insertion273:CTTCGA(not provided)RawFeatures will not be parsed. Skipping inserts (--skip-ins) and/or deletions (--skip-del) and the trimming options are not supported with this feature type.Parameter descriptionParameterTypeRequiredDefaultDescription--input-fileString✅'genomic_profiles.tsv.gz'Path of the input file (in tsv format)--max-distInteger1Two sequences will be grouped together, if their pairwise edit distance does not exceed this threshold--min-cluster-sizeInteger2Minimum number of sequences a cluster needs to include to be defined in the result file--id-colString'accession'Name of the sequence identifier column of the input file--clust-colString'dna_profile'Name of the mutation profile column of the input file--var-typeString'covsonar_dna'Mutuation format (e.g. for DNA mutations from covsonar, use covsonar_dna). Possible values: [covsonar_dna--sepString'\t'Input file separator--sep2String' 'Secondary clustering column separator (between each mutation)--outdirString'output/'Path of output directory--trim-startInteger264Bases to trim from the beginning--trim-endInteger228Bases to trim from the end--reference-lengthInteger29903Length of reference genome (defaults to NC_045512.2)--skip-delBoolTRUEDeletions will be skipped for calculating the pairwise distance of your input sequences.--skip-insBoolTRUEInsertions will be skipped for calculating the pairwise distance of your input sequences.--input-cacheIntegerNonePath to import results from previous run--output-cacheStringNonePath to export results which can be used in the next run to decrease runtime.--jobsInteger1The number of jobs (=threads) to run simultaneously--helpN/AN/AShow this help message and exit--versionN/AN/AShow version and exitDependenciesbreakfastruns under Python 3.10 and later. We rely heavily on some excellent open source python libraries: networkx, pandas, numpy, scikit-learn, click, and scipy.