Click or drag to resize
RunNexusStr Method
Generate Nexus string from similarity matrix using clustering method.

Namespace:  Biolomics.BioCallback
Assembly:  Biolomics.BioCallback (in Biolomics.BioCallback.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static string NexusStr(
	XMatrix p_SimMx,
	EnumerationsClusteringMethods p_ClusteringMethod
)

Parameters

p_SimMx
Type: Biolomics.SharedClassesXMatrix
The similarity matrix.
p_ClusteringMethod
Type: Biolomics.SharedClassesEnumerationsClusteringMethods
The clustering method.

Return Value

Type: String
The generated Nexus string .
Examples
The example below will compute a clustering tree between 10 records, generate a Nexus string and open a clustering page in BioloMICS.
Example VB.Net
Imports System
Imports System.Collections
Imports System.Text  '    for StringBuilder

Imports Biolomics.BioCallback
Imports Biolomics.SharedClasses
Imports Biolomics.Utility.databaseConstants

Public Class Program

    <STAThread()>
    Shared Sub Main()
        Dim program As New Program()
        program.Test()
    End Sub

    '    Write sub functions here
    Public Sub Test()
        '    get the current connection
        Dim SqlCo As XConnection = Run.GetCurrentConnection()
        If SqlCo Is Nothing Then
            Return
        End If

        '    get a table from its User name
        Dim TableDef As XTableDef = SqlCo.GetTableDefByUserNameEng("Your_Table_Name")
        If TableDef Is Nothing Then   '    may happen if that table doesn't exist
            Return
        End If

        '    load records #1 to #10 in the reference record map
        Dim RefRecMap As XRecordMap = Run.LoadRecords(TableDef.Key, Nothing, XWhere.GTE(StaticFields.id, 1).And_(StaticFields.id, XWhere.OperationEnum.LTE, 10))

        '    create 3 matrices
        Dim SimMx As New XMatrix
        Dim NumMx As New XMatrix
        Dim DenomMx As New XMatrix

        '    compute the similarity matrix between all reference records, this will return three 10*10 matrices
        '    SimMx contains the similarity between all 10 records
        '    NumMx contains the number of identical bases found during DNA alignments
        '    DenomMx contains the denominator used to compare DNA
        Run.Classification(SimMx, NumMx, DenomMx, RefRecMap, "Your_Saved_Scenario_Name")

        '    compute a Nexus string describing a clustering tree
        Dim NexusStr As String = Run.NexusStr(SimMx, ClusteringMethods.UPGMA)
        '    this Nexus string can be used to export result to other software

        'save the clustering tree to an image
        run.SaveClusteringTree(SimMx, ClusteringMethods.UPGMA, "Your_Result_Path_To Save_Image\result.png")

        '    open a clustering form displaying the result
        Run.OpenClusteringForm(SimMx, ClusteringMethods.UPGMA)

    End Sub

End Class
See Also