Function Repository Resource:

BioSequenceFoldingMatrix

Source Notebook

Build a matrix containing which biomolecular sequence positions can bond

Contributed by: John Cassel, Wolfram|Alpha Scientific Content

ResourceFunction["BioSequenceFoldingMatrix"][bioseq]

obtains a matrix of all of the positions which a biological sequence bioseq is allowed to form a bond.

Details and Options

ResourceFunction["BioSequenceFoldingMatrix"] returns a SparseArray object.
ResourceFunction["BioSequenceFoldingMatrix"] accepts the following options:
"AdditionalBondingPairs"{}specify additional complementary pairs
"UseTypeRules"Truedetermine if "DNA" or "RNA" terms will bond to their complement letters
The "AdditionalBondingPairs" option expects lists of two letters, which will also count for bond matches in the folding matrix.

Examples

Basic Examples (1) 

Build the folding matrix based on built-in DNA complementation rules:

In[1]:=
ResourceFunction["BioSequenceFoldingMatrix"][
  BioSequence["DNA", "CGTTTAACG", {}]] // MatrixForm
Out[1]=

Options (2) 

AdditionalBondingPairs (1) 

Build a folding matrix for RNA that includes additional "wobble" pairings between "G" and "U":

In[2]:=
ResourceFunction["BioSequenceFoldingMatrix"][
  BioSequence["RNA", "CGUUUAACG", {}], "AdditionalBondingPairs" -> {{"G", "U"}}] // MatrixForm
Out[2]=

UseTypeRules (1) 

See only the wobble pairings by turning off the rules from the type:

In[3]:=
ResourceFunction["BioSequenceFoldingMatrix"][
  BioSequence["RNA", "CGUUUAACG", {}], "AdditionalBondingPairs" -> {{"G", "U"}}, "UseTypeRules" -> False] // MatrixForm
Out[3]=

Applications (1) 

Find all potential bonding pairs:

In[4]:=
Cases[ArrayRules[
  ResourceFunction["BioSequenceFoldingMatrix"][
   BioSequence["RNA", "CGUUUAACG", {}], "AdditionalBondingPairs" -> {{"G", "U"}}]], HoldPattern[Rule[x_, 1]] :> x]
Out[4]=

Version History

  • 1.0.1 – 06 December 2021

Related Resources

License Information