示例#1
0
 public void SetCell(TileType type, AlignmentType aligment, Tilemap tilemap, Tile[] tileSet)
 {
     this.tileType = type;
     this.aligment = aligment;
     this.tilemap  = tilemap;
     this.tile     = tileSet[Random.Range(0, tileSet.Length)];
 }
示例#2
0
        static void ReadConfiguration(ConfigurationMgr mgr)
        {
            _fastaFile           = mgr.SmithWatermanSection.FastaFile;
            _distanceFile        = mgr.SmithWatermanSection.DistanceMatrixFile;
            _indexFile           = mgr.SmithWatermanSection.IndexFile;
            _timingFile          = mgr.SmithWatermanSection.TimingFile;
            _summaryFile         = mgr.SmithWatermanSection.SummaryFile;
            _writeFullResults    = mgr.SmithWatermanSection.WriteFullMatrix;
            _writePartialResults = mgr.SmithWatermanSection.WritePartialMatrix;
            _writeAlignments     = mgr.SmithWatermanSection.WriteAlignments;
            _writeAlignmentFile  = mgr.SmithWatermanSection.WriteAlignmentsFile;

            _nodeCount           = mgr.SmithWatermanSection.NodeCount;
            _processPerNodeCount = mgr.SmithWatermanSection.ProcessPerNodeCount;

            _sequenceCount = 0;
            _gapOpen       = mgr.SmithWatermanSection.GapOpenPenalty;
            _gapExtension  = mgr.SmithWatermanSection.GapExtensionPenalty;

            _alignmentType     = mgr.SmithWatermanSection.AlignmentType;
            _distanceFunction  = mgr.SmithWatermanSection.DistanceFunctionType;
            _scoringMatrixName = mgr.SmithWatermanSection.ScoringMatrixName;

            _emailResultsTo = string.Join(",", mgr.GlobalSection.EmailAddresses);
        }
示例#3
0
        }                                            // Выравнивание

        public LabelUnit()
        {
            Position     = new Point();
            ThreadNumber = default;
            Text         = default;
            Alignment    = AlignmentType.Left;
        }
示例#4
0
        public LabelUnit(ConfigurationUnit configurationUnit)
        {
            if (configurationUnit.Type == ConfigurationUnitType.Label)
            {
                Position = new Point();
                foreach (KeyValuePair <string, string> param in configurationUnit.Parameters)
                {
                    string value = param.Value;
                    string tmpVal;
                    double dbValue;

                    switch (param.Key.ToUpper())
                    {
                    case "КООРДИНАТА":
                        tmpVal        = value.Replace(".", ",");
                        dbValue       = Convert.ToDouble(tmpVal);
                        Position.PosX = dbValue;
                        break;

                    case "НОМЕРНИТИ":
                        ThreadNumber = Convert.ToInt32(value);
                        break;

                    case "ТЕКСТ":
                        Text = value;
                        break;

                    case "ВЫРАВНИВАНИЕ":
                        AlignmentType type = getAlignmentType(value);
                        Alignment = type;
                        break;
                    }
                }
            }
        }
示例#5
0
 public void SetCell(TileType type, AlignmentType aligment, Tilemap tilemap, Tile tile)
 {
     this.tileType = type;
     this.aligment = aligment;
     this.tile     = tile;
     this.tilemap  = tilemap;
 }
示例#6
0
        string TextField(string value, int size, AlignmentType alignment = AlignmentType.Left, string delimiter = " ")
        {
            var result = new StringBuilder();

            if (value.Length > size)
            {
                value = value.Substring(0, size);
            }

            switch (alignment)
            {
            case AlignmentType.Center:
                int f = size;
                int v = value.Length;
                int a = (f >= v) ? (f - v) / 2 : 0;

                return(result.Append(' ', a).Append(value).Append(' ', f - (a + v)).ToString() + delimiter);

            case AlignmentType.Right:
                return(result.Append(' ', size).Append(value).ToString().Substring(value.Length, size) + delimiter);

            default:
                return(result.Append(value).Append(' ', size).ToString().Substring(0, size) + delimiter);
            }
        }
示例#7
0
 public TextTable AddColumn(string headerName, int width, AlignmentType alignment = AlignmentType.Left, string propertyName = null)
 {
     return(AddColumn(new TextColumn()
     {
         Header = headerName, Width = width, Alignment = alignment, PropertyName = propertyName
     }));
 }
示例#8
0
        protected static Vector2 GetAnchor(UIVertex[] stream, int index, AlignmentType alignment)
        {
            switch (alignment)
            {
            case AlignmentType.UpperLeft:
                return(GetUpperLeft(stream, index));

            case AlignmentType.UpperCenter:
                return(GetUpperCenter(stream, index));

            case AlignmentType.UpperRight:
                return(GetUpperRight(stream, index));

            case AlignmentType.MiddleLeft:
                return(GetMiddleLeft(stream, index));

            case AlignmentType.MiddleCenter:
                return(GetMiddleCenter(stream, index));

            case AlignmentType.MiddleRight:
                return(GetMiddleRight(stream, index));

            case AlignmentType.LowerLeft:
                return(GetLowerLeft(stream, index));

            case AlignmentType.LowerCenter:
                return(GetLowerCenter(stream, index));

            case AlignmentType.LowerRight:
                return(GetLowerRight(stream, index));
            }
            return(default(Vector2));
        }
示例#9
0
 public Text(Content container, string key, float rotation) : base(key, container.Parent)
 {
     Paragraphs        = new ParagraphCollection();
     VerticalAlignment = AlignmentType.top;
     _rotation         = rotation;
     Key       = key;
     Container = container;
 }
示例#10
0
        private Paragraph(Paragraph paragraph, TextlineCollection textlines)
        {
            _alignment = paragraph.Alignment;
            _text      = paragraph.Text;

            _leading   = paragraph.Leading;
            _textlines = textlines;
        }
示例#11
0
 public WordAlignmentMatrix(int i, int j, AlignmentType defaultValue = AlignmentType.NotAligned)
 {
     _matrix = new AlignmentType[i, j];
     if (defaultValue != AlignmentType.NotAligned)
     {
         SetAll(defaultValue);
     }
 }
示例#12
0
 public TextLabel(UIElement parent, string name, UDim2 position, UDim2 size, string text, string font, Color color) : base(parent, name, position, size)
 {
     Text          = text;
     Font          = font;
     Color         = color;
     TextScale     = 1;
     TextAlignment = AlignmentType.Center;
 }
示例#13
0
        /// <summary>
        /// Method who sets where is the place to write the user information
        /// </summary>
        /// <param name="value">Information to display in console</param>
        /// <param name="alignment">Position to display the information</param>
        /// <param name="addContentToDom">Indicates if the content needs to be added to the dom object</param>
        /// <returns></returns>
        protected string AlignContent(string value, AlignmentType alignment, bool addContentToDom)
        {
            string content = string.Empty;

            switch (alignment)
            {
            case AlignmentType.Left:

                if (viewWidth - value.Length - 5 > 0)
                {
                    content = string.Format("{0}{1}{2}{3}",
                                            string.Format(" ").PadRight(viewMargin, ' '),
                                            string.Format("║").PadRight(5, ' '),
                                            value,
                                            string.Format("║").PadLeft(viewWidth - value.Length - 5, ' '));
                }
                else
                {
                    content = string.Format("{0}{1}{2}{3}",
                                            string.Format(" ").PadRight(viewMargin, ' '),
                                            string.Format("║").PadRight(5, ' '),
                                            value.Substring(0, viewWidth - 6),
                                            string.Format("║"));
                }

                break;

            case AlignmentType.Center:
                int titleOffset = value.Length % 2 == 0 ? 0 : 1;

                if (viewHalfWidth - (value.Length / 2) > 0)
                {
                    content = string.Format("{0}{1}{2}{3}",
                                            string.Format(" ").PadRight(viewMargin, ' '),
                                            string.Format("║").PadRight(viewHalfWidth - (value.Length / 2), ' '),
                                            value,
                                            string.Format("║").PadLeft(viewHalfWidth - (value.Length / 2) - titleOffset, ' '));
                }
                else
                {
                    // Alignment out of boundaries. To left by default
                    AlignContent(value, AlignmentType.Left, addContentToDom);
                }

                break;

            case AlignmentType.Right:
                throw new Exception("Alignment not created!");
                //break;
            }

            if (addContentToDom == true)
            {
                dom.Add(content);
            }
            return(content);
        }
示例#14
0
        public void Test(string value, AlignmentType alignmentType, int errorCount)
        {
            string tagString = $"aspf={value}";
            Aspf   tag       = (Aspf)_parser.Parse(tagString, value);

            Assert.That(tag.Value, Is.EqualTo($"{tagString};"));
            Assert.That(tag.AlignmentType, Is.EqualTo(alignmentType));
            Assert.That(tag.ErrorCount, Is.EqualTo(errorCount));
        }
示例#15
0
 /// <summary>
 ///   Adjust the alignment of oSubject.
 ///   - oSubject
 ///   - nAlignment:
 ///   -> ALIGNMENT_LAWFUL/ALIGNMENT_CHAOTIC/ALIGNMENT_GOOD/ALIGNMENT_EVIL: oSubject's
 ///   alignment will be shifted in the direction specified
 ///   -> ALIGNMENT_ALL: nShift will be added to oSubject's law/chaos and
 ///   good/evil alignment values
 ///   -> ALIGNMENT_NEUTRAL: nShift is applied to oSubject's law/chaos and
 ///   good/evil alignment values in the direction which is towards neutrality.
 ///   e.g. If oSubject has a law/chaos value of 10 (i.e. chaotic) and a
 ///   good/evil value of 80 (i.e. good) then if nShift is 15, the
 ///   law/chaos value will become (10+15)=25 and the good/evil value will
 ///   become (80-25)=55
 ///   Furthermore, the shift will at most take the alignment value to 50 and
 ///   not beyond.
 ///   e.g. If oSubject has a law/chaos value of 40 and a good/evil value of 70,
 ///   then if nShift is 15, the law/chaos value will become 50 and the
 ///   good/evil value will become 55
 ///   - nShift: this is the desired shift in alignment
 ///   - bAllPartyMembers: when TRUE the alignment shift of oSubject also has a
 ///   diminished affect all members of oSubject's party (if oSubject is a Player).
 ///   When FALSE the shift only affects oSubject.
 ///   * No return value
 /// </summary>
 public static void AdjustAlignment(uint oSubject, AlignmentType nAlignment, int nShift,
                                    bool bAllPartyMembers = true)
 {
     Internal.NativeFunctions.StackPushInteger(bAllPartyMembers ? 1 : 0);
     Internal.NativeFunctions.StackPushInteger(nShift);
     Internal.NativeFunctions.StackPushInteger(nAlignment.InternalValue);
     Internal.NativeFunctions.StackPushObject(oSubject);
     Internal.NativeFunctions.CallBuiltIn(201);
 }
        /// <summary>
        /// Causes the given Window to align itself alongside the parent (ie, Owner) window.
        /// You should put the call to this within the LayoutUpdated or Loaded event handler of the Window you want to align itself
        /// to it's parent. The Owner property has to have been set, otherwise there's nothing for it to align against.
        /// </summary>
        /// <param name="dialog">The given Window that is to be aligned</param>
        /// <param name="inWhichDirection">Specifieds a preference toward which side or edge to align it to, if there's room on the display for that.</param>
        public static void AlignToParent(this Window dialog, AlignmentType inWhichDirection)
        {
            //TODO ?
#if !SILVERLIGHT
            Window parent = dialog.Owner as Window;
            if (parent != null)
            {
                if (inWhichDirection == AlignmentType.ToRightOfParent)
                {
                    // Try the right side, then the left.
                    if (AlignToRight(dialog))
                    {
                        return;
                    }
                    else if (AlignToLeft(dialog))
                    {
                        return;
                    }
                }
                else if (inWhichDirection == AlignmentType.ToLeftOfParent)
                {
                    // Try the left side, then the right.
                    if (AlignToLeft(dialog))
                    {
                        return;
                    }
                    else if (AlignToRight(dialog))
                    {
                        return;
                    }
                }
                else if (inWhichDirection == AlignmentType.AboveParent)
                {
                    double parentTop  = parent.Top;
                    double myHeight   = dialog.Height;
                    double separation = 2;
                    if (parentTop >= myHeight)
                    {
                        if (parentTop > (myHeight + separation))
                        {
                            dialog.Top = parentTop - separation - myHeight;
                        }
                        else
                        {
                            dialog.Top = parentTop - myHeight;
                        }
                        dialog.Left = parent.Left;
                        return;
                    }
                }
                // failing that, I'll try underneath
                AlignToBottom(dialog);
                // otherwise.. at this point I think it's time to throw in the towel and forget about it.
            }
#endif
        }
示例#17
0
        /// <summary>
        /// Method who sets where is the place to write the user information
        /// </summary>
        /// <param name="values">Array of information to display in console</param>
        /// <param name="alignment">Position to display the information</param>
        /// <param name="addContentToDom">Indicates if the content needs to be added to the dom object</param>
        /// <returns></returns>
        protected string[] AlignContent(string[] values, AlignmentType alignment, bool addContentToDom)
        {
            string[] result = new string[values.Length];
            for (int i = 0; i < values.Length; i++)
            {
                result[i] = AlignContent(values[i], alignment, addContentToDom);
            }

            return(result);
        }
示例#18
0
        /// <summary>
        /// Initializes a new instance of the StyledTableColumn class.
        /// </summary>
        public StyledTableColumn()
        {
            Random random = new Random();
            int    id     = (int)(random.NextDouble() * 1000000);

            mName      = String.Format("columnName_{0}", id);
            mLabel     = "columnLabel";
            mWidth     = 80;
            mAlignment = AlignmentType.Left;
        }
示例#19
0
 public void SetAll(AlignmentType value)
 {
     for (int i = 0; i < RowCount; i++)
     {
         for (int j = 0; j < ColumnCount; j++)
         {
             _matrix[i, j] = value;
         }
     }
 }
示例#20
0
        private void UnlockAlignment()
        {
            if (_lockedAlignmentPlot != null)
            {
                _lockedAlignmentPlot.GetComponentInChildren <AxisAlignmentIndicator>()?.UnlockAlignment(_lockedAlignment);
            }

            _lockedAlignment     = AlignmentType.Horizontal;
            _lockedAlignmentPlot = null;
        }
示例#21
0
文件: Info.cs 项目: paulghill/DMData
 public static string GetAlignmentDisplayName(AlignmentType type)
 {
     if (Alignments.TryGetValue(type, out string output))
     {
         return(output);
     }
     else
     {
         return("");
     }
 }
示例#22
0
 public TextBox(UIElement parent, string name, UDim2 position, UDim2 size, string text, string font, Color color1) : base(parent, name, position, size)
 {
     DefaultText   = "";
     Text          = text;
     Font          = font;
     TextScale     = 1;
     TextColor     = color1;
     TextAlignment = AlignmentType.Center;
     BgColor       = Color.Black;
     CursorPos     = 0;
 }
示例#23
0
 public LinearLayout(
     OrientationType orientation,
     AlignmentType alignment,
     int xSpacing,
     int ySpacing)
 {
     XSpacing    = xSpacing;
     YSpacing    = ySpacing;
     Orientation = orientation;
     Alignment   = alignment;
 }
示例#24
0
        public static string AlignmentName(AlignmentType alignmentType)
        {
            // init return value with default/failsafe
            string theName = ALIGNNAMEnone;

            switch (alignmentType)
            {
            case AlignmentType.FPS10:
                theName = ALIGNNAMEfps10l;
                break;

            case AlignmentType.FPS20:
                theName = ALIGNNAMEfps20x;
                break;

            case AlignmentType.FPS30:
                theName = ALIGNNAMEfps30l;
                break;

            case AlignmentType.FPS40:
                theName = ALIGNNAMEfps40x;
                break;

            case AlignmentType.FPS60:
                theName = ALIGNNAMEfps60l;
                break;

            case AlignmentType.Bars:
                theName = ALIGNNAMEbars;
                break;

            case AlignmentType.BeatsFull:
                theName = ALIGNNAMEbeatsFull;
                break;

            case AlignmentType.BeatsQuarter:
                theName = ALIGNNAMEbeatsQuarter;
                break;

            case AlignmentType.NoteOnsets:
                theName = ALIGNNAMEnoteOnsets;
                break;

            case AlignmentType.BeatsHalf:
                theName = ALIGNNAMEbeatsHalf;
                break;

            case AlignmentType.BeatsThird:
                theName = ALIGNNAMEbeatsThird;
                break;
            }
            return(theName);
        }
示例#25
0
 public static string Alignment2String(AlignmentType alignment)
 {
     switch(alignment){
     case AlignmentType.ENEMY:
         return "enemy";
     case AlignmentType.FRIENDLY:
         return "friendly";
     case AlignmentType.NEUTRAL:
         return "neutral";
     }
     return "neutral";
 }
示例#26
0
 public TextButton(UIElement parent, string name, UDim2 position, UDim2 size, string text, string font, Color color1, Color color2, Action action) : base(parent, name, position, size)
 {
     Text          = text;
     this.action   = action;
     Font          = font;
     TextScale     = 1;
     Color1        = color1;
     Color2        = color2;
     TextAlignment = AlignmentType.Center;
     bgColor1      = Color.Black;
     bgColor2      = Color.White;
 }
示例#27
0
        public void Transpose()
        {
            var newMatrix = new AlignmentType[ColumnCount, RowCount];

            for (int i = 0; i < RowCount; i++)
            {
                for (int j = 0; j < ColumnCount; j++)
                {
                    newMatrix[j, i] = _matrix[i, j];
                }
            }
            _matrix = newMatrix;
        }
示例#28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="flip"></param>
        /// <returns></returns>
        public Image CreateImage(AlignmentType flip)
        {
            Image image = Source;
            Bitmap flippedImage = Opetion != null && Opetion.TragetSize != null
                ? new Bitmap(Opetion.TragetSize.Value.Width, Opetion.TragetSize.Value.Height)
                : new Bitmap(image.Width, image.Height);
            using (Graphics g = Graphics.FromImage(flippedImage))
            {
                //Matrix transformation
                Matrix m = null;
                switch (flip)
                {
                    case AlignmentType.Horizontally | AlignmentType.Vertically:
                        {
                            m = new Matrix(-1, 0, 0, -1, 0, 0);
                            m.Translate(flippedImage.Width, flippedImage.Height, MatrixOrder.Append);
                            break;
                        }
                    case AlignmentType.Horizontally:
                        {
                            m = new Matrix(-1, 0, 0, 1, 0, 0);
                            m.Translate(flippedImage.Width, 0, MatrixOrder.Append);
                            break;
                        }
                    case AlignmentType.Vertically:
                        {
                            m = new Matrix(1, 0, 0, -1, 0, 0);
                            m.Translate(0, flippedImage.Height, MatrixOrder.Append);
                            break;
                        }
                    default: throw new ImageException("Not support");
                }

                //Draw
                g.Transform = m;
                if (Opetion != null)
                {
                    var attributes = GetOpacity(Opetion.Opacity);
                    g.DrawImage(image, new Rectangle(0, 0, flippedImage.Width, flippedImage.Height), 0, 0, flippedImage.Width, flippedImage.Height, GraphicsUnit.Pixel, attributes);
                }
                else
                {
                    g.DrawImage(image, 0, 0);
                }

                //clean up
                m.Dispose();
            }

            return flippedImage;
        }
        public TranslationResult ToResult(IReadOnlyList <string> sourceSegment, int prefixCount = 0)
        {
            double[] confidences         = _confidences.ToArray();
            var      sources             = new TranslationSources[Words.Count];
            var      alignment           = new WordAlignmentMatrix(sourceSegment.Count, Words.Count);
            var      phrases             = new List <Phrase>();
            int      trgPhraseStartIndex = 0;

            foreach (PhraseInfo phraseInfo in _phrases)
            {
                double confidence = double.MaxValue;
                for (int j = trgPhraseStartIndex; j < phraseInfo.TargetCut; j++)
                {
                    for (int i = phraseInfo.SourceSegmentRange.Start; i < phraseInfo.SourceSegmentRange.End; i++)
                    {
                        AlignmentType alignmentType = phraseInfo.Alignment[i - phraseInfo.SourceSegmentRange.Start,
                                                                           j - trgPhraseStartIndex];
                        if (alignmentType == AlignmentType.Aligned)
                        {
                            alignment[i, j] = AlignmentType.Aligned;
                        }
                    }

                    if (j < prefixCount)
                    {
                        sources[j] = TranslationSources.Prefix;
                        if (_uncorrectedPrefixWords.Contains(j))
                        {
                            sources[j] |= TranslationSources.Smt;
                        }
                    }
                    else if (_unknownWords.Contains(j))
                    {
                        sources[j] = TranslationSources.None;
                    }
                    else
                    {
                        sources[j] = TranslationSources.Smt;
                    }

                    confidence = Math.Min(confidence, Confidences[j]);
                }

                phrases.Add(new Phrase(phraseInfo.SourceSegmentRange, phraseInfo.TargetCut, confidence));
                trgPhraseStartIndex = phraseInfo.TargetCut;
            }

            return(new TranslationResult(sourceSegment, Words, confidences, sources, alignment, phrases));
        }
示例#30
0
    public static string Alignment2String(AlignmentType alignment)
    {
        switch (alignment)
        {
        case AlignmentType.ENEMY:
            return("enemy");

        case AlignmentType.FRIENDLY:
            return("friendly");

        case AlignmentType.NEUTRAL:
            return("neutral");
        }
        return("neutral");
    }
示例#31
0
        private void LockAlignment()
        {
            var mainAlignment = GetSortedAlignments().FirstOrDefault();

            if (mainAlignment != null)
            {
                _lockedAlignment     = mainAlignment.Item1;
                _lockedAlignmentPlot = mainAlignment.Item2;

                _lockedAlignmentPlot.GetComponentInChildren <AxisAlignmentIndicator>()?.LockAlignment(_lockedAlignment);
            }
            else
            {
                _lockedAlignment     = AlignmentType.Horizontal;
                _lockedAlignmentPlot = null;
            }
        }
示例#32
0
        public void text_composition(AlignmentType at)
        {
            switch (at)
            {
            case AlignmentType.Center:
                richTextBox1.SelectionAlignment = HorizontalAlignment.Center;
                break;

            case AlignmentType.left:
                richTextBox1.SelectionAlignment = HorizontalAlignment.Left;
                break;

            case AlignmentType.right:
                richTextBox1.SelectionAlignment = HorizontalAlignment.Right;
                break;
            }
        }
示例#33
0
 public void ChangeAlignment(AlignmentType type)
 {
     switch(type)
     {
         case AlignmentType.Left:
             fileStream.WriteByte(27);
             fileStream.WriteByte(97);
             fileStream.WriteByte(48);
             break;
         case AlignmentType.Center:
             fileStream.WriteByte(27);
             fileStream.WriteByte(97);
             fileStream.WriteByte(49);
             break;
         case AlignmentType.Right:
             fileStream.WriteByte(27);
             fileStream.WriteByte(97);
             fileStream.WriteByte(50);
             break;
     }
 }
        /// <summary>
        ///     Validates PairwiseOverlapAlignment algorithm for the parameters passed.
        /// </summary>
        /// <param name="nodeName">Xml node name</param>
        /// <param name="isTextFile">Is text file an input.</param>
        /// <param name="caseType">Case Type</param>
        /// <param name="additionalParameter">parameter based on which certain validations are done.</param>
        /// <param name="alignType">Is the Align type Simple or Align with Gap Extension cost?</param>
        /// <param name="similarityMatrixParam">Similarity Matrix</param>
        private void ValidatePairwiseOverlapAlignment(string nodeName, bool isTextFile,
                                                      SequenceCaseType caseType, AlignParameters additionalParameter,
                                                      AlignmentType alignType,
                                                      SimilarityMatrixParameters similarityMatrixParam)
        {
            Sequence aInput = null;
            Sequence bInput = null;

            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                     Constants.AlphabetNameNode));

            if (isTextFile)
            {
                // Read the xml file for getting both the files for aligning.
                string filePath1 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                   Constants.FilePathNode1);
                string filePath2 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                   Constants.FilePathNode2);

                var parser1 = new FastAParser();
                ISequence originalSequence1 = parser1.Parse(filePath1).ElementAt(0);
                ISequence originalSequence2 = parser1.Parse(filePath2).ElementAt(0);

                // Create input sequence for sequence string in different cases.
                GetSequenceWithCaseType(new string(originalSequence1.Select(a => (char) a).ToArray()),
                                        new string(originalSequence2.Select(a => (char) a).ToArray()), alphabet,
                                        caseType, out aInput, out bInput);
            }
            else
            {
                string originalSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
                string originalSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

                // Create input sequence for sequence string in different cases.
                GetSequenceWithCaseType(
                    originalSequence1,
                    originalSequence2,
                    alphabet,
                    caseType,
                    out aInput,
                    out bInput);
            }

            var aInputString = new string(aInput.Select(a => (char) a).ToArray());
            var bInputString = new string(bInput.Select(a => (char) a).ToArray());

            ApplicationLog.WriteLine(string.Format(null,
                                                   "PairwiseOverlapAligner P2 : First sequence used is '{0}'.",
                                                   aInputString));
            ApplicationLog.WriteLine(string.Format(null,
                                                   "PairwiseOverlapAligner P2 : Second sequence used is '{0}'.",
                                                   bInputString));

            // Create similarity matrix object for a given file.
            string blosumFilePath = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode);

            SimilarityMatrix sm = null;

            switch (similarityMatrixParam)
            {
                case SimilarityMatrixParameters.TextReader:
                    using (TextReader reader = new StreamReader(blosumFilePath))
                        sm = new SimilarityMatrix(reader);
                    break;
                case SimilarityMatrixParameters.DiagonalMatrix:
                    string matchValue = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.MatchScoreNode);
                    string misMatchValue = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                           Constants.MisMatchScoreNode);
                    sm = new DiagonalSimilarityMatrix(int.Parse(matchValue, null),
                                                      int.Parse(misMatchValue, null));
                    break;
                default:
                    sm = new SimilarityMatrix(new StreamReader(blosumFilePath));
                    break;
            }

            int gapOpenCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.GapOpenCostNode), null);

            int gapExtensionCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                             Constants.GapExtensionCostNode), null);

            // Create PairwiseOverlapAligner instance and set its values.
            var pairwiseOverlapObj = new PairwiseOverlapAligner();
            if (additionalParameter != AlignParameters.AllParam)
            {
                pairwiseOverlapObj.SimilarityMatrix = sm;
                pairwiseOverlapObj.GapOpenCost = gapOpenCost;
                pairwiseOverlapObj.GapExtensionCost = gapExtensionCost;
            }
            IList<IPairwiseSequenceAlignment> result = null;

            // Align the input sequences.
            switch (additionalParameter)
            {
                case AlignParameters.AlignList:
                    var sequences = new List<ISequence>();
                    sequences.Add(aInput);
                    sequences.Add(bInput);
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = pairwiseOverlapObj.Align(sequences);
                            break;
                        default:
                            result = pairwiseOverlapObj.AlignSimple(sequences);
                            break;
                    }
                    break;
                case AlignParameters.AlignTwo:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = pairwiseOverlapObj.Align(aInput, bInput);
                            break;
                        default:
                            result = pairwiseOverlapObj.AlignSimple(aInput, bInput);
                            break;
                    }
                    break;
                case AlignParameters.AllParam:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = pairwiseOverlapObj.Align(sm, gapOpenCost,
                                                              gapExtensionCost, aInput, bInput);
                            break;
                        default:
                            result = pairwiseOverlapObj.AlignSimple(sm, gapOpenCost, aInput, bInput);
                            break;
                    }
                    break;
                default:
                    break;
            }

            aInput = null;
            bInput = null;
            sm = null;

            // Get the expected sequence and scorde from xml config.
            string expectedSequence1 = string.Empty;
            string expectedSequence2 = string.Empty;
            string expectedScore = string.Empty;

            switch (alignType)
            {
                case AlignmentType.Align:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                    Constants.ExpectedGapExtensionScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.ExpectedGapExtensionSequence1Node);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.ExpectedGapExtensionSequence2Node);
                    break;
                default:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                    Constants.ExpectedScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.ExpectedSequenceNode1);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.ExpectedSequenceNode2);
                    break;
            }

            IList<IPairwiseSequenceAlignment> expectedOutput = new List<IPairwiseSequenceAlignment>();
            string[] expectedSequences1, expectedSequences2;
            var seperators = new char[1] {';'};
            expectedSequences1 = expectedSequence1.Split(seperators);
            expectedSequences2 = expectedSequence2.Split(seperators);

            IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment();
            PairwiseAlignedSequence alignedSeq;
            for (int i = 0; i < expectedSequences1.Length; i++)
            {
                alignedSeq = new PairwiseAlignedSequence
                {
                    FirstSequence = new Sequence(alphabet, expectedSequences1[i]),
                    SecondSequence = new Sequence(alphabet, expectedSequences2[i]),
                    Score = Convert.ToInt32(expectedScore, null),
                    FirstOffset = Int32.MinValue,
                    SecondOffset = Int32.MinValue,
                };
                align.PairwiseAlignedSequences.Add(alignedSeq);
            }

            expectedOutput.Add(align);
            Assert.IsTrue(AlignmentHelpers.CompareAlignment(result, expectedOutput,true));

            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P2 : Final Score '{0}'.", expectedScore));
            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P2 : Aligned First Sequence is '{0}'.", expectedSequence1));
            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P2 : Aligned Second Sequence is '{0}'.", expectedSequence2));
        }
示例#35
0
        /// <summary>
        /// Creates a standard 'Inner Table' with respective borders.
        /// By setting <see cref="keepContentTogether"/> to true, it will ensure the entire
        /// table rows at hand is not broken up across pages and will be treated as a single 
        /// entity.
        /// The inner table that is created can be nested in another table if you specify 
        /// <see cref="parentTable"/>.
        /// </summary>
        /// <param name="resourceColumnWidths">resourceColumnWidths</param>
        /// <param name="parentTable">parentTable</param>
        /// <param name="borderSide">borderSide</param>
        /// <param name="fontName">fontName</param>
        /// <param name="fontSize">fontSize</param>
        /// <param name="alignment">alignment</param>
        /// <param name="padding">padding</param>
        /// <param name="keepContentTogether">keepContentTogether</param>
        /// <param name="isKeptWithNext">isKeptWithNext</param>
        /// <param name="isKeptTogether">isKeptTogether</param>
        /// <returns>Inner table</returns>
        public Generator.Table CreateInnerTable(
            string resourceColumnWidths,
            Generator.Table parentTable = null,
            Generator.BorderSide borderSide = Generator.BorderSide.All,
            string fontName = "",
            float fontSize = 0f,
            AlignmentType alignment = AlignmentType.Left,
            Generator.MarginInfo padding = null,
            bool keepContentTogether = false,
            bool isKeptWithNext = false,
            bool isKeptTogether = false)
        {
            Generator.Table table;
            if (parentTable != null)
            {
                var row = parentTable.Rows.Add();
                if (padding != null)
                {
                    row.DefaultRowCellPadding = padding;
                }
                var cell = row.Cells.Add();
                table = new Generator.Table(cell)
                {
                    ColumnWidths = resourceColumnWidths,
                    DefaultCellBorder = borderSide != Generator.BorderSide.None
                        ? new Generator.BorderInfo((int)borderSide, DefaultBorderSize)
                        : new Generator.BorderInfo((int)Generator.BorderSide.None),
                    DefaultCellTextInfo =
                    {
                        FontSize = fontSize > 0
                            ? fontSize
                            : DefaultInnerBodyFontSize,
                        FontName = !string.IsNullOrEmpty(fontName)
                            ? fontName
                            : Properties.Resources.ArialFont
                    },
                    Alignment = alignment,
                    IsBroken = !keepContentTogether,
                    IsFirstRowRepeated = true,
                    IsKeptWithNext = isKeptWithNext,
                    IsKeptTogether = isKeptTogether
                };
                cell.IsNoBorder = true;
                cell.Paragraphs.Add(table);
            }
            else
            {
                table = new Generator.Table
                {
                    ColumnWidths = resourceColumnWidths,
                    DefaultCellBorder = borderSide != Generator.BorderSide.None
                        ? new Generator.BorderInfo((int)borderSide, DefaultBorderSize)
                        : new Generator.BorderInfo((int)Generator.BorderSide.None, DefaultBorderSize),
                    DefaultCellTextInfo =
                    {
                        FontSize = fontSize > 0
                            ? fontSize
                            : DefaultInnerBodyFontSize,
                        FontName = !string.IsNullOrEmpty(fontName)
                            ? fontName
                            : Properties.Resources.ArialFont
                    },
                    Alignment = alignment,
                    IsBroken = !keepContentTogether,
                    IsFirstRowRepeated = true,
                    IsKeptWithNext = isKeptWithNext
                };
                if (padding != null)
                {
                    table.DefaultCellPadding = padding;
                }
                Section.Paragraphs.Add(table);
            }

            return table;
        }
 /// <summary>
 /// Causes the given Window to align itself alongside the parent (ie, Owner) window.
 /// You should put the call to this within the LayoutUpdated or Loaded event handler of the Window you want to align itself
 /// to it's parent. The Owner property has to have been set, otherwise there's nothing for it to align against.
 /// </summary>
 /// <param name="dialog">The given Window that is to be aligned</param>
 /// <param name="inWhichDirection">Specifieds a preference toward which side or edge to align it to, if there's room on the display for that.</param>
 public static void AlignToParent(this Window dialog, AlignmentType inWhichDirection)
 {
     //TODO ?
     #if !SILVERLIGHT
     Window parent = dialog.Owner as Window;
     if (parent != null)
     {
         if (inWhichDirection == AlignmentType.ToRightOfParent)
         {
             // Try the right side, then the left.
             if (AlignToRight(dialog))
             {
                 return;
             }
             else if (AlignToLeft(dialog))
             {
                 return;
             }
         }
         else if (inWhichDirection == AlignmentType.ToLeftOfParent)
         {
             // Try the left side, then the right.
             if (AlignToLeft(dialog))
             {
                 return;
             }
             else if (AlignToRight(dialog))
             {
                 return;
             }
         }
         else if (inWhichDirection == AlignmentType.AboveParent)
         {
             double parentTop = parent.Top;
             double myHeight = dialog.Height;
             double separation = 2;
             if (parentTop >= myHeight)
             {
                 if (parentTop > (myHeight + separation))
                 {
                     dialog.Top = parentTop - separation - myHeight;
                 }
                 else
                 {
                     dialog.Top = parentTop - myHeight;
                 }
                 dialog.Left = parent.Left;
                 return;
             }
         }
         // failing that, I'll try underneath
         AlignToBottom(dialog);
         // otherwise.. at this point I think it's time to throw in the towel and forget about it.
     }
     #endif
 }
示例#37
0
        private void ValidateSmithWatermanAlignment(bool isTextFile, AlignmentParamType alignParam,
                                                    AlignmentType alignType)
        {
            ISequence aInput, bInput;
            IAlphabet alphabet =
                Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(Constants.SmithWatermanAlignAlgorithmNodeName,
                                                                    Constants.AlphabetNameNode));

            if (isTextFile)
            {
                // Read the xml file for getting both the files for aligning.
                string filePath1 = this.utilityObj.xmlUtil.GetTextValue(Constants.SmithWatermanAlignAlgorithmNodeName,
                                                                   Constants.FilePathNode1);
                string filePath2 = this.utilityObj.xmlUtil.GetTextValue(Constants.SmithWatermanAlignAlgorithmNodeName,
                                                                   Constants.FilePathNode2);

                // Parse the files and get the sequence.
                var parseObjectForFile1 = new FastAParser();
                {
                    parseObjectForFile1.Alphabet = alphabet;
                    aInput = parseObjectForFile1.Parse(filePath1).First();
                }

                var parseObjectForFile2 = new FastAParser();
                {
                    parseObjectForFile2.Alphabet = alphabet;
                    bInput = parseObjectForFile2.Parse(filePath2).First();
                }
            }
            else
            {
                // Read the xml file for getting both the files for aligning.
                string origSequence1 = this.utilityObj.xmlUtil.GetTextValue(Constants.SmithWatermanAlignAlgorithmNodeName,
                                                                       Constants.SequenceNode1);
                string origSequence2 = this.utilityObj.xmlUtil.GetTextValue(Constants.SmithWatermanAlignAlgorithmNodeName,
                                                                       Constants.SequenceNode2);
                aInput = new Sequence(alphabet, origSequence1);
                bInput = new Sequence(alphabet, origSequence2);
            }

            string blosumFilePath = this.utilityObj.xmlUtil.GetTextValue(Constants.SmithWatermanAlignAlgorithmNodeName,
                                                                    Constants.BlosumFilePathNode);

            var sm = new SimilarityMatrix(new StreamReader(blosumFilePath));
            int gapOpenCost =
                int.Parse(
                    this.utilityObj.xmlUtil.GetTextValue(Constants.SmithWatermanAlignAlgorithmNodeName,
                                                    Constants.GapOpenCostNode), null);
            int gapExtensionCost =
                int.Parse(
                    this.utilityObj.xmlUtil.GetTextValue(Constants.SmithWatermanAlignAlgorithmNodeName,
                                                    Constants.GapExtensionCostNode), null);

            var smithWatermanObj = new SmithWatermanAligner();
            if (AlignmentParamType.AllParam != alignParam)
            {
                smithWatermanObj.SimilarityMatrix = sm;
                smithWatermanObj.GapOpenCost = gapOpenCost;
            }

            IList<IPairwiseSequenceAlignment> result = null;

            switch (alignParam)
            {
                case AlignmentParamType.AlignList:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = smithWatermanObj.Align(new List<ISequence> {aInput, bInput});
                            break;
                        default:
                            result = smithWatermanObj.AlignSimple(new List<ISequence> {aInput, bInput});
                            break;
                    }
                    break;
                case AlignmentParamType.AlignTwo:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = smithWatermanObj.Align(aInput, bInput);
                            break;
                        default:
                            result = smithWatermanObj.AlignSimple(aInput, bInput);
                            break;
                    }
                    break;
                case AlignmentParamType.AllParam:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = smithWatermanObj.Align(sm, gapOpenCost,
                                                            gapExtensionCost, aInput, bInput);
                            break;
                        default:
                            result = smithWatermanObj.AlignSimple(sm, gapOpenCost, aInput, bInput);
                            break;
                    }
                    break;
                default:
                    break;
            }

            // Read the xml file for getting both the files for aligning.
            string expectedSequence1, expectedSequence2, expectedScore;

            switch (alignType)
            {
                case AlignmentType.Align:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(
                        Constants.SmithWatermanAlignAlgorithmNodeName,
                        Constants.ExpectedGapExtensionScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(
                        Constants.SmithWatermanAlignAlgorithmNodeName,
                        Constants.ExpectedGapExtensionSequence1Node);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(
                        Constants.SmithWatermanAlignAlgorithmNodeName,
                        Constants.ExpectedGapExtensionSequence2Node);
                    break;
                default:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(
                        Constants.SmithWatermanAlignAlgorithmNodeName,
                        Constants.ExpectedScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(
                        Constants.SmithWatermanAlignAlgorithmNodeName,
                        Constants.ExpectedSequenceNode1);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(
                        Constants.SmithWatermanAlignAlgorithmNodeName,
                        Constants.ExpectedSequenceNode2);
                    break;
            }

            IList<IPairwiseSequenceAlignment> expectedOutput = new List<IPairwiseSequenceAlignment>();

            IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment();
            var alignedSeq = new PairwiseAlignedSequence
                                 {
                                     FirstSequence = new Sequence(alphabet, expectedSequence1),
                                     SecondSequence = new Sequence(alphabet, expectedSequence2),
                                     Score = Convert.ToInt32(expectedScore, null),
                                     FirstOffset = Int32.MinValue,
                                     SecondOffset = Int32.MinValue,
                                 };
            align.PairwiseAlignedSequences.Add(alignedSeq);
            expectedOutput.Add(align);

            ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner BVT : Final Score '{0}'.", expectedScore));
            ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner BVT : Aligned First Sequence is '{0}'.",
                                                   expectedSequence1));
            ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner BVT : Aligned Second Sequence is '{0}'.",
                                                   expectedSequence2));

            Assert.IsTrue(CompareAlignment(result, expectedOutput));
        }
示例#38
0
        /// <summary>
        /// Creates Inner Table Item Cell(s). Must provide at least ONE <see cref="cellContent"/> 
        /// and an applicable <see cref="row"/>.
        /// </summary>
        /// <param name="row">row</param>
        /// <param name="defaultPadding">defaultPadding</param>
        /// <param name="backgroundColor">backgroundColor</param>
        /// <param name="textColor">textColor</param>
        /// <param name="fontName">fontName</param>
        /// <param name="fontSize">fontSize</param>
        /// <param name="verticalAlignment">verticalAlignment</param>
        /// <param name="alignment">alignment</param>
        /// <param name="fixedRowHeight">fixedRowHeight</param>
        /// <param name="cellContent">cellContent</param>
        public void CreateInnerTableItemCells(
            Generator.Row row,
            Generator.MarginInfo defaultPadding = null,
            string backgroundColor = "",
            string textColor = "",
            string fontName = "",
            int fontSize = 0,
            VerticalAlignmentType verticalAlignment = VerticalAlignmentType.Bottom,
            AlignmentType alignment = AlignmentType.Left,
            float fixedRowHeight = 0,
            params DisplayCell[] cellContent)
        {
            row.IsBroken = false;
            row.BackgroundColor = new Generator.Color(
                !string.IsNullOrEmpty(backgroundColor)
                    ? backgroundColor
                    : Properties.Resources.InnerTableColor);
            row.DefaultCellTextInfo.Color = new Generator.Color(
                !string.IsNullOrEmpty(textColor)
                    ? textColor
                    : Properties.Resources.GreyColor);
            row.DefaultCellTextInfo.FontName = !string.IsNullOrEmpty(fontName)
                ? fontName
                : Properties.Resources.ArialFont;
            row.DefaultCellTextInfo.FontSize = fontSize == 0
                ? DefaultInnerBodyFontSize
                : fontSize;
            row.DefaultCellTextInfo.Alignment = alignment;
            row.VerticalAlignment = verticalAlignment;
            row.DefaultRowCellPadding = defaultPadding ?? DefaultInnerPadding;
            if (fixedRowHeight > 0)
            {
                row.FixedRowHeight = fixedRowHeight;
            }

            // Add content
            if (cellContent.IsAny())
            {
                foreach (var item in cellContent)
                {
                    Generator.Cell cell;
                    if (item.TextAreaInfo != null)
                    {
                        cell = CreateTextAreaCell(row, item.Content, item.TextAreaInfo.Padding,
                            verticalAlignment, alignment, item.TextAreaInfo.WithBorder,
                            item.TextAreaInfo.WithRoundedCorners);
                    }
                    else
                    {
                        cell = row.Cells.Add();
                        if (item.TableInfo != null)
                        {
                            cell.Paragraphs.Add(item.TableInfo);
                        }
                        else if (item.IsCheckBox)
                        {
                            if (item.IsChecked)
                            {
                                var checkbox = CreateCheckBox();
                                cell.Paragraphs.Add(checkbox);
                            }
                            else
                            {
                                CreateCellText(row, cell, Properties.Resources.CrossLabel, Properties.Resources.ArialUnicodeFont); 
                            }
                        }
                        else
                        {
                            // this is a safer way to add in content into a cell without it causing exceptions.
                            CreateCellText(row, cell, item.Content);
                        }
                    }

                    if (item.Border != Generator.BorderSide.None)
                    {
                        cell.Border = new Generator.BorderInfo((int)item.Border, DefaultBorderSize);
                    }
                    if (!string.IsNullOrEmpty(item.Color))
                    {
                        cell.DefaultCellTextInfo.Color = new Generator.Color(item.Color);
                    }
                    if (item.NeedCellBorder)
                    {
                        cell.Border = new Generator.BorderInfo((int)Generator.BorderSide.All, DefaultBorderSize);
                    }
                    if (item.IsDate || item.IsCentralized)
                    {
                        cell.Alignment = AlignmentType.Center;
                    }
                    if (item.IsTotal)
                    {
                        // Bold font
                        cell.DefaultCellTextInfo.FontName = Properties.Resources.ArialFont;
                        row.DefaultCellTextInfo.IsTrueTypeFontBold = true;
                    }
                    if (item.IsCurrency)
                    {
                        cell.Alignment = AlignmentType.Right;
                        cell.VerticalAlignment = VerticalAlignmentType.Center;
                    }
                    if (!string.IsNullOrEmpty(item.BackgroundColor))
                    {
                        cell.BackgroundColor = new Generator.Color(item.BackgroundColor);
                    }
                    if (item.IsHeader)
                    {
                        cell.BackgroundColor = new Generator.Color(Properties.Resources.HeaderTableBackgroundColor);
                        cell.DefaultCellTextInfo.Color = new Generator.Color(Properties.Resources.WhiteColor);
                        cell.DefaultCellTextInfo.FontName = Properties.Resources.ArialFont;
                        cell.DefaultCellTextInfo.FontSize = DefaultHeadingThreeFontSize;
                        cell.DefaultCellTextInfo.IsTrueTypeFontBold = true;
                    }
                    if (item.IsEmpty)
                    {
                        cell.BackgroundColor = new Generator.Color(Properties.Resources.LightGrayColor);
                    }

                    cell.ColumnsSpan = item.ColumnSpan > 0
                        ? item.ColumnSpan
                        : DefaultColumnSpan;

                    cell.RowSpan = item.RowSpan > 0
                        ? item.RowSpan
                        : DefaultRowSpan;
                }
            }
        }
示例#39
0
        /// <summary>
        ///     Converts an alignment to another enum (e.g. Unity's built in types, NGUI or EZ GUI).
        /// </summary>
        /// <param name="screenAlign">alignment in our encoding</param>
        /// <param name="alignmentType">target alignment</param>
        /// <returns></returns>
        public static int ConvertAlignment(NGAlignment.ScreenAlign screenAlign, AlignmentType alignmentType)
        {
            switch (alignmentType) {
                case AlignmentType.TextAnchor:
                    switch (screenAlign) {
                        case NGAlignment.ScreenAlign.TopLeft: return (int)TextAnchor.UpperLeft;
                        case NGAlignment.ScreenAlign.MiddleLeft: return (int)TextAnchor.MiddleLeft;
                        case NGAlignment.ScreenAlign.BottomLeft: return (int)TextAnchor.LowerLeft;
                        case NGAlignment.ScreenAlign.TopCenter: return (int)TextAnchor.UpperCenter;
                        case NGAlignment.ScreenAlign.MiddleCenter: return (int)TextAnchor.MiddleCenter;
                        case NGAlignment.ScreenAlign.BottomCenter: return (int)TextAnchor.LowerCenter;
                        case NGAlignment.ScreenAlign.TopRight: return (int)TextAnchor.UpperRight;
                        case NGAlignment.ScreenAlign.MiddleRight: return (int)TextAnchor.MiddleRight;
                        case NGAlignment.ScreenAlign.BottomRight: return (int)TextAnchor.LowerRight;
                    }
                    break;
                case AlignmentType.TextAlignment:
                    switch (Horizontal(screenAlign)) {
                        case NGAlignment.HorizontalAlign.Left: return (int)TextAlignment.Left;
                        case NGAlignment.HorizontalAlign.Center: return (int)TextAlignment.Center;
                        case NGAlignment.HorizontalAlign.Right: return (int)TextAlignment.Right;
                    }
                    break;
                case AlignmentType.NGUI_Pivot:
                    switch (screenAlign) {
                        //TopLeft     0
                        //Top         1
                        //TopRight    2
                        //Left        3
                        //Center      4
                        //Right       5
                        //BottomLeft  6
                        //Bottom      7
                        //BottomRight 8
                        case NGAlignment.ScreenAlign.TopLeft: return 0; //(int) UIWidget.Pivot.TopLeft;
                        case NGAlignment.ScreenAlign.MiddleLeft: return 3; //(int) UIWidget.Pivot.Left;
                        case NGAlignment.ScreenAlign.BottomLeft: return 6; //(int) UIWidget.Pivot.BottomLeft;
                        case NGAlignment.ScreenAlign.TopCenter: return 1; //(int) UIWidget.Pivot.Top;
                        case NGAlignment.ScreenAlign.MiddleCenter: return 4; //(int) UIWidget.Pivot.Center;
                        case NGAlignment.ScreenAlign.BottomCenter: return 7; //(int) UIWidget.Pivot.Bottom;
                        case NGAlignment.ScreenAlign.TopRight: return 2; //(int) UIWidget.Pivot.TopRight;
                        case NGAlignment.ScreenAlign.MiddleRight: return 5; //(int) UIWidget.Pivot.Right;
                        case NGAlignment.ScreenAlign.BottomRight: return 8; //(int) UIWidget.Pivot.BottomRight;
                    }
                    break;
                case AlignmentType.EZGUI_Alignment:
                    //Left,
                    //Center,
                    //Right
                    switch (Horizontal(screenAlign)) {
                        case NGAlignment.HorizontalAlign.Left: return 0;
                        case NGAlignment.HorizontalAlign.Center: return 1;
                        case NGAlignment.HorizontalAlign.Right: return 2;
                    }
                    break;
                case AlignmentType.EZGUI_Anchor:
                    switch (screenAlign) {
                        //Upper_Left,
                        //Upper_Center,
                        //Upper_Right,
                        //Middle_Left,
                        //Middle_Center,
                        //Middle_Right,
                        //Lower_Left,
                        //Lower_Center,
                        //Lower_Right
                        case NGAlignment.ScreenAlign.TopLeft: return 0;
                        case NGAlignment.ScreenAlign.TopCenter: return 1;
                        case NGAlignment.ScreenAlign.TopRight: return 2;
                        case NGAlignment.ScreenAlign.MiddleLeft: return 3;
                        case NGAlignment.ScreenAlign.MiddleCenter: return 4;
                        case NGAlignment.ScreenAlign.MiddleRight: return 5;
                        case NGAlignment.ScreenAlign.BottomLeft: return 6;
                        case NGAlignment.ScreenAlign.BottomCenter: return 7;
                        case NGAlignment.ScreenAlign.BottomRight: return 8;
                    }
                    break;
            }

            // Fallback, should never be called
            return (int)TextAnchor.UpperLeft;
        }
示例#40
0
 public LinearLayout(AlignmentType alignment)
 {
     Alignment = alignment;
 }
示例#41
0
        private void InValidateSmithWatermanAlignmentWithInvalidSequence(string nodeName,
                                                                         bool isTextFile,
                                                                         InvalidSequenceType invalidSequenceType,
                                                                         AlignParameters additionalParameter,
                                                                         AlignmentType alignType,
                                                                         InvalidSequenceType sequenceType)
        {
            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                     Constants.AlphabetNameNode));

            Exception actualException = null;
            Sequence aInput = null;
            Sequence bInput = null;

            if (isTextFile)
            {
                // Read the xml file for getting both the files for aligning.
                string filepath = this.GetInputFileNameWithInvalidType(nodeName, invalidSequenceType);

                // Create input sequence for sequence string in different cases.
                try
                {
                    // Parse the files and get the sequence.
                    IEnumerable<ISequence> seqs = null;
                    var parser = new FastAParser();
                    seqs = parser.Parse(filepath);
                    aInput = new Sequence(alphabet, new string(seqs.ElementAt(0).Select(a => (char) a).ToArray()));
                }
                catch (Exception ex)
                {
                    actualException = ex;
                }
            }
            else
            {
                string originalSequence = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                          Constants.InvalidSequence1);

                // Create input sequence for sequence string in different cases.
                try
                {
                    aInput = new Sequence(alphabet, originalSequence);
                }
                catch (ArgumentException ex)
                {
                    actualException = ex;
                }
            }

            if (actualException == null)
            {
                bInput = aInput;

                // Create similarity matrix object for a given file.
                string blosumFilePath = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.BlosumFilePathNode);

                var sm = new SimilarityMatrix(new StreamReader(blosumFilePath));

                int gapOpenCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                            Constants.GapOpenCostNode), null);

                int gapExtensionCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                 Constants.GapExtensionCostNode), null);

                // Create SmithWatermanAligner instance and set its values.
                var smithWatermanObj = new SmithWatermanAligner();
                if (additionalParameter != AlignParameters.AllParam)
                {
                    smithWatermanObj.SimilarityMatrix = sm;
                    smithWatermanObj.GapOpenCost = gapOpenCost;
                    smithWatermanObj.GapExtensionCost = gapExtensionCost;
                }

                // Align the input sequences and catch the exception.
                switch (additionalParameter)
                {
                    case AlignParameters.AlignList:
                        switch (alignType)
                        {
                            case AlignmentType.Align:
                                try
                                {
                                    smithWatermanObj.Align(new List<ISequence> {aInput, bInput});
                                }
                                catch (ArgumentException ex)
                                {
                                    actualException = ex;
                                }
                                break;
                            default:
                                try
                                {
                                    smithWatermanObj.AlignSimple(new List<ISequence> {aInput, bInput});
                                }
                                catch (ArgumentException ex)
                                {
                                    actualException = ex;
                                }
                                break;
                        }
                        break;
                    case AlignParameters.AlignTwo:
                        switch (alignType)
                        {
                            case AlignmentType.Align:
                                try
                                {
                                    smithWatermanObj.Align(aInput, bInput);
                                }
                                catch (ArgumentException ex)
                                {
                                    actualException = ex;
                                }
                                break;
                            default:
                                try
                                {
                                    smithWatermanObj.AlignSimple(aInput, bInput);
                                }
                                catch (ArgumentException ex)
                                {
                                    actualException = ex;
                                }
                                break;
                        }
                        break;
                    case AlignParameters.AllParam:
                        switch (alignType)
                        {
                            case AlignmentType.Align:
                                try
                                {
                                    smithWatermanObj.Align(sm, gapOpenCost,
                                                           gapExtensionCost, aInput, bInput);
                                }
                                catch (ArgumentException ex)
                                {
                                    actualException = ex;
                                }
                                break;
                            default:
                                try
                                {
                                    smithWatermanObj.AlignSimple(sm, gapOpenCost,
                                                                 aInput, bInput);
                                }
                                catch (ArgumentException ex)
                                {
                                    actualException = ex;
                                }
                                break;
                        }
                        break;
                    default:
                        break;
                }
            }

            // Validate Error messages for Invalid Sequence types.
            string expectedErrorMessage = this.GetExpectedErrorMeesageWithInvalidSequenceType(nodeName,
                                                                                         sequenceType);

            Assert.AreEqual(expectedErrorMessage, actualException.Message);

            ApplicationLog.WriteLine(string.Concat(
                "SmithWatermanAligner P2 : Expected Error message is thrown ", expectedErrorMessage));
        }
示例#42
0
        private void InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix(string nodeName,
                                                                                 bool isTextFile,
                                                                                 SimilarityMatrixInvalidTypes
                                                                                     invalidType,
                                                                                 AlignParameters additionalParameter,
                                                                                 AlignmentType alignType)
        {
            Sequence aInput = null;
            Sequence bInput = null;
            ISequence inputSequence1;
            ISequence inputSequence2;

            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                     Constants.AlphabetNameNode));
            if (isTextFile)
            {
                // Read the xml file for getting both the files for aligning.
                string firstInputFilepath = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                            Constants.FilePathNode1);
                string secondInputFilepath = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                             Constants.FilePathNode2);

                // Parse the files and get the sequence.
                var parseObjectForFile1 = new FastAParser { Alphabet = alphabet };
                inputSequence1 = parseObjectForFile1.Parse(firstInputFilepath).ElementAt(0);
                inputSequence2 = parseObjectForFile1.Parse(secondInputFilepath).ElementAt(0);

                // Create input sequence for sequence string in different cases.
                GetSequenceWithCaseType(new string(inputSequence1.Select(a => (char) a).ToArray()),
                                        new string(inputSequence2.Select(a => (char) a).ToArray()),
                                        alphabet, SequenceCaseType.LowerCase, out aInput, out bInput);
            }
            else
            {
                string firstInputSequence = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
                string secondInputSequence = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

                // Create input sequence for sequence string in different cases.
                GetSequenceWithCaseType(firstInputSequence, secondInputSequence,
                                        alphabet, SequenceCaseType.LowerCase, out aInput, out bInput);
            }

            ApplicationLog.WriteLine(string.Concat(
                "SmithWatermanAligner P2 : First sequence used is '{0}'.",
                new string(aInput.Select(a => (char) a).ToArray())));
            ApplicationLog.WriteLine(string.Concat(
                "SmithWatermanAligner P2 : Second sequence used is '{0}'.",
                new string(bInput.Select(a => (char) a).ToArray())));

            // Create similarity matrix object for a invalid file.
            string blosumFilePath = this.GetSimilarityMatrixFileWithInvalidType(nodeName, invalidType);
            Exception actualExpection = null;

            // For invalid similarity matrix data format; exception will be thrown while instantiating
            SimilarityMatrix sm = null;
            try
            {
                if (invalidType != SimilarityMatrixInvalidTypes.NullSimilarityMatrix)
                {
                    sm = new SimilarityMatrix(new StreamReader(blosumFilePath));
                }
            }
            catch (InvalidDataException ex)
            {
                actualExpection = ex;
            }

            // For non matching similarity matrix exception will be thrown while alignment
            if (actualExpection == null)
            {
                int gapOpenCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                            Constants.GapOpenCostNode), null);

                int gapExtensionCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                 Constants.GapExtensionCostNode), null);

                // Create SmithWatermanAligner instance and set its values.
                var smithWatermanObj = new SmithWatermanAligner();
                if (additionalParameter != AlignParameters.AllParam)
                {
                    smithWatermanObj.SimilarityMatrix = sm;
                    smithWatermanObj.GapOpenCost = gapOpenCost;
                    smithWatermanObj.GapExtensionCost = gapExtensionCost;
                }

                // Align the input sequences and catch the exception.
                switch (additionalParameter)
                {
                    case AlignParameters.AlignList:
                        switch (alignType)
                        {
                            case AlignmentType.Align:
                                try
                                {
                                    smithWatermanObj.Align(new List<ISequence> {aInput, bInput});
                                }
                                catch (ArgumentException ex)
                                {
                                    actualExpection = ex;
                                }
                                break;
                            default:
                                try
                                {
                                    smithWatermanObj.AlignSimple(new List<ISequence> {aInput, bInput});
                                }
                                catch (ArgumentException ex)
                                {
                                    actualExpection = ex;
                                }
                                break;
                        }
                        break;
                    case AlignParameters.AlignTwo:
                        switch (alignType)
                        {
                            case AlignmentType.Align:
                                try
                                {
                                    smithWatermanObj.Align(aInput, bInput);
                                }
                                catch (ArgumentException ex)
                                {
                                    actualExpection = ex;
                                }
                                break;
                            default:
                                try
                                {
                                    smithWatermanObj.AlignSimple(aInput, bInput);
                                }
                                catch (ArgumentException ex)
                                {
                                    actualExpection = ex;
                                }
                                break;
                        }
                        break;
                    case AlignParameters.AllParam:
                        switch (alignType)
                        {
                            case AlignmentType.Align:
                                try
                                {
                                    smithWatermanObj.Align(sm, gapOpenCost, gapExtensionCost,
                                                           aInput, bInput);
                                }
                                catch (ArgumentException ex)
                                {
                                    actualExpection = ex;
                                }
                                break;
                            default:
                                try
                                {
                                    smithWatermanObj.AlignSimple(sm, gapOpenCost, aInput, bInput);
                                }
                                catch (ArgumentException ex)
                                {
                                    actualExpection = ex;
                                }
                                break;
                        }
                        break;
                    default:
                        break;
                }
            }

            // Validate that expected exception is thrown using error message.
            string expectedErrorMessage = this.GetExpectedErrorMeesageWithInvalidSimilarityMatrixType(nodeName,
                                                                                                 invalidType);
            Assert.AreEqual(expectedErrorMessage, actualExpection.Message);

            ApplicationLog.WriteLine(string.Concat(
                "SmithWatermanAligner P2 : Expected Error message is thrown ", expectedErrorMessage));
        }
示例#43
0
 /// <summary>
 ///     Validates SmithWatermanAlignment algorithm for the parameters passed.
 /// </summary>
 /// <param name="nodeName">Xml node name</param>
 /// <param name="isTextFile">Is text file an input.</param>
 /// <param name="caseType">Case Type</param>
 /// <param name="additionalParameter">parameter based on which certain validations are done.</param>
 /// <param name="alignType">Is the Align type Simple or Align with Gap Extension cost?</param>
 private void ValidateSmithWatermanAlignment(string nodeName, bool isTextFile,
                                             SequenceCaseType caseType, AlignParameters additionalParameter,
                                             AlignmentType alignType)
 {
     this.ValidateSmithWatermanAlignment(nodeName, isTextFile, caseType, additionalParameter,
                                    alignType, SimilarityMatrixParameters.Default);
 }
示例#44
0
        private void ValidateSmithWatermanAlignment(string nodeName, bool isTextFile,
                                                    SequenceCaseType caseType, AlignParameters additionalParameter,
                                                    AlignmentType alignType,
                                                    SimilarityMatrixParameters similarityMatrixParam)
        {
            Sequence aInput, bInput;
            IAlphabet alphabet =
                Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode));

            if (isTextFile)
            {
                // Read the xml file for getting both the files for aligning.
                string filePath1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode1);
                string filePath2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode2);

                // Parse the files and get the sequence.
                ISequence originalSequence1 = null;
                ISequence originalSequence2 = null;

                var parseObjectForFile1 = new FastAParser { Alphabet = alphabet };
                originalSequence1 = parseObjectForFile1.Parse(filePath1).ElementAt(0);
                originalSequence2 = parseObjectForFile1.Parse(filePath2).ElementAt(0);

                // Create input sequence for sequence string in different cases.             
                GetSequenceWithCaseType(originalSequence1.ConvertToString(), originalSequence2.ConvertToString(),
                                        alphabet, caseType, out aInput, out bInput);
            }
            else
            {
                string originalSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
                string originalSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

                // Create input sequence for sequence string in different cases.
                GetSequenceWithCaseType(
                    originalSequence1,
                    originalSequence2,
                    alphabet,
                    caseType,
                    out aInput,
                    out bInput);
            }

            ApplicationLog.WriteLine(string.Format("SmithWatermanAligner P2 : First sequence used is '{0}'.",
                                                   aInput.ConvertToString()));
            ApplicationLog.WriteLine(string.Format("SmithWatermanAligner P2 : Second sequence used is '{0}'.",
                                                   bInput.ConvertToString()));

            // Create similarity matrix object for a given file.
            string blosumFilePath = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode);
            SimilarityMatrix sm;
            switch (similarityMatrixParam)
            {
                case SimilarityMatrixParameters.TextReader:
                    using (TextReader reader = new StreamReader(blosumFilePath))
                        sm = new SimilarityMatrix(reader);
                    break;
                case SimilarityMatrixParameters.DiagonalMatrix:
                    string matchValue = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.MatchScoreNode);
                    string misMatchValue = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                           Constants.MisMatchScoreNode);
                    sm = new DiagonalSimilarityMatrix(int.Parse(matchValue, null),
                                                      int.Parse(misMatchValue, null));
                    break;
                default:
                    sm = new SimilarityMatrix(new StreamReader(blosumFilePath));
                    break;
            }

            int gapOpenCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapOpenCostNode), null);
            int gapExtensionCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapExtensionCostNode),
                                             null);

            // Create SmithWatermanAligner instance and set its values.
            var smithWatermanObj = new SmithWatermanAligner();
            if (additionalParameter != AlignParameters.AllParam)
            {
                smithWatermanObj.SimilarityMatrix = sm;
                smithWatermanObj.GapOpenCost = gapOpenCost;
                smithWatermanObj.GapExtensionCost = gapExtensionCost;
            }
            IList<IPairwiseSequenceAlignment> result = null;

            // Align the input sequences.
            switch (additionalParameter)
            {
                case AlignParameters.AlignList:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = smithWatermanObj.Align(new List<ISequence> {aInput, bInput});
                            break;
                        default:
                            result = smithWatermanObj.AlignSimple(new List<ISequence> {aInput, bInput});
                            break;
                    }
                    break;
                case AlignParameters.AlignTwo:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = smithWatermanObj.Align(aInput, bInput);
                            break;
                        default:
                            result = smithWatermanObj.AlignSimple(aInput, bInput);
                            break;
                    }
                    break;
                case AlignParameters.AllParam:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = smithWatermanObj.Align(sm, gapOpenCost,
                                                            gapExtensionCost, aInput, bInput);
                            break;
                        default:
                            result = smithWatermanObj.AlignSimple(sm, gapOpenCost, aInput, bInput);
                            break;
                    }
                    break;
                default:
                    break;
            }

            // Get the expected sequence and scorde from xml config.
            string expectedSequence1, expectedSequence2, expectedScore;

            switch (alignType)
            {
                case AlignmentType.Align:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                    Constants.ExpectedGapExtensionScoreNode);

                    switch (caseType)
                    {
                        case SequenceCaseType.LowerCase:
                            expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants
                                                                                    .ExpectedGapExtensionSequence1InLower);
                            expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants
                                                                                    .ExpectedGapExtensionSequence2InLower);
                            break;
                        default:
                            expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants
                                                                                    .ExpectedGapExtensionSequence1Node);
                            expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants
                                                                                    .ExpectedGapExtensionSequence2Node);
                            break;
                    }
                    break;
                default:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                    Constants.ExpectedScoreNode);

                    switch (caseType)
                    {
                        case SequenceCaseType.LowerCase:
                            expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants.ExpectedSequence1inLowerNode);
                            expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants.ExpectedSequence2inLowerNode);
                            break;
                        case SequenceCaseType.LowerUpperCase:
                            expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants.ExpectedSequence1inLowerNode);
                            expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants.ExpectedSequenceNode2);
                            break;
                        default:
                            expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants.ExpectedSequenceNode1);
                            expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                Constants.ExpectedSequenceNode2);
                            break;
                    }

                    break;
            }

            // Match the alignment result with expected result.
            IList<IPairwiseSequenceAlignment> expectedOutput = new List<IPairwiseSequenceAlignment>();

            IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment();
            var alignedSeq = new PairwiseAlignedSequence
                                 {
                                     FirstSequence = new Sequence(alphabet, expectedSequence1),
                                     SecondSequence = new Sequence(alphabet, expectedSequence2),
                                     Score = Convert.ToInt32(expectedScore, null),
                                     FirstOffset = Int32.MinValue,
                                     SecondOffset = Int32.MinValue,
                                 };
            align.PairwiseAlignedSequences.Add(alignedSeq);
            expectedOutput.Add(align);

            ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner P2 : Final Score '{0}'.", expectedScore));
            ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner P2 : Aligned First Sequence is '{0}'.",
                                                   expectedSequence1));
            ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner P2 : Aligned Second Sequence is '{0}'.",
                                                   expectedSequence2));

            Assert.IsTrue(CompareAlignment(result, expectedOutput));
        }
示例#45
0
 public LinearLayout(OrientationType orientation, AlignmentType alignment)
 {
     Orientation = orientation;
     Alignment = alignment;
 }
示例#46
0
        public LinearLayout(
			OrientationType orientation,
			AlignmentType alignment,
			int xSpacing,
			int ySpacing)
        {
            XSpacing = xSpacing;
            YSpacing = ySpacing;
            Orientation = orientation;
            Alignment = alignment;
        }
示例#47
0
 public void setProjectile(Collider owner, AlignmentType ownerAlignment)
 {
     Physics.IgnoreCollision(owner, this.getCollider());
     alignment = ownerAlignment;
     gameObject.tag = Alignment.Alignment2String(alignment);
 }
示例#48
0
 public void setProjectile(Quaternion rotation, Collider owner,  AlignmentType ownerAlignment)
 {
     transform.rotation = rotation;
     setProjectile(owner, ownerAlignment);
 }
示例#49
0
 void setAlignment(AlignmentType newAlignment)
 {
     alignment = newAlignment;
     gameObject.tag = Alignment.Alignment2String(newAlignment);
 }
示例#50
0
        private void ValidateNeedlemanWunschAlignment(string nodeName, AlignParameters alignParam,
                                                      SimilarityMatrixParameters similarityMatrixParam,
                                                      AlignmentType alignType)
        {
            ISequence aInput, bInput;

            IAlphabet alphabet =
                Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode));

            // Parse the files and get the sequence.
            if (alignParam.ToString().Contains("Code"))
            {
                string sequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
                string sequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

                aInput = new Sequence(alphabet, sequence1);
                bInput = new Sequence(alphabet, sequence2);
            }
            else
            {
                // Read the xml file for getting both the files for aligning.
                string filePath1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode1);
                string filePath2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode2);
                var parseObjectForFile1 = new FastAParser { Alphabet = alphabet };
                ISequence originalSequence1 = parseObjectForFile1.Parse(filePath1).FirstOrDefault();
                Assert.IsNotNull(originalSequence1);
                aInput = new Sequence(alphabet, originalSequence1.ConvertToString());

                var parseObjectForFile2 = new FastAParser { Alphabet = alphabet };
                ISequence originalSequence2 = parseObjectForFile2.Parse(filePath2).FirstOrDefault();
                Assert.IsNotNull(originalSequence2);
                bInput = new Sequence(alphabet, originalSequence2.ConvertToString());
            }

            string blosumFilePath = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode);
            SimilarityMatrix sm;

            switch (similarityMatrixParam)
            {
                case SimilarityMatrixParameters.TextReader:
                    using (TextReader reader = new StreamReader(blosumFilePath))
                        sm = new SimilarityMatrix(reader);
                    break;
                case SimilarityMatrixParameters.DiagonalMatrix:
                    string matchValue = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.MatchScoreNode);
                    string misMatchValue = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                           Constants.MisMatchScoreNode);
                    sm = new DiagonalSimilarityMatrix(int.Parse(matchValue, null),
                                                      int.Parse(misMatchValue, null));
                    break;
                default:
                    sm = new SimilarityMatrix(new StreamReader(blosumFilePath));
                    break;
            }

            int gapOpenCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapOpenCostNode), null);
            int gapExtensionCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapExtensionCostNode),
                                             null);

            var needlemanWunschObj = new NeedlemanWunschAligner();
            if (AlignParameters.AllParam != alignParam)
            {
                needlemanWunschObj.SimilarityMatrix = sm;
                needlemanWunschObj.GapOpenCost = gapOpenCost;
            }

            IList<IPairwiseSequenceAlignment> result = null;

            switch (alignParam)
            {
                case AlignParameters.AlignList:
                case AlignParameters.AlignListCode:
                    var sequences = new List<ISequence> {aInput, bInput};
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            needlemanWunschObj.GapExtensionCost = gapExtensionCost;
                            result = needlemanWunschObj.Align(sequences);
                            break;
                        default:
                            result = needlemanWunschObj.AlignSimple(sequences);
                            break;
                    }
                    break;
                case AlignParameters.AllParam:
                case AlignParameters.AllParamCode:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            needlemanWunschObj.GapExtensionCost = gapExtensionCost;
                            result = needlemanWunschObj.Align(sm,
                                                              gapOpenCost, gapExtensionCost, aInput, bInput);
                            break;
                        default:
                            result = needlemanWunschObj.AlignSimple(sm, gapOpenCost, aInput, bInput);
                            break;
                    }
                    break;
                case AlignParameters.AlignTwo:
                case AlignParameters.AlignTwoCode:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            needlemanWunschObj.GapExtensionCost = gapExtensionCost;
                            result = needlemanWunschObj.Align(aInput, bInput);
                            break;
                        default:
                            result = needlemanWunschObj.AlignSimple(aInput, bInput);
                            break;
                    }
                    break;
                default:
                    break;
            }

            // Read the xml file for getting both the files for aligning.
            string expectedSequence1, expectedSequence2, expectedScore;

            switch (alignType)
            {
                case AlignmentType.Align:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedGapExtensionScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.ExpectedGapExtensionSequence1Node);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                        Constants.ExpectedGapExtensionSequence2Node);
                    break;
                default:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode1);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode2);
                    break;
            }

            IList<IPairwiseSequenceAlignment> expectedOutput = new List<IPairwiseSequenceAlignment>();

            IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment(aInput, bInput);
            var alignedSeq = new PairwiseAlignedSequence
                                 {
                                     FirstSequence = new Sequence(alphabet, expectedSequence1),
                                     SecondSequence = new Sequence(alphabet, expectedSequence2),
                                     Score = Convert.ToInt32(expectedScore, null)
                                 };
            align.PairwiseAlignedSequences.Add(alignedSeq);
            expectedOutput.Add(align);

            ApplicationLog.WriteLine(string.Format("NeedlemanWunschAligner P1 : Final Score '{0}'.", expectedScore));
            ApplicationLog.WriteLine(string.Format("NeedlemanWunschAligner P1 : Aligned First Sequence is '{0}'.", expectedSequence1));
            ApplicationLog.WriteLine(string.Format("NeedlemanWunschAligner P1 : Aligned Second Sequence is '{0}'.", expectedSequence2));

            Assert.IsTrue(CompareAlignment(result, expectedOutput));
        }
 private HorizontalAlignment GetAlignment(AlignmentType type)
 {
     switch (type)
     {
         case AlignmentType.Left:
             return HorizontalAlignment.LEFT;
         case AlignmentType.Center:
             return HorizontalAlignment.CENTER;
         case AlignmentType.Right:
             return HorizontalAlignment.RIGHT;
         default:
             throw new NotSupportedException();
     }
 }
示例#52
0
        /// <summary>
        /// Creates an 'Outer Table Row'. You can optionally specify a <see cref="columnSpan"/>.
        /// Everything else must be supplied.
        /// </summary>
        /// <param name="row">row</param>
        /// <param name="title">title</param>
        /// <param name="fullDescription">fullDescription</param>
        /// <param name="columnSpan">columnSpan</param>
        /// <param name="padding">padding</param>
        /// <param name="descriptionAlignment">descriptionAlignment</param>
        /// <param name="useSpacing">useSpacing</param>
        public void CreateOuterTableRowCells(
            Generator.Row row,
            string title,
            string fullDescription,
            int columnSpan = DefaultHeaderColumnSpan,
            Generator.MarginInfo padding = null,
            AlignmentType descriptionAlignment = AlignmentType.Left,
            bool useSpacing = false)
        {
            var labelCell = row.Cells.Add(title);
            var descriptionColor = new Generator.Color(Properties.Resources.GreyColor);
            labelCell.DefaultCellTextInfo.Color = descriptionColor;
            labelCell.DefaultCellTextInfo.FontSize = DefaultHeadingTwoFontSize;
            labelCell.DefaultCellTextInfo.IsTrueTypeFontBold = true;

            var descriptionCell = row.Cells.Add(fullDescription);
            descriptionCell.DefaultCellTextInfo.FontName = Properties.Resources.ArialFont;
            descriptionCell.DefaultCellTextInfo.FontSize = DefaultHeadingTwoFontSize;
            descriptionCell.DefaultCellTextInfo.Color = descriptionColor;
            descriptionCell.Alignment = descriptionAlignment;

            if (useSpacing)
            {
                labelCell.DefaultCellTextInfo.LineSpacing = DefaultLineSpacing;
                descriptionCell.DefaultCellTextInfo.LineSpacing = DefaultLineSpacing;
            }
            if (padding != null)
            {
                labelCell.Padding = padding;
                descriptionCell.Padding = padding;
            }
        }
        /// <summary>
        ///     Validates PairwiseOverlapAlignment algorithm for the parameters passed.
        /// </summary>
        /// <param name="nodeName">Node Name in the xml.</param>
        /// <param name="alignParam">parameter based on which certain validations are done.</param>
        /// <param name="similarityMatrixParam">Similarity Matrix Parameter.</param>
        /// <param name="alignType">Alignment Type</param>
        private void ValidatePairwiseOverlapAlignment(string nodeName, AlignParameters alignParam,
                                                      SimilarityMatrixParameters similarityMatrixParam,
                                                      AlignmentType alignType)
        {
            ISequence aInput;
            ISequence bInput;

            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode));

            if (alignParam.ToString().Contains("Code"))
            {
                string sequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
                string sequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

                aInput = new Sequence(alphabet, sequence1);
                bInput = new Sequence(alphabet, sequence2);
            }
            else
            {
                // Read the xml file for getting both the files for aligning.
                string filePath1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode1);
                string filePath2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode2);

                var parser1 = new FastAParser { Alphabet = alphabet };
                aInput = parser1.Parse(filePath1).ElementAt(0);
                bInput = parser1.Parse(filePath2).ElementAt(0);
            }

            string blosumFilePath = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode);
            SimilarityMatrix sm;

            switch (similarityMatrixParam)
            {
                case SimilarityMatrixParameters.TextReader:
                    using (TextReader reader = new StreamReader(blosumFilePath))
                        sm = new SimilarityMatrix(reader);
                    break;
                case SimilarityMatrixParameters.DiagonalMatrix:
                    string matchValue = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.MatchScoreNode);
                    string misMatchValue = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.MisMatchScoreNode);
                    sm = new DiagonalSimilarityMatrix(int.Parse(matchValue, null), int.Parse(misMatchValue, null));
                    break;
                default:
                    sm = new SimilarityMatrix(new StreamReader(blosumFilePath));
                    break;
            }

            int gapOpenCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapOpenCostNode), null);
            int gapExtensionCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapExtensionCostNode), null);

            var pairwiseOverlapObj = new PairwiseOverlapAligner();
            if (AlignParameters.AllParam != alignParam)
            {
                pairwiseOverlapObj.SimilarityMatrix = sm;
                pairwiseOverlapObj.GapOpenCost = gapOpenCost;
            }

            IList<IPairwiseSequenceAlignment> result = null;

            switch (alignParam)
            {
                case AlignParameters.AlignList:
                case AlignParameters.AlignListCode:
                    var sequences = new List<ISequence> {aInput, bInput};
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            pairwiseOverlapObj.GapExtensionCost = gapExtensionCost;
                            result = pairwiseOverlapObj.Align(sequences);
                            break;
                        default:
                            result = pairwiseOverlapObj.AlignSimple(sequences);
                            break;
                    }
                    break;
                case AlignParameters.AllParam:
                case AlignParameters.AllParamCode:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            pairwiseOverlapObj.GapExtensionCost = gapExtensionCost;
                            result = pairwiseOverlapObj.Align(sm, gapOpenCost, gapExtensionCost, aInput, bInput);
                            break;
                        default:
                            result = pairwiseOverlapObj.AlignSimple(sm, gapOpenCost, aInput, bInput);
                            break;
                    }
                    break;
                case AlignParameters.AlignTwo:
                case AlignParameters.AlignTwoCode:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            pairwiseOverlapObj.GapExtensionCost = gapExtensionCost;
                            result = pairwiseOverlapObj.Align(aInput, bInput);
                            break;
                        default:
                            result = pairwiseOverlapObj.AlignSimple(aInput, bInput);
                            break;
                    }
                    break;
                default:
                    break;
            }

            // Read the xml file for getting both the files for aligning.
            string expectedSequence1;
            string expectedSequence2;
            string expectedScore;

            switch (alignType)
            {
                case AlignmentType.Align:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedGapExtensionScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedGapExtensionSequence1Node);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedGapExtensionSequence2Node);
                    break;
                default:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode1);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode2);
                    break;
            }

            IList<IPairwiseSequenceAlignment> expectedOutput = new List<IPairwiseSequenceAlignment>();
            var seperators = new [] {';'};
            string[] expectedSequences1 = expectedSequence1.Split(seperators);
            string[] expectedSequences2 = expectedSequence2.Split(seperators);

            IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment();
            for (int i = 0; i < expectedSequences1.Length; i++)
            {
                PairwiseAlignedSequence alignedSeq = new PairwiseAlignedSequence
                {
                    FirstSequence = new Sequence(alphabet, expectedSequences1[i]),
                    SecondSequence = new Sequence(alphabet, expectedSequences2[i]),
                    Score = Convert.ToInt32(expectedScore, null),
                    FirstOffset = Int32.MinValue,
                    SecondOffset = Int32.MinValue,
                };
                align.PairwiseAlignedSequences.Add(alignedSeq);
            }
            expectedOutput.Add(align);

            Assert.IsTrue(AlignmentHelpers.CompareAlignment(result, expectedOutput, true));

            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P1 : Final Score '{0}'.", expectedScore));
            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P1 : Aligned First Sequence is '{0}'.", expectedSequence1));
            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P1 : Aligned Second Sequence is '{0}'.", expectedSequence2));
        }
示例#54
0
 /// <summary>
 /// Create an 'Inner Table', but ensure that it is not bound to <see cref="Section"/>.
 /// This is handy if you want to nest inner tables successively and allows the user
 /// to manipulate the table along with any other cell they wish to inject it in.
 /// </summary>
 /// <param name="columnWidths">columnWidths</param>
 /// <param name="fontName">fontName</param>
 /// <param name="fontSize">fontSize</param>
 /// <param name="borderSide">borderSide</param>
 /// <param name="alignment">alignment</param>
 /// <param name="padding">padding</param>
 /// <param name="keepContentTogether">keepContentTogether</param>
 /// <param name="isKeptWithNext">isKeptWithNext</param>
 public Generator.Table CreateSimpleInnerTable(
     string columnWidths, 
     string fontName = "", 
     float fontSize = 0,
     Generator.BorderSide borderSide = Generator.BorderSide.None, 
     AlignmentType alignment = AlignmentType.Left, 
     Generator.MarginInfo padding = null, 
     bool keepContentTogether = false, 
     bool isKeptWithNext = false)
 {
     var table = new Generator.Table
     {
         ColumnWidths = columnWidths,
         DefaultCellTextInfo =
         {
             FontSize = fontSize > 0
                 ? fontSize
                 : DefaultInnerBodyFontSize,
             FontName = !string.IsNullOrEmpty(fontName)
                 ? fontName
                 : Properties.Resources.ArialFont
         },
         Alignment = alignment,
         IsBroken = !keepContentTogether,
         IsFirstRowRepeated = true,
         IsKeptWithNext = isKeptWithNext
     };
     if (borderSide != Generator.BorderSide.None)
     {
         table.Border = new Generator.BorderInfo((int) borderSide, DefaultBorderSize);
     }
     if (padding != null)
     {
         table.DefaultCellPadding = padding;
     }
     return table;
 }
示例#55
0
 public void setAlignment(AlignmentType alignment)
 {
     gameObject.tag = Alignment.Alignment2String(alignment);
     this.alignment = alignment;
 }
示例#56
0
 /// <summary>
 /// Creates a 'TextArea' to be displayed. You can specify 
 /// <see cref="withRoundedCorners"/> to make the text area border rounded.
 /// </summary>
 /// <param name="row">row</param>
 /// <param name="textAreaText">textAreaText</param>
 /// <param name="textAreaPadding">textAreaPadding</param>
 /// <param name="verticalAlignment">verticalAlignment</param>
 /// <param name="alignment">alignment</param>
 /// <param name="withRoundedCorners">withRoundedCorners</param>
 /// <param name="withBorder">withBorder</param>
 public Generator.Cell CreateTextAreaCell(
     Generator.Row row,
     string textAreaText,
     Generator.MarginInfo textAreaPadding = null,
     VerticalAlignmentType verticalAlignment = VerticalAlignmentType.Top,
     AlignmentType alignment = AlignmentType.Left,
     bool withRoundedCorners = false,
     bool withBorder = false)
 {
     row.IsBroken = false;
     var cell = row.Cells.Add(textAreaText);
     // Text Area formatting
     cell.Padding = textAreaPadding ?? DefaultTextAreaDescriptionPadding;
     cell.DefaultCellTextInfo.FontName = Properties.Resources.ArialFont;
     cell.DefaultCellTextInfo.FontSize = DefaultInnerBodyFontSize;
     cell.DefaultCellTextInfo.Color = new Generator.Color(Properties.Resources.GreyColor);
     cell.VerticalAlignment = verticalAlignment;
     cell.Alignment = alignment;
     return cell;
 }
        /// <summary>
        ///     Validates PairwiseOverlapAlignment algorithm for the parameters passed.
        /// </summary>
        /// <param name="isTextFile">Is text file an input.</param>
        /// <param name="alignParam">parameter based on which certain validations are done.</param>
        /// <param name="alignType">Is the Align type Simple or Align with Gap Extension cost?</param>
        private void ValidatePairwiseOverlapAlignment(bool isTextFile, AlignmentParamType alignParam, AlignmentType alignType)
        {
            ISequence aInput;
            ISequence bInput;

            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.AlphabetNameNode));

            if (isTextFile)
            {
                // Read the xml file for getting both the files for aligning.
                string filePath1 = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.FilePathNode1);
                string filePath2 = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.FilePathNode2);

                //Parse the files and get the sequence.               
                var parser = new FastAParser { Alphabet = alphabet };
                aInput = parser.Parse(filePath1).ElementAt(0);
                bInput = parser.Parse(filePath2).ElementAt(0);
            }
            else
            {
                // Read the xml file for getting both the files for aligning.
                string origSequence1 = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.SequenceNode1);
                string origSequence2 = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.SequenceNode2);
                aInput = new Sequence(alphabet, origSequence1);
                bInput = new Sequence(alphabet, origSequence2);
            }

            var aInputString = aInput.ConvertToString();
            var bInputString = bInput.ConvertToString();

            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner BVT : First sequence used is '{0}'.", aInputString));
            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner BVT : Second sequence used is '{0}'.", bInputString));

            string blosumFilePath = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.BlosumFilePathNode);

            var sm = new SimilarityMatrix(new StreamReader(blosumFilePath));
            int gapOpenCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.GapOpenCostNode), null);
            int gapExtensionCost = int.Parse(this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.GapExtensionCostNode), null);

            var pairwiseOverlapObj = new PairwiseOverlapAligner();
            if (AlignmentParamType.AllParam != alignParam)
            {
                pairwiseOverlapObj.SimilarityMatrix = sm;
                pairwiseOverlapObj.GapOpenCost = gapOpenCost;
            }

            IList<IPairwiseSequenceAlignment> result = null;

            switch (alignParam)
            {
                case AlignmentParamType.AlignList:
                    var sequences = new List<ISequence> {aInput, bInput};
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = pairwiseOverlapObj.Align(sequences);
                            break;
                        default:
                            result = pairwiseOverlapObj.AlignSimple(sequences);
                            break;
                    }
                    break;
                case AlignmentParamType.AlignTwo:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = pairwiseOverlapObj.Align(aInput, bInput);
                            break;
                        default:
                            result = pairwiseOverlapObj.AlignSimple(aInput, bInput);
                            break;
                    }
                    break;
                case AlignmentParamType.AllParam:
                    switch (alignType)
                    {
                        case AlignmentType.Align:
                            result = pairwiseOverlapObj.Align(sm, gapOpenCost,
                                                              gapExtensionCost, aInput, bInput);
                            break;
                        default:
                            result = pairwiseOverlapObj.AlignSimple(sm, gapOpenCost, aInput, bInput);
                            break;
                    }
                    break;
                default:
                    break;
            }

            // Read the xml file for getting both the files for aligning.
            string expectedSequence1;
            string expectedSequence2;
            string expectedScore;

            switch (alignType)
            {
                case AlignmentType.Align:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.ExpectedGapExtensionScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.ExpectedGapExtensionSequence1Node);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.ExpectedGapExtensionSequence2Node);
                    break;
                default:
                    expectedScore = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.ExpectedScoreNode);
                    expectedSequence1 = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.ExpectedSequenceNode1);
                    expectedSequence2 = this.utilityObj.xmlUtil.GetTextValue(Constants.PairwiseOverlapAlignAlgorithmNodeName, Constants.ExpectedSequenceNode2);
                    break;
            }

            IList<IPairwiseSequenceAlignment> expectedOutput = new List<IPairwiseSequenceAlignment>();
            var seperators = new[] {';'};
            string[] expectedSequences1 = expectedSequence1.Split(seperators);
            string[] expectedSequences2 = expectedSequence2.Split(seperators);

            IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment();
            for (int i = 0; i < expectedSequences1.Length; i++)
            {
                PairwiseAlignedSequence alignedSeq = new PairwiseAlignedSequence
                {
                    FirstSequence = new Sequence(alphabet, expectedSequences1[i]),
                    SecondSequence = new Sequence(alphabet, expectedSequences2[i]),
                    Score = Convert.ToInt32(expectedScore, null)
                };
                align.PairwiseAlignedSequences.Add(alignedSeq);
            }

            expectedOutput.Add(align);
            Assert.IsTrue(AlignmentHelpers.CompareAlignment(result, expectedOutput));

            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner BVT : Final Score '{0}'.", expectedScore));
            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner BVT : Aligned First Sequence is '{0}'.", expectedSequence1));
            ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner BVT : Aligned Second Sequence is '{0}'.", expectedSequence2));
        }