Package: kcalign
OverviewKc-Align is a fast and accurate tool for performing codon-aware multiple sequence alignments (MSA). It makes use of the very fast multiple alignment program Kalign3 to ensure maximum speed. Kc-Align is a extremely extremely versatile tool, capable of taking a variety of inputs and achieving the same result. Every other aligner requires the sequence inputs to be the coding sequences of the gene/open reading frame (ORF) to be aligned, requiring curation from the whole-genome sequences and also preventing use of assemblies that may not be properly annotated. Kc-Align solves this problem by using pairwise alignments to extract the sequence from each whole genome that is homologous to the sequence of a high quality and well annotated reference sequence. This feautre may also be bypassed for those who already have curated data and simply desire a quick and accurate codon-aware multiple aligner (see Modes below).What Is a Codon-Alignment?In a codon-aware alignment, coding sequences of nucleotides are converted to their amino acid sequences before being aligned and then following the alignment, the original nucleotide sequence of each sequence in the alignment is restored, converting any gap character that was inserted into three consecutive gaps to represent to inserted or deleted codon. This method of alignment prevents synonymous mutations from affecting the alignment while also preserving them for downstream analyses such as dN/dS calculations.What Can Kc-Align be Used For?Kc-Align can be used to produce accurate and high quality MSA that can be used for various bioinformatic analyses such as homology modeling, phylogenetic reconstruction, and evolutionary selection analysis. These downstream analyses are heavily affected by the quality of the alignment that they are given and by aligning sequences on a codon-level, alignments from Kc-Align are able to produce more accurate downstream results.Obtaining Kc-AlignKc-Align is availbe through PyPI (pip install kcalign) and through Bioconda (conda install kcalign). Alternatively, a GUI interface for Kc-Align is installed and available for use on Galaxy (http://usegalaxy.org).Using Kc-AlignUSAGE:kc-align --mode genome --reference [reference sequence] --sequences [other seqs to align] --start [start coordinate] --end [end coordinate](or)kc-align --mode [gene | mixed] --reference [reference sequence] --sequences [other seqs to align]Arguments:--mode/-m         Alignment mode (genome, gene, or mixed) (required)

--reference/-r    Reference sequences to align against (required)

--sequences/-S    Other sequences to align (required)

--start/-s        1-based start position (required in genome mode)

--end/-e          1-based end position (required in genome mode)

--compress/-c     Compress identical sequences

--parallel/-p     Enable parallelization of homology search

--table/-t        Choose an alternative translation table (See https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi for values)ModesKc-Align can be run in three different modes, depending on your input data. These modes are: genome, gene, and mixed.GenomeIf the reference sequences and all other sequences to be aligned are full genomes, this mode should be used. This mode requires the start and end coordinates of the gene/ORF to be aligned with regard to the reference sequence. Kc-Align will excise the appropriate subsequence from the referencce and then use pairwise alignments to find the corresponding homologous sequences from each of the other input genomes. It will then perform the MSA using the extracted sequences.If the gene/ORF you wish to align exists in multiple distinct segments in the genome (ribosomal frameshift during transcription), Kc-Align can find each homologous segment separately for each input sequence and then concatenate them before performing the final MSA. This requires the user to enter the start and end coordinates of each segment as a comma-separated list following their respective arguments.Examplekc-align -m genome -r reference.fasta -S sequences.fasta -s 3532,3892 -e 3894,5326In the above example, the two segments being aligned have the coordinates 3532-3894 and 3892-5326.GeneIf the input sequences have already been trimmed to the coding sequences of the gene/ORF of interest, then this mode can be used and Kc-Align will not perform the homology search as it does in genome mode. It instead simply immediately performs the MSA, making this mode much faster than the others.MixedFor the case when your reference is a coding sequence while all other sequences are whole genomes. Like gene mode, this mode does not require the start and end point position parameters but like genome mode it will perform homology searching in order to extract the sequences homologous to the reference from the other input sequences.OutputsKc-Align will output two files: a FASTA format alignment and a CLUSTAL format alignment.Compress Identical SequencesIf the--compress/-cparameter is specified, Kc-Align will compress identical sequences into a single sequence. In the FASTA output, compressed sequences will have an ID of the form MultiSeq[incremental index]_[number of sequences that were compressed] (ex: MultiSeq3_321, third compression with 321 sequences having that same sequence) while the description field is a comma-separated list of every ID that was compressed into that single sequence. The reference sequence will not be compressed.ParallelizationIf the--parallel/-pparameter is used in genome or mixed mode, the calculations for the homology search will be split between 3 cores (if possible), decreasing runtimes by up to 35%.Kc-Align In ActionTo demonstrate the utility of Kc-Align we analyzed 4,224 SARS-CoV2 genome assemblies available at NCBI at the time of writing. For this analysis we used Kc-align genome mode to generate codon-aware alignment for each of the SARS-CoV2 open reading frames (ORFs). We then analyzed codon alignments of each ORF using HyPhy, a software package for detection of selection and recombination. In particular we used the FEL (Fixed Effects Likelihood), MEME (Mixed Effects Model of Evolution), and FUBAR (Fast, Unconstrained Bayesian AppRoximation) methods. FEL uses a maximum-likelihood (ML) approach to infer nonsynoymous (dN) and synonymous (dS) substitution rates on a per-site basis for a given coding alignment and corresponding phylogeny. MEME employs a mixed-effects ML approach to test the hypothesis that individual sites have been subject to episodic positive or diversifying selection. FUBAR uses a Bayesian approach to infer dN and dS substitution rates on a per-site basis for a given coding alignment and corresponding phylogeny. The HyPhy tools identified 40 potential sites under positive selection. Three of these sites have been identified by all methods (these sites are marked with a star in the below table). Two have also been identified in more comprehensive analysis (seehttps://covid19.datamonkey.org). A UCSC genome browser visualization of the results can be found athttp://genome.ucsc.edu/cgi-bin/hgTracks?db=wuhCor1&lastVirtModeType=default&lastVirtModeExtraState=&virtModeType=default&virtMode=0&nonVirtPosition=&position=NC_045512v2%3A1%2D29903&hgsid=863069951_GPeqUMFmcBlaA4afiGWTI9K936WvGene/ORFCodon CoordinatesFELMEMEFUBARKnown SiteNextstrain VariantORF1ab (leader)626-628XORF1ab (nsp2)*1058-1060XXXXXORF1ab (nsp2)1514-1516XXORF1ab (nsp3)2945-2947XORF1ab (nsp3)3371-3373XXORF1ab (nsp3)6725-6727XORF1ab (nsp4)8885-8887XORF1ab (3CL)10097-10099XXORF1ab (3CL)10187-10189XXORF1ab (3CL)10265-10267XXORF1ab (3CL)10277-10279XXORF1ab (nsp6)11381-11383XXORF1ab (nsp6)11837-11839XXORF1ab (RdRp/nsp11)13445-13447XORF1ab (RdRp/nsp11)13451-13453XORF1ab (RdRp/nsp11)13457-13459XXXXORF1ab (RdRp/nsp11)13463-13465XXXORF1ab (RdRp)*14407-14409XXXXXORF1ab (RdRp)14425-14427XXORF1ab (RdRp)15922-15924XXORF1ab (helicase)17410-17412XXXORF1ab (methyltransferase)21145-21148XORF1ab (methyltransferase)21151-21153XSpike21575-21577XSpike21722-21724XXSpike23402-23404XXXXORF3a25561-25563XXXORF7b27876-27878XXORF827963-27965XXXORF828077-28079XXORF828086-28088XXORF828092-28094XXORF828143-28145XXN*28310-28312XXXXN28826-28828XXN28850-28852XN28886-28888XXXN28985-28987XXN29291-29293XXN29450-29452XXSpeedThe speed of Kc-Align is largely dependent on the analysis mode. In gene mode, it is comparable to Kalign3 on its own as there is little additional calculation needed to make the alignment codon aware. The genome and mixed modes, however, are several times slower than gene mode in order to facilitate the homology search, but an option to enable parallelization increases this speed by ~35%. This is accomplished by testing the three reading frames of each input sequence in parallel. We tested the speed of Kc-Align in Gene and Genome mode, as well as Genome mode with parallelization enabled, by aligning five SARS-CoV-2 CDSs of varying lengths using 1,000 total genomes.GeneLength (nucleotides)Gene Mode Run TimeGenome Mode (1 core) Run TimeGenome Parallel Run TimeORF3a82700:00:2800:08:2300:05:19N125900:00:2800:12:5400:08:14Spike382100:00:5001:20:5100:52:47ORF1b808400:01:545:04:4303:20:00ORF1a1320200:04:3113:55:109:09:25