How to customise colour codes for Multiple sequence alignment (MSA)?

I need to customise the colour code for protein multiple sequence alignment (MSA), However the existing R packages only supports the predefined colour codes, which are single letter based. But, I have to assign my own colour scheme for a pair of letters (amino acid). I have gone through the packages like ggmsa and ggplot2 etc., but failed to find the solution. I need to generate a figure as shown below,


I have followed the below script but could not serve my purpose,

library(tidyverse)
library(ggtree) 
library(seqinr)
tree = read.tree("tree.newick") 
msaplot(p=ggtree(tree), fasta = "msa.fasta")
msaplot(p=ggtree(tree) + geom_tiplab(align=TRUE), fasta = "msa.fasta")

My fasta file is shown below,

msa.fasta
>Tl8
NI-NG-HD-NS-N*-NU
>T_X12
NI-NG-NI-NG-NI-NG-NI-NG
>T_T_x56
NI-NG-HD-NS-N*-NI-NG

My test tree file are shown below,

tree.newick
(tal8:0.49999997,t_temp5:0.47298786,t1:28.37858179); 

Kindly help me to do the same.

Thanks in advance.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.