Skip to main content
6 of 7
edited tags

Visualize a string/sequence, emphasizing certain substrings

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:

enter image description here

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.

brienna
  • 1.1k
  • 5
  • 13