Ejemplo n.º 1
0
        /// <summary>
        /// Populate input parameters for PaDeNA
        /// </summary>
        /// <param name="input">AssemblyInputEventArgs object to which the parameters should be populated</param>
        public void GetPaDeNAInput(AssemblyInputEventArgs input)
        {
            input.AssemblerUsed = AssemblerType.PaDeNA;

            input.KmerLength                   = this.kmerLength;
            input.DanglingLinksThreshold       = this.dangleThreshold;
            input.RedundantPathLengthThreshold = this.redundantThreshold;
            input.ErosionEnabled               = this.IsErosionEnabled;

            if (this.IsErosionEnabled)
            {
                input.ErosionThreshold = this.erosionThreshold;
            }

            input.LowCoverageContigRemovalEnabled = this.IsLowCoverageContigRemovalEnabled;
            if (this.IsLowCoverageContigRemovalEnabled)
            {
                input.LowCoverageContigRemovalThreshold = this.lowCoverageContigRemovalThreshold;
            }

            if (scaffoldGenerationParameters.IsChecked == true)
            {
                input.GenerateScaffolds  = true;
                input.ScaffoldRedundancy = this.scaffoldRedundancy;
                input.Depth = this.depth;
            }
            else
            {
                input.GenerateScaffolds = false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets called when submit button is clicked.
        /// </summary>
        /// <param name="sender">Submit button.</param>
        /// <param name="e">Event data.</param>
        private void OnSubmitButtonClicked(object sender, RoutedEventArgs e)
        {
            bool valid = this.ParseValues();

            // Validation required. Try to read the arguments and validate the input
            AssemblyInputEventArgs assemblerInput = new AssemblyInputEventArgs(null, null);

            if (valid && simpleSequenceAssemblerOptionButton.IsChecked == true)
            {
                assemblerInput.AlignerInput = new AlignerInputEventArgs();
                valid = GetAlignmentInput(stkAlingerParam, assemblerInput, null);
            }

            if (valid)
            {
                this.submit = true;
                this.Close();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Populate input parameters for PaDeNA
        /// </summary>
        /// <param name="input">AssemblyInputEventArgs object to which the parameters should be populated</param>
        public void GetPaDeNAInput(AssemblyInputEventArgs input)
        {
            input.AssemblerUsed = AssemblerType.PaDeNA;

            input.KmerLength                   = this.kmerLength;
            input.DanglingLinksThreshold       = this.dangleThreshold;
            input.RedundantPathLengthThreshold = this.redundantThreshold;

            if (scaffoldGenerationParameters.IsChecked == true)
            {
                input.ScaffoldRedundancy = this.scaffoldRedundancy;
                input.Depth = this.depth;
            }
            else
            {
                input.ScaffoldRedundancy = null;
                input.Depth = null;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get the aligner input paramater from the controls in stack panel
        /// </summary>
        /// <param name="stkPanel">Stack panel object</param>
        /// <param name="assemblyInput">aligner input object</param>
        /// <param name="alphabet"> Alphabet of the Selected sequences.</param>
        /// <returns>Are parameters valid</returns>
        public bool GetAlignmentInput(
            StackPanel stkPanel,
            AssemblyInputEventArgs assemblyInput, IAlphabet alphabet)
        {
            AlignerInputEventArgs alignerInput;
            TextBox textBox;
            int     intValue;
            float   floatValue;

            alignerInput = assemblyInput.AlignerInput;

            foreach (UIElement uiElement in stkPanel.Children)
            {
                if (uiElement is TextBox)
                {
                    textBox = uiElement as TextBox;

                    switch (textBox.Tag.ToString())
                    {
                    case PairwiseAlignmentAttributes.GapOpenCost:
                        if (int.TryParse(textBox.Text.Trim(), out intValue))
                        {
                            alignerInput.GapCost = intValue;
                        }
                        else
                        {
                            MessageDialogBox.Show(
                                Resource.INVALID_TEXT
                                + PairwiseAlignmentAttributes.GapOpenCost
                                + Resource.VALUE_TEXT,
                                Properties.Resource.CAPTION,
                                MessageDialogButton.OK);

                            return(false);
                        }

                        break;

                    case PairwiseAlignmentAttributes.GapExtensionCost:
                        if (int.TryParse(textBox.Text.Trim(), out intValue))
                        {
                            alignerInput.GapExtensionCost = intValue;
                        }
                        else
                        {
                            MessageDialogBox.Show(
                                Resource.INVALID_TEXT
                                + PairwiseAlignmentAttributes.GapExtensionCost
                                + Resource.VALUE_TEXT,
                                Properties.Resource.CAPTION,
                                MessageDialogButton.OK);

                            return(false);
                        }

                        break;

                    case MUMmerAttributes.LengthOfMUM:
                        if (int.TryParse(textBox.Text.Trim(), out intValue))
                        {
                            alignerInput.LengthOfMUM = intValue;
                        }
                        else
                        {
                            MessageDialogBox.Show(
                                Resource.INVALID_TEXT
                                + NUCmerAttributes.LengthOfMUM
                                + Resource.VALUE_TEXT,
                                Properties.Resource.CAPTION,
                                MessageDialogButton.OK);

                            return(false);
                        }

                        break;

                    case NUCmerAttributes.FixedSeparation:
                        if (int.TryParse(textBox.Text.Trim(), out intValue))
                        {
                            alignerInput.FixedSeparation = intValue;
                        }
                        else
                        {
                            MessageDialogBox.Show(
                                Resource.INVALID_TEXT
                                + NUCmerAttributes.FixedSeparation
                                + Resource.VALUE_TEXT,
                                Properties.Resource.CAPTION,
                                MessageDialogButton.OK);

                            return(false);
                        }

                        break;

                    case NUCmerAttributes.MaximumSeparation:
                        if (int.TryParse(textBox.Text.Trim(), out intValue))
                        {
                            alignerInput.MaximumSeparation = intValue;
                        }
                        else
                        {
                            MessageDialogBox.Show(
                                Resource.INVALID_TEXT
                                + NUCmerAttributes.MaximumSeparation
                                + Resource.VALUE_TEXT,
                                Properties.Resource.CAPTION,
                                MessageDialogButton.OK);

                            return(false);
                        }

                        break;

                    case NUCmerAttributes.MinimumScore:
                        if (int.TryParse(textBox.Text.Trim(), out intValue))
                        {
                            alignerInput.MinimumScore = intValue;
                        }
                        else
                        {
                            MessageDialogBox.Show(
                                Resource.INVALID_TEXT
                                + NUCmerAttributes.MinimumScore
                                + Resource.VALUE_TEXT,
                                Properties.Resource.CAPTION,
                                MessageDialogButton.OK);

                            return(false);
                        }

                        break;

                    case NUCmerAttributes.SeparationFactor:
                        if (float.TryParse(textBox.Text.Trim(), out floatValue))
                        {
                            alignerInput.SeparationFactor = floatValue;
                        }
                        else
                        {
                            MessageDialogBox.Show(
                                Resource.INVALID_TEXT
                                + NUCmerAttributes.SeparationFactor
                                + Resource.VALUE_TEXT,
                                Properties.Resource.CAPTION,
                                MessageDialogButton.OK);

                            return(false);
                        }

                        break;

                    case NUCmerAttributes.BreakLength:
                        if (int.TryParse(textBox.Text.Trim(), out intValue))
                        {
                            alignerInput.BreakLength = intValue;
                        }
                        else
                        {
                            MessageDialogBox.Show(
                                Resource.INVALID_TEXT
                                + NUCmerAttributes.BreakLength
                                + Resource.VALUE_TEXT,
                                Properties.Resource.CAPTION,
                                MessageDialogButton.OK);

                            return(false);
                        }

                        break;

                    default:
                        break;
                    }
                }
                else if (uiElement is ComboBox)
                {
                    ComboBox comboBox = uiElement as ComboBox;

                    switch (comboBox.Tag.ToString())
                    {
                    case PairwiseAlignmentAttributes.SimilarityMatrix:
                        if (comboBox.SelectedValue != null && comboBox.SelectedIndex == 0)     // DSM
                        {
                            int matchScore     = 0;
                            int missmatchScore = 0;

                            int.TryParse(txtMatchScore.Text, out matchScore);
                            int.TryParse(txtMisMatchScore.Text, out missmatchScore);

                            alignerInput.SimilarityMatrix = new DiagonalSimilarityMatrix(matchScore, missmatchScore);
                        }

                        if (null != comboBox.SelectedValue && comboBox.SelectedIndex > 0)
                        {
                            string similarityMatrixOption = comboBox.SelectedValue.ToString();

                            if (Enum.IsDefined(
                                    typeof(SimilarityMatrix.StandardSimilarityMatrix),
                                    similarityMatrixOption))
                            {
                                SimilarityMatrix.StandardSimilarityMatrix matrix =
                                    (SimilarityMatrix.StandardSimilarityMatrix)Enum.Parse(
                                        typeof(SimilarityMatrix.StandardSimilarityMatrix),
                                        similarityMatrixOption,
                                        true);
                                alignerInput.SimilarityMatrix = new SimilarityMatrix(matrix);
                            }
                            else
                            {
                                MessageDialogBox.Show(
                                    Resource.INVALID_TEXT
                                    + PairwiseAlignmentAttributes.SimilarityMatrix
                                    + Resource.VALUE_TEXT,
                                    Properties.Resource.CAPTION,
                                    MessageDialogButton.OK);

                                return(false);
                            }
                        }

                        break;

                    default:
                        break;
                    }
                }
            }

            return(true);
        }