Beispiel #1
0
        static TDistance ComputeDistance(PairwiseAlignment alignment)
        {
            TDistance result = 0;

            if (_alignmentType == AlignmentType.Nucleic)
            {
                switch (_distanceFunction)
                {
                case DistanceFunctionType.PercentIdentity:
                    result = (TDistance)(1.0f - alignment.PercentIdentity);
                    break;

                case DistanceFunctionType.Kimura2:
                    result = (TDistance)(alignment.ComputeKimuraDistance());
                    break;

                case DistanceFunctionType.JukesCantor:
                    result = (TDistance)(alignment.ComputeJukesCantorDistance());
                    break;
                }
            }
            else
            {
                result = (TDistance)(1.0f - alignment.PercentSimilarity);
            }

            return(result);
        }
Beispiel #2
0
        static void WriteAlignment(StreamWriter writer, PairwiseAlignment alignment)
        {
            double kimeraDistance          = alignment.ComputeKimuraDistance();
            double jukesCantorDistance     = alignment.ComputeJukesCantorDistance();
            double percentIdentityDistance = alignment.PercentIdentity;

            writer.WriteLine(">{0} Kimera: {1}, JukesCantor: {2}, PercentIdentity: {3}", alignment.Name1, kimeraDistance.ToString("F5"), jukesCantorDistance.ToString("F5"), alignment.PercentIdentity.ToString("F5"));
            writer.WriteLine(alignment.Sequence1);
            writer.WriteLine(">{0} Kimera: {1}, JukesCantor: {2}, PercentIdentity: {3}", alignment.Name2, kimeraDistance.ToString("F5"), jukesCantorDistance.ToString("F5"), alignment.PercentIdentity.ToString("F5"));
            writer.WriteLine(alignment.Sequence2);
            writer.WriteLine();
        }