Function Repository Resource:

NucleotideStaveDiagram

Source Notebook

Generate the stave diagram corresponding to a nucleotide sequence

Contributed by: Jan Mangaldan

ResourceFunction["NucleotideStaveDiagram"][bioseq]

visualizes the "DNA" or "RNA" BioSequence bioseq as a stave diagram.

Details and Options

A stave diagram encodes nucleotides as disks on a series of horizontal bars akin to notes on a musical stave, where each gap on the five-line stave corresponds to one of the four nucleotide bases.
ResourceFunction["NucleotideStaveDiagram"] has the same options as Graphics, with the following additions:
"MaxColumns"Automaticmaximum number of columns on a stave before moving to a new one
PlotStyleAutomaticgraphics directives to determine styles of markers
"ShowLabels"Truewhether to show labels for the nucleotides
"StaveStyle"Automaticstyle specifications for the staves
"WildcardStyle"Automaticgraphics directives to determine styles of markers corresponding to degenerate letters
ResourceFunction["NucleotideStaveDiagram"]["seq"] is equivalent to ResourceFunction["NucleotideStaveDiagram"][BioSequence["seq"]].

Examples

Basic Examples (2) 

Stave diagram for a DNA sequence:

In[1]:=
ResourceFunction["NucleotideStaveDiagram"][
 BioSequence["DNA", "AACTTCGCGTA"]]
Out[1]=

Stave diagram for an RNA sequence:

In[2]:=
ResourceFunction["NucleotideStaveDiagram"][
 BioSequence["RNA", "CAUGCGCAUG"]]
Out[2]=

Scope (3) 

Stave diagram for a gene:

In[3]:=
ResourceFunction["NucleotideStaveDiagram"][
 BioSequence[Entity["Gene", {"HBA2", {"Species" -> "HomoSapiens"}}]]]
Out[3]=

Stave diagram for a sequence containing degenerate letters:

In[4]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/416aab96-6d15-4a50-a061-1a29da9ab6a9"]
Out[4]=

NucleotideStaveDiagram can be used on strings and will infer the sequence type from the letters:

In[5]:=
ResourceFunction["NucleotideStaveDiagram"]["GACT"]
Out[5]=

Options (5) 

MaxColumns (1) 

The setting "MaxColumns"Automatic corresponds to a cutoff of 120 columns. Use a smaller number of columns:

In[6]:=
ResourceFunction["NucleotideStaveDiagram"][
 BioSequence[Entity["Gene", {"HBA1", {"Species" -> "HomoSapiens"}}]], "MaxColumns" -> 75]
Out[6]=

PlotStyle (1) 

Use different style directives for markers corresponding to non-degenerate letters:

In[7]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/3a196360-fc77-4181-ab33-d946a52b9377"]
Out[7]=

ShowLabels (1) 

Show the stave diagram with and without the nucleotide labels:

In[8]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/74c28959-5ed3-422f-9ff9-c9910cbf4774"]
Out[8]=

StaveStyle (1) 

Specify the style to use for the staves:

In[9]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/9cb37390-fc58-494c-9113-249354ad9060"]
Out[9]=

WildcardStyle (1) 

Use different style directives for markers corresponding to degenerate letters:

In[10]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/6fcdc9ee-c8c3-45fd-8fd7-db01b97ba1a8"]
Out[10]=

Properties and Relations (2) 

The stave diagram of a sequence and its complement are mirror reflections of each other:

In[11]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/4040b805-1ee9-4403-9bbc-0e937e437922"]
Out[11]=

Palindromic sequences have centrally symmetric stave diagrams:

In[12]:=
ResourceFunction["NucleotideStaveDiagram"]["ACCTAGGT"]
Out[12]=

Version History

  • 1.0.0 – 09 August 2021

Source Metadata

Related Resources

Author Notes

The paper of Cowin et al. refers to this visualization as a "stave projection". I have changed this to "stave diagram", which I think is more appropriate terminology.

License Information