I need to visualize a sequence, with the ability to emphasize certain segments.
For example, take this sequence seq
:
seq = "-----------------DTLCIGYHANNSTDTVDTVLEKNVTVTHSVNLLEDKHNGKLCK
LRGVAPLHLGKCNIAGWILGNPECESLSTASSWSYIVETPSSDNGTCYPGDFIDYEELREQLSSVSSFER
FEIFPKTSSWPNHDSNKGVTAACPHAGAKSFYKNLIWLVKKGNSYPKLSKSYINDKGKEVLVLWGIHHPS
TSADQQSLYQNADTYVFVGSSRYSKKFKPEIAIRPKVRDQEGRMNYYWTLVEPGDKITFEATGNLVVPRY
AFAMERNAGSGIIISDTPVHDCNTTCQTPKGAINTSLPFQNIHPITIGKCPKYVKSTKLRLATGLRNIPS
G----LFGAIAGFIEGGWTGMVDGWYGYHHQNEQGSGYAADLKSTQNAIDEITNKVNSVIEKMNTQFTAV
GKEFNHLEKRIENLNKKVDDGFLDIWTYNAELLVLLENERTLDYHDSNVKNLYEKVRSQLKNNAKEIGNG
CFEFYHKCDNTCMESVKNGTYDYPKYSEEAKLNREEIDS-------------------------------
--------------------------------------------------------------------"
The list of segments I want to emphasize:
segments = {"AGSGIIISDTPVHDC", "AIDEITNKVNSVIEK", "AKSFYKNLIWLVKKG"}
I'm thinking that something that looks like this would work for the emphasis, where the black line is the length of the sequence, and the blue boxes are the segments:
To get start and ending positions of each segment, we can use StringPosition[seq, #] & /@ segments
.
Now I'm not sure which visualization tool would help me visualize this sequence and emphasize the segment using these start and end positions.
StringReplace[seq, s : Alternatives @@ segments :> ToString[Style[s, Red, Bold], StandardForm]]
? $\endgroup$