<p>I think one of the reasons you struggle is that clustering DNA sequences is not a clearly defined task. In general intention of clustering is to reconstruct, or approximate the relatidness of the DNA seqeunces.</p>
<p>If all these sequences are homologous you can do a multiple sequence alignment (using <a href="https://mafft.cbrc.jp/alignment/software/" rel="nofollow noreferrer">MAFFT</a> or Clustal) and build a phylogenetic tree (using something like <a href="http://www.iqtree.org/" rel="nofollow noreferrer">IQ tree</a>). If your prof suggested ClustalW, this is probably what they meant. Evolutionary speaking, that's the optimal method for getting relations of sequences, but they must be &quot;alignable&quot;. Also with this many sequences, it will be computationally quite heavy.</p>
<p>For within species relatedness, phylogenetic reconstruction is sometimes impossible, because recombination breaks down the linkage of individual alleles. However, if all of the sequences are long enough, you can do a principal component analysis on SNPs, for example using something like <a href="https://speciationgenomics.github.io/pca/" rel="nofollow noreferrer">plink</a>. The plot you showed actually looks a lot like PCA (it even has the explained variability on axes).</p>
<p>Finally, regardless of their relationship, you can always do a dendrogram based on a similarity matrix, but for that, you need to define similarity. That will be usually something kmer-based. I am not following this field very closely lately, but there are some recent papers about kmer-based clusterings, like <a href="https://www.nature.com/articles/s41598-019-40452-6" rel="nofollow noreferrer">this one</a>.</p>
<p>When looking for the paper I also run into <a href="https://www.frontiersin.org/articles/10.3389/fgene.2019.00234/full" rel="nofollow noreferrer">this one</a>, which proposes genome clustering using &quot;Inter-nucleotide Covariance&quot;. No idea how useful/sound it is. Just found the abstract quite interesting.</p>
<p>Long story short, it really depends on what you are after and what are your sequences! If you can build a reliable tree, it is the most powerful way to determine the relationships among sequences.</p>

CC BY-SA 4.0
2021-04-28T10:01:12.440Z
2021-04-29T15:52:54.400Z
2021-04-29T15:52:54.400Z
Kamil S Jaron
<p>I have a group of about 1050 sequences that have been aligned using blastn. I am now trying to create a cluster plot of the sequences in order to identify similar sequences, something like this:
<img src="https://www.datanovia.com/en/wp-content/uploads/2020/06/k-means-clustering-visualization-in-r-plot-k-means-in-r-1.png" alt="Text" /></p>
<p>However, I am having trouble finding a tool to do this. My professor recommended using ClustalW, and so I have spent plenty of time searching for a tool that can take a sequence alignment and plot them such as in the linked image. However, I have not been successful in finding what I need and am beginning to think I am missing something or something is going over my head. If anyone could assist with finding the tool I need I would very much appreciate it. Thanks so much!</p>

<visualization><clustering><multiple-sequence-alignment>
How do I plot clusters based on DNA sequence alignment?
# How do I plot clusters based on DNA sequence alignment?

(Asked by: username_0 on 2021-04-28)

I have a group of about 1050 sequences that have been aligned using blastn. I am now trying to create a cluster plot of the sequences in order to identify similar sequences, something like this:
![Text](https://www.datanovia.com/en/wp-content/uploads/2020/06/k-means-clustering-visualization-in-r-plot-k-means-in-r-1.png)

However, I am having trouble finding a tool to do this. My professor recommended using ClustalW, and so I have spent plenty of time searching for a tool that can take a sequence alignment and plot them such as in the linked image. However, I have not been successful in finding what I need and am beginning to think I am missing something or something is going over my head. If anyone could assist with finding the tool I need I would very much appreciate it. Thanks so much!

**Tags:** visualization, clustering, multiple-sequence-alignment

---

## 1 answers

### Answer by username_1 on 2021-04-28. Score: 2 | Accepted answer

I think one of the reasons you struggle is that clustering DNA sequences is not a clearly defined task. In general intention of clustering is to reconstruct, or approximate the relatidness of the DNA seqeunces.

If all these sequences are homologous you can do a multiple sequence alignment (using [MAFFT](https://mafft.cbrc.jp/alignment/software/) or Clustal) and build a phylogenetic tree (using something like [IQ tree](http://www.iqtree.org/)). If your prof suggested ClustalW, this is probably what they meant. Evolutionary speaking, that's the optimal method for getting relations of sequences, but they must be "alignable". Also with this many sequences, it will be computationally quite heavy.

For within species relatedness, phylogenetic reconstruction is sometimes impossible, because recombination breaks down the linkage of individual alleles. However, if all of the sequences are long enough, you can do a principal component analysis on SNPs, for example using something like [plink](https://speciationgenomics.github.io/pca/). The plot you showed actually looks a lot like PCA (it even has the explained variability on axes).

Finally, regardless of their relationship, you can always do a dendrogram based on a similarity matrix, but for that, you need to define similarity. That will be usually something kmer-based. I am not following this field very closely lately, but there are some recent papers about kmer-based clusterings, like [this one](https://www.nature.com/articles/s41598-019-40452-6).

When looking for the paper I also run into [this one](https://www.frontiersin.org/articles/10.3389/fgene.2019.00234/full), which proposes genome clustering using "Inter-nucleotide Covariance". No idea how useful/sound it is. Just found the abstract quite interesting.

Long story short, it really depends on what you are after and what are your sequences! If you can build a reliable tree, it is the most powerful way to determine the relationships among sequences.


---

