/// <summary> /// This method would create combo field. /// </summary> /// <param name="alignmentAttribute">Alignment parameter</param> /// <param name="parentPanel">Stack panel, the field will be added to this stackpanel</param> /// <param name="tag">Tag of the control object</param> private void CreateComboField( AlignmentInfo alignmentAttribute, StackPanel parentPanel, string tag) { TextBlock block = new TextBlock(); block.Margin = new Thickness(0, 5, 0, 0); block.TextWrapping = TextWrapping.Wrap; block.Text = alignmentAttribute.Name; block.Height = 20; ComboBox combo = new ComboBox(); combo.HorizontalAlignment = HorizontalAlignment.Left; combo.IsSynchronizedWithCurrentItem = true; combo.Margin = new Thickness(0, 0, 0, 0); combo.Tag = tag; combo.Width = 180; combo.Height = 22; combo.ToolTip = alignmentAttribute.Description; StringListValidator validator = alignmentAttribute.Validator as StringListValidator; combo.ItemsSource = validator.ValidValues; combo.SelectedIndex = validator.ValidValues.ToList().IndexOf(alignmentAttribute.DefaultValue); if (alignmentAttribute.Name == "Similarity Matrix") { combo.SelectedIndex = validator.ValidValues.ToList().IndexOf(this.defaultSM); } parentPanel.Children.Add(block); parentPanel.Children.Add(combo); }
public void ValidatePairwiseAlignmentAttributes() { var pwAlignAttrib = new PairwiseAlignmentAttributes(); Dictionary<string, AlignmentInfo> attributes = pwAlignAttrib.Attributes; AlignmentInfo similarityMatrixObj = attributes["SIMILARITYMATRIX"]; AlignmentInfo gapOpenCostObj = attributes["GAPOPENCOST"]; AlignmentInfo gapExtensionCostObj = attributes["GAPEXTENSIONCOST"]; Assert.AreEqual("Similarity Matrix", similarityMatrixObj.Name); var validator = new StringListValidator( "Diagonal (Match x Mismatch)", SimilarityMatrix.StandardSimilarityMatrix.AmbiguousDna.ToString(), SimilarityMatrix.StandardSimilarityMatrix.AmbiguousRna.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum45.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum50.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum62.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum80.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum90.ToString(), SimilarityMatrix.StandardSimilarityMatrix.DiagonalScoreMatrix.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Pam250.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Pam30.ToString()); Assert.IsTrue(validator.IsValid(SimilarityMatrix.StandardSimilarityMatrix.AmbiguousDna.ToString())); validator.AddValidValues(SimilarityMatrix.StandardSimilarityMatrix.Pam70.ToString()); Assert.AreEqual("Diagonal (Match x Mismatch)", validator.ValidValues[0]); Assert.AreEqual("Gap Cost", gapOpenCostObj.Name); Assert.AreEqual("Gap Extension Cost", gapExtensionCostObj.Name); ApplicationLog.WriteLine( "PairwiseAlignmentAttributes BVT: Successfully validated all the attributes."); }
public void ValidatePairwiseAlignmentAttributes() { var pwAlignAttrib = new PairwiseAlignmentAttributes(); Dictionary <string, AlignmentInfo> attributes = pwAlignAttrib.Attributes; AlignmentInfo similarityMatrixObj = attributes["SIMILARITYMATRIX"]; AlignmentInfo gapOpenCostObj = attributes["GAPOPENCOST"]; AlignmentInfo gapExtensionCostObj = attributes["GAPEXTENSIONCOST"]; Assert.AreEqual("Similarity Matrix", similarityMatrixObj.Name); var validator = new StringListValidator( "Diagonal (Match x Mismatch)", SimilarityMatrix.StandardSimilarityMatrix.AmbiguousDna.ToString(), SimilarityMatrix.StandardSimilarityMatrix.AmbiguousRna.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum45.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum50.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum62.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum80.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Blosum90.ToString(), SimilarityMatrix.StandardSimilarityMatrix.DiagonalScoreMatrix.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Pam250.ToString(), SimilarityMatrix.StandardSimilarityMatrix.Pam30.ToString()); Assert.IsTrue(validator.IsValid(SimilarityMatrix.StandardSimilarityMatrix.AmbiguousDna.ToString())); validator.AddValidValues(SimilarityMatrix.StandardSimilarityMatrix.Pam70.ToString()); Assert.AreEqual("Diagonal (Match x Mismatch)", validator.ValidValues[0]); Assert.AreEqual("Gap Cost", gapOpenCostObj.Name); Assert.AreEqual("Gap Extension Cost", gapExtensionCostObj.Name); ApplicationLog.WriteLine( "PairwiseAlignmentAttributes BVT: Successfully validated all the attributes."); }
/// <summary> /// This method would create combo field. /// </summary> /// <param name="alignmentAttribute">Alignment parameter</param> /// <param name="parentPanel">Stack panel, the field will be added to this stackpanel</param> /// <param name="tag">Tag of the control object</param> private void CreateComboField( AlignmentInfo alignmentAttribute, StackPanel parentPanel, string tag) { TextBlock block = new TextBlock { Margin = new Thickness(0, 10, 0, 0), TextWrapping = TextWrapping.Wrap, Text = alignmentAttribute.Name, Height = 20 }; ComboBox combo = new ComboBox { HorizontalAlignment = HorizontalAlignment.Left, IsSynchronizedWithCurrentItem = true, Margin = new Thickness(0, 0, 0, 0), Tag = tag, Width = 180, Height = 22, ToolTip = alignmentAttribute.Description }; StringListValidator validator = alignmentAttribute.Validator as StringListValidator; combo.ItemsSource = validator.ValidValues; combo.SelectedIndex = validator.ValidValues.ToList().IndexOf(alignmentAttribute.DefaultValue); if (alignmentAttribute.Name == "Similarity Matrix") { combo.SelectedIndex = validator.ValidValues.ToList().IndexOf(GetDefaultSM(this.sequenceAlphabet)); } parentPanel.Children.Add(block); parentPanel.Children.Add(combo); }
/// <summary> /// Initializes a new instance of the PairwiseAlignmentAttributes class. /// </summary> public PairwiseAlignmentAttributes() { attributes = new Dictionary <string, AlignmentInfo>(); StringListValidator similarityMatrixList = new StringListValidator( Properties.Resource.SimilarityMatrix_AutoDetectString, // Autodetect Properties.Resource.SimilarityMatrix_DiagonalSM, SM.StandardSimilarityMatrix.AmbiguousDna.ToString(), SM.StandardSimilarityMatrix.AmbiguousRna.ToString(), SM.StandardSimilarityMatrix.Blosum45.ToString(), SM.StandardSimilarityMatrix.Blosum50.ToString(), SM.StandardSimilarityMatrix.Blosum62.ToString(), SM.StandardSimilarityMatrix.Blosum80.ToString(), SM.StandardSimilarityMatrix.Blosum90.ToString(), SM.StandardSimilarityMatrix.DiagonalScoreMatrix.ToString(), SM.StandardSimilarityMatrix.Pam250.ToString(), SM.StandardSimilarityMatrix.Pam30.ToString(), SM.StandardSimilarityMatrix.Pam70.ToString()); AlignmentInfo alignmentAttribute = new AlignmentInfo( Properties.Resource.SIMILARITY_MATRIX_NAME, Properties.Resource.SIMILARITY_MATRIX_DESCRIPTION, true, Properties.Resource.SimilarityMatrix_AutoDetectString, AlignmentInfo.StringListType, similarityMatrixList); attributes.Add(SimilarityMatrix, alignmentAttribute); alignmentAttribute = new AlignmentInfo( Properties.Resource.GAP_COST_NAME, Properties.Resource.GAP_COST_DESCRIPTION, true, "-8", AlignmentInfo.IntType, null); attributes.Add(GapOpenCost, alignmentAttribute); alignmentAttribute = new AlignmentInfo( Properties.Resource.GAP_EXTENSION_COST_NAME, Properties.Resource.GAP_EXTENSION_COST_DESCRIPTION, true, "-8", AlignmentInfo.IntType, null); attributes.Add(GapExtensionCost, alignmentAttribute); }
/// <summary> /// Initializes a new instance of the PairwiseAlignmentAttributes class. /// </summary> public PairwiseAlignmentAttributes() { attributes = new Dictionary<string, AlignmentInfo>(); StringListValidator similarityMatrixList = new StringListValidator( Properties.Resource.SimilarityMatrix_DiagonalSM, SM.StandardSimilarityMatrix.AmbiguousDna.ToString(), SM.StandardSimilarityMatrix.AmbiguousRna.ToString(), SM.StandardSimilarityMatrix.Blosum45.ToString(), SM.StandardSimilarityMatrix.Blosum50.ToString(), SM.StandardSimilarityMatrix.Blosum62.ToString(), SM.StandardSimilarityMatrix.Blosum80.ToString(), SM.StandardSimilarityMatrix.Blosum90.ToString(), SM.StandardSimilarityMatrix.DiagonalScoreMatrix.ToString(), SM.StandardSimilarityMatrix.Pam250.ToString(), SM.StandardSimilarityMatrix.Pam30.ToString(), SM.StandardSimilarityMatrix.Pam70.ToString()); AlignmentInfo alignmentAttribute = new AlignmentInfo( Properties.Resource.SIMILARITY_MATRIX_NAME, Properties.Resource.SIMILARITY_MATRIX_DESCRIPTION, true, SM.StandardSimilarityMatrix.AmbiguousDna.ToString(), AlignmentInfo.StringListType, similarityMatrixList); attributes.Add(SimilarityMatrix, alignmentAttribute); alignmentAttribute = new AlignmentInfo( Properties.Resource.GAP_COST_NAME, Properties.Resource.GAP_COST_DESCRIPTION, true, "-10", AlignmentInfo.IntType, null); attributes.Add(GapOpenCost, alignmentAttribute); alignmentAttribute = new AlignmentInfo( Properties.Resource.GAP_EXTENSION_COST_NAME, Properties.Resource.GAP_EXTENSION_COST_DESCRIPTION, true, "-8", AlignmentInfo.IntType, null); attributes.Add(GapExtensionCost, alignmentAttribute); }
/// <summary> /// This method would create combo field for the Blast parameter dialog, /// It will use the fieldname (which is the parameter name) /// and stackpanel to be added. /// </summary> /// <param name="fieldName">field name</param> /// <param name="parentPanel">Stack panel, the field will be added to this stackpanel</param> private static void CreateComboField(string fieldName, StackPanel parentPanel) { TextBlock block = new TextBlock(); block.Margin = new Thickness(0, 5, 5, 0); block.TextWrapping = TextWrapping.Wrap; block.Text = fieldName; parentPanel.Children.Add(block); ComboBox combo = new ComboBox(); combo.HorizontalAlignment = HorizontalAlignment.Left; combo.IsSynchronizedWithCurrentItem = true; combo.Margin = new Thickness(0, 5, 5, 0); combo.Tag = fieldName; combo.Width = 100; StringListValidator validator = BlastParameters.Parameters[fieldName].Validator as StringListValidator; combo.ItemsSource = validator.ValidValues; combo.SelectedIndex = validator.ValidValues.IndexOf(BlastParameters.Parameters[fieldName].DefaultValue); parentPanel.Children.Add(combo); }
/// <summary> /// Initializes a new instance of the PairwiseAlignmentAttributes class. /// </summary> public PamsamAlignmentAttributes() { AlignmentInfo alignmentAttribute; attributes = new Dictionary <string, AlignmentInfo>(); alignmentAttribute = new AlignmentInfo( KmerLength, "Kmer Length", true, "3", AlignmentInfo.IntType, null); attributes.Add(KmerLength, alignmentAttribute); StringListValidator listValidator = new StringListValidator( Enum.GetNames(typeof(DistanceFunctionTypes)) ); alignmentAttribute = new AlignmentInfo( DistanceFunctionType, "Distance Function Type", true, DistanceFunctionTypes.EuclideanDistance.ToString(), AlignmentInfo.StringListType, listValidator); attributes.Add(DistanceFunctionType, alignmentAttribute); listValidator = new StringListValidator( Enum.GetNames(typeof(UpdateDistanceMethodsTypes)) ); alignmentAttribute = new AlignmentInfo( UpdateDistanceMethodsType, "Update Distance Methods Type", true, UpdateDistanceMethodsTypes.Average.ToString(), AlignmentInfo.StringListType, listValidator); attributes.Add(UpdateDistanceMethodsType, alignmentAttribute); listValidator = new StringListValidator( Enum.GetNames(typeof(ProfileAlignerNames)) ); alignmentAttribute = new AlignmentInfo( ProfileAlignerName, "Profile Aligner Name", true, ProfileAlignerNames.NeedlemanWunschProfileAligner.ToString(), AlignmentInfo.StringListType, listValidator); attributes.Add(ProfileAlignerName, alignmentAttribute); listValidator = new StringListValidator( Enum.GetNames(typeof(ProfileScoreFunctionNames)) ); alignmentAttribute = new AlignmentInfo( ProfileScoreFunctionName, "Profile Score Function Name", true, ProfileScoreFunctionNames.WeightedInnerProduct.ToString(), AlignmentInfo.StringListType, listValidator); attributes.Add(ProfileScoreFunctionName, alignmentAttribute); listValidator = new StringListValidator( SM.StandardSimilarityMatrix.AmbiguousDna.ToString(), SM.StandardSimilarityMatrix.AmbiguousRna.ToString(), SM.StandardSimilarityMatrix.Blosum45.ToString(), SM.StandardSimilarityMatrix.Blosum50.ToString(), SM.StandardSimilarityMatrix.Blosum62.ToString(), SM.StandardSimilarityMatrix.Blosum80.ToString(), SM.StandardSimilarityMatrix.Blosum90.ToString(), SM.StandardSimilarityMatrix.Pam250.ToString(), SM.StandardSimilarityMatrix.Pam30.ToString(), SM.StandardSimilarityMatrix.Pam70.ToString() ); alignmentAttribute = new AlignmentInfo( SimilarityMatrix, "Similarity Matrix", true, SM.StandardSimilarityMatrix.AmbiguousDna.ToString(), AlignmentInfo.StringListType, listValidator); attributes.Add(SimilarityMatrix, alignmentAttribute); alignmentAttribute = new AlignmentInfo( GapOpenPenalty, "Gap Open Penalty", true, "-4", AlignmentInfo.IntType, null); attributes.Add(GapOpenPenalty, alignmentAttribute); alignmentAttribute = new AlignmentInfo( GapExtendPenalty, "Gap Extention Penalty", true, "-1", AlignmentInfo.IntType, null); attributes.Add(GapExtendPenalty, alignmentAttribute); alignmentAttribute = new AlignmentInfo( NumberOfPartitions, "Number Of Partitions", true, (Environment.ProcessorCount * 2).ToString(), AlignmentInfo.IntType, null); attributes.Add(NumberOfPartitions, alignmentAttribute); alignmentAttribute = new AlignmentInfo( DegreeOfParallelism, "Degree Of Parallelism", true, Environment.ProcessorCount.ToString(), AlignmentInfo.IntType, null); attributes.Add(DegreeOfParallelism, alignmentAttribute); }