Trigrams are a special case of the N-gram, where N is 3. They are often used in natural language processing for doing statistical analysis of texts. WolframAlpha supports them and has a DNA example.
It looked liked something fun to implement in PowerShell and diagram with the yUML script I put together.
All you need is PowerShell, an Internet connection and the script below to try it out.
If you’re running Windows 7, you’re good to go. PowerShell is installed out of the box.
WolframAlpha Triads
trigrams "AGCAGCTGACTGATCGTAGCTGACT"
PowerShell + yUML
trigrams ‘AGCAGCTGACTGATCGTAGCTGACT’
Function trigrams ($target) {
Get-yUMLDiagram (Convert-ToyUml ( Create-Tree ( Get-Triads $target ) )) -show
}
Download the Script
I am not satisfied with Create-Tree function. It works but is not flexible.
Or, click here to view the file content




{ 1 trackback }
{ 2 comments… read them below or add one }
Wow, this looks ace! It’s really nice to see with people playing with yUML, kinda makes the project worthwhile!
Just a thought, could you post your scripts as blah.ps1.txt? It’s just that it’d be cool to see the scripts without unzipping.
Thanks Tobin. yUML is a neat piece of work. Thanks for the suggestion on uploading plain text.