Пример #1
0
        public void TestSequenceAlignmentToString()
        {
            ISequenceAligner aligner       = SequenceAligners.NeedlemanWunsch;
            IAlphabet        alphabet      = Alphabets.Protein;
            const string     origSequence1 = "KRIPKSQNLRSIHSIFPFLEDKLSHLN";
            const string     origSequence2 = "LNIPSLITLNKSIYVFSKRKKRLSGFLHN";

            // Create input sequences
            var inputSequences = new List <ISequence>
            {
                new Sequence(alphabet, origSequence1),
                new Sequence(alphabet, origSequence2)
            };

            // Get aligned sequences
            IList <ISequenceAlignment> alignments = aligner.Align(inputSequences);
            ISequenceAlignment         alignment  = new SequenceAlignment();

            foreach (var alignedSequence in alignments[0].AlignedSequences)
            {
                alignment.AlignedSequences.Add(alignedSequence);
            }

            const string expected = "XXIPXXXXLXXXXXXFXXXXXXLSXXLHN\r\n" +
                                    "KRIPKSQNLRSIHSIFPFLEDKLSHL--N\r\n" +
                                    "LNIPSLITLNKSIYVFSKRKKRLSGFLHN\r\n\r\n";

            Assert.AreEqual(expected.Replace("\r\n", Environment.NewLine), alignment.ToString());
        }
Пример #2
0
        /// <summary>
        ///     Validate aligned sequence instance using different aligners
        /// </summary>
        /// <param name="nodeName">xml node name</param>
        /// <param name="aligner">sw/nw/pw aligners</param>
        private void ValidateAlignedSequence(string nodeName, ISequenceAligner aligner)
        {
            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                          Constants.AlphabetNameNode));
            string origSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
            string origSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

            // Create input sequences
            var inputSequences = new List <ISequence>();

            inputSequences.Add(new Sequence(alphabet, origSequence1));
            inputSequences.Add(new Sequence(alphabet, origSequence2));

            // Get aligned sequences
            IList <ISequenceAlignment> alignment = aligner.Align(inputSequences);

            // Create AlignedSequence instance
            IAlignedSequence sequence = alignment[0].AlignedSequences[0];

            // Validate the alignedsequence properties
            Assert.AreEqual(alignment[0].AlignedSequences[0].Sequences, sequence.Sequences);
            Assert.AreEqual(alignment[0].AlignedSequences[0].Metadata, sequence.Metadata);

            ApplicationLog.WriteLine(@"Alignment BVT : Validation of aligned sequence completed successfully");
        }
Пример #3
0
        public void TestSequenceAlignmentToString()
        {
            ISequenceAligner aligner       = SequenceAligners.NeedlemanWunsch;
            IAlphabet        alphabet      = Alphabets.Protein;
            string           origSequence1 = "KRIPKSQNLRSIHSIFPFLEDKLSHLN";
            string           origSequence2 = "LNIPSLITLNKSIYVFSKRKKRLSGFLHN";

            // Create input sequences
            List <ISequence> inputSequences = new List <ISequence>();

            inputSequences.Add(new Sequence(alphabet, origSequence1));
            inputSequences.Add(new Sequence(alphabet, origSequence2));

            // Get aligned sequences
            IList <ISequenceAlignment> alignments = aligner.Align(inputSequences);
            ISequenceAlignment         alignment  = new SequenceAlignment();

            for (int ialigned = 0; ialigned < alignments[0].AlignedSequences.Count; ialigned++)
            {
                alignment.AlignedSequences.Add(alignments[0].AlignedSequences[ialigned]);
            }

            foreach (string key in alignments[0].Metadata.Keys)
            {
                alignment.Metadata.Add(key, alignments[0].Metadata[key]);
            }

            string actualSequenceAlignmentString   = alignment.ToString();
            string ExpectedSequenceAlignmentString = "XXIPXXXXLXXXXXXFXXXXXXLSGFXXN\r\nKRIPKSQNLRSIHSIFPFLEDKLS--HLN\r\nLNIPSLITLNKSIYVFSKRKKRLSGFLHN\r\n\r\n";

            Assert.AreEqual(ExpectedSequenceAlignmentString, actualSequenceAlignmentString);
        }
Пример #4
0
        /// <summary>
        /// Gets the list of alignment argument based on the algorithm selected
        /// </summary>
        /// <param name="algoName">Name of the algorithm used</param>
        /// <returns>Alignment arguments</returns>
        private IAlignmentAttributes GetAlignmentAttribute(string algoName)
        {
            IAlignmentAttributes alignmentAttributes = null;

            ISequenceAligner sequenceAligner = ChooseAlgorithm(algoName);

            this.Aligner = sequenceAligner;

            if (sequenceAligner is NUCmer3)
            {
                alignmentAttributes = new NUCmerAttributes();
            }
            else if (sequenceAligner is MUMmer3)
            {
                alignmentAttributes = new MUMmerAttributes();
            }
            else if ((sequenceAligner is SmithWatermanAligner) ||
                     (sequenceAligner is NeedlemanWunschAligner) ||
                     (sequenceAligner is PairwiseOverlapAligner))
            {
                alignmentAttributes = new PairwiseAlignmentAttributes();
            }

            return(alignmentAttributes);
        }
Пример #5
0
        /// <summary>
        /// Gets the list of alignment argument based on the algorithm selected
        /// </summary>
        /// <returns>Alignment arguments</returns>
        private IAlignmentAttributes GetAlignmentAttribute(string algo)
        {
            IAlignmentAttributes alignmentAttributes = null;

            ISequenceAligner sequenceAligner = ChooseAlgorithm(algo);

            if (sequenceAligner is NucmerPairwiseAligner)
            {
                alignmentAttributes = new NUCmerAttributes();
            }
            else if (sequenceAligner is MUMmerAligner)
            {
                alignmentAttributes = new MUMmerAttributes();
            }
            else if ((sequenceAligner is SmithWatermanAligner) ||
                     (sequenceAligner is NeedlemanWunschAligner) ||
                     (sequenceAligner is PairwiseOverlapAligner))
            {
                alignmentAttributes = new PairwiseAlignmentAttributes();
            }
            else if (sequenceAligner is PAMSAMMultipleSequenceAligner)
            {
                alignmentAttributes = new PamsamAlignmentAttributes();
            }

            return(alignmentAttributes);
        }
Пример #6
0
        public void ValidateSequenceAlignmentToString()
        {
            ISequenceAligner aligner       = SequenceAligners.NeedlemanWunsch;
            IAlphabet        alphabet      = Alphabets.Protein;
            string           origSequence1 = "KRIPKSQNLRSIHSIFPFLEDKLSHLN";
            string           origSequence2 = "LNIPSLITLNKSIYVFSKRKKRLSGFLHN";

            // Create input sequences
            var inputSequences = new List <ISequence>();

            inputSequences.Add(new Sequence(alphabet, origSequence1));
            inputSequences.Add(new Sequence(alphabet, origSequence2));

            // Get aligned sequences
            IList <ISequenceAlignment> alignments = aligner.Align(inputSequences);
            ISequenceAlignment         alignment  = new SequenceAlignment();

            for (int ialigned = 0; ialigned < alignments[0].AlignedSequences.Count; ialigned++)
            {
                alignment.AlignedSequences.Add(alignments[0].AlignedSequences[ialigned]);
            }

            foreach (string key in alignments[0].Metadata.Keys)
            {
                alignment.Metadata.Add(key, alignments[0].Metadata[key]);
            }

            string actualSequenceAlignmentString   = alignment.ToString();
            string ExpectedSequenceAlignmentString = this.utilityObj.xmlUtil.GetTextValue(Constants.ToStringNodeName,
                                                                                          Constants
                                                                                          .SequenceAlignmentExpectedNode);

            Assert.AreEqual(ExpectedSequenceAlignmentString.Replace("\\r\\n", ""),
                            actualSequenceAlignmentString.Replace(System.Environment.NewLine, ""));
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the AssemblyInputDialog class.
        /// </summary>
        /// <param name="IsAlignment">Flags if the operation is alignment or assembly</param>
        /// <param name="sequenceAlphabet">Alphabet of the selected sequences</param>
        public AssemblyInputDialog(bool IsAlignment, IAlphabet sequenceAlphabet, ISequenceAligner selectedAligner = null)
        {
            this.isAlignment = IsAlignment;
            this.sequenceAlphabet = sequenceAlphabet;
            InitializeComponent();

            if (isAlignment)
            {
                thresholdsPanel.Visibility = Visibility.Hidden;
                alignerPanel.Visibility = Visibility.Collapsed;
                headingBlock.Text = Resources["AssemblyInputDialog_AlignInputParameters"].ToString();
            }

            // Add aligners to the drop down
            foreach (ISequenceAligner aligner in SequenceAligners.All.OrderBy(sa => sa.Name))
            {
                if (!IsAlignment)
                {
                    // If assembly, load only pairwise aligners
                    if (!(aligner is IPairwiseSequenceAligner))
                    {
                        continue;
                    }
                }

                alignerDropDown.Items.Add(aligner.Name);
            }

            // Select Smith-Waterman by default.
            if (selectedAligner == null)
            {
                selectedAligner =
                    SequenceAligners.All.FirstOrDefault(
                        sa => string.Compare(sa.Name, "Smith-Waterman", StringComparison.OrdinalIgnoreCase) == 0);
            }

            // Ensure aligner is in our list.
            if (selectedAligner != null && alignerDropDown.Items.Contains(selectedAligner.Name))
            {
                alignerDropDown.Text = selectedAligner.Name;
            }
            // If not, select the first algorithm present.
            else
            {
                alignerDropDown.SelectedIndex = 0;
            }

            // Load our parameters.
            LoadAlignmentArguments(alignerDropDown.Text);

            this.btnSubmit.Click += this.OnSubmitButtonClicked;
            this.btnCancel.Click += this.OnCancelClicked;
            this.alignerDropDown.SelectionChanged += this.OnAlignerChanged;
            this.btnSubmit.Focus();
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the AssemblyInputDialog class.
        /// </summary>
        /// <param name="IsAlignment">Flags if the operation is alignment or assembly</param>
        /// <param name="sequenceAlphabet">Alphabet of the selected sequences</param>
        public AssemblyInputDialog(bool IsAlignment, IAlphabet sequenceAlphabet, ISequenceAligner selectedAligner = null)
        {
            this.isAlignment      = IsAlignment;
            this.sequenceAlphabet = sequenceAlphabet;
            InitializeComponent();

            if (isAlignment)
            {
                thresholdsPanel.Visibility = Visibility.Hidden;
                alignerPanel.Visibility    = Visibility.Collapsed;
                headingBlock.Text          = Resources["AssemblyInputDialog_AlignInputParameters"].ToString();
            }

            // Add aligners to the drop down
            foreach (ISequenceAligner aligner in SequenceAligners.All.OrderBy(sa => sa.Name))
            {
                if (!IsAlignment)
                {
                    // If assembly, load only pairwise aligners
                    if (!(aligner is IPairwiseSequenceAligner))
                    {
                        continue;
                    }
                }

                alignerDropDown.Items.Add(aligner.Name);
            }

            // Select Smith-Waterman by default.
            if (selectedAligner == null)
            {
                selectedAligner =
                    SequenceAligners.All.FirstOrDefault(
                        sa => string.Compare(sa.Name, "Smith-Waterman", StringComparison.OrdinalIgnoreCase) == 0);
            }

            // Ensure aligner is in our list.
            if (selectedAligner != null && alignerDropDown.Items.Contains(selectedAligner.Name))
            {
                alignerDropDown.Text = selectedAligner.Name;
            }
            // If not, select the first algorithm present.
            else
            {
                alignerDropDown.SelectedIndex = 0;
            }

            // Load our parameters.
            LoadAlignmentArguments(alignerDropDown.Text);

            this.btnSubmit.Click += new RoutedEventHandler(this.OnSubmitButtonClicked);
            this.btnCancel.Click += new RoutedEventHandler(this.OnCancelClicked);
            this.alignerDropDown.SelectionChanged += new SelectionChangedEventHandler(OnAlignerChanged);
            this.btnSubmit.Focus();
        }
Пример #9
0
        /// <summary>
        /// This method when passed the algorithm name instantiates
        /// the framework class which implements.
        /// </summary>
        /// <param name="algorithmName">Nmae of the algorithm.</param>
        /// <returns>Class which instantiates the algorithm.</returns>
        private static ISequenceAligner ChooseAlgorithm(string algorithmName)
        {
            foreach (ISequenceAligner aligner in SequenceAligners.All)
            {
                if (aligner.Name.Equals(algorithmName))
                {
                    ISequenceAligner pairWise = aligner as ISequenceAligner;
                    if (pairWise != null)
                    {
                        return(pairWise);
                    }
                }
            }

            return(null);
        }
Пример #10
0
        /// <summary>
        ///     Validate aligned sequence instance using different aligners
        /// </summary>
        /// <param name="nodeName">xml node name</param>
        /// <param name="aligner">sw/nw/pw aligners</param>
        private void ValidateAlignedSequenceCtor(string nodeName, ISequenceAligner aligner)
        {
            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                          Constants.AlphabetNameNode));
            string origSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
            string origSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

            // Create input sequences
            var inputSequences = new List <ISequence>();

            inputSequences.Add(new Sequence(alphabet, origSequence1));
            inputSequences.Add(new Sequence(alphabet, origSequence2));

            // Get aligned sequences
            IAlignedSequence           alignedSequence = new AlignedSequence();
            IList <ISequenceAlignment> alignment       = aligner.Align(inputSequences);

            // add aligned sequence and metadata information
            for (int iseq = 0; iseq < alignment[0].AlignedSequences[0].Sequences.Count; iseq++)
            {
                alignedSequence.Sequences.Add(alignment[0].AlignedSequences[0].Sequences[iseq]);
            }

            foreach (string key in alignment[0].AlignedSequences[0].Metadata.Keys)
            {
                alignedSequence.Metadata.Add(key, alignment[0].AlignedSequences[0].Metadata[key]);
            }

            // Validate the alignedsequence properties
            for (int index = 0; index < alignment[0].AlignedSequences[0].Sequences.Count; index++)
            {
                Assert.AreEqual(alignment[0].AlignedSequences[0].Sequences[index].ToString(),
                                alignedSequence.Sequences[index].ToString());
            }

            foreach (string key in alignment[0].AlignedSequences[0].Metadata.Keys)
            {
                Assert.AreEqual(alignment[0].AlignedSequences[0].Metadata[key],
                                alignedSequence.Metadata[key]);
            }

            ApplicationLog.WriteLine(@"Alignment BVT : Validation of aligned sequence ctor completed successfully");
        }
Пример #11
0
        /// <summary>
        ///     Validate sequence alignment instance using different aligners
        /// </summary>
        /// <param name="nodeName">xml node name</param>
        /// <param name="aligner">sw/nw/pw aligners</param>
        private void ValidateSequenceAlignmentCtor(string nodeName, ISequenceAligner aligner)
        {
            IAlphabet alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                     Constants.AlphabetNameNode));
            string origSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
            string origSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

            // Create input sequences
            var inputSequences = new List <ISequence>();

            inputSequences.Add(new Sequence(alphabet, origSequence1));
            inputSequences.Add(new Sequence(alphabet, origSequence2));

            // Get aligned sequences
            IList <ISequenceAlignment> alignments = aligner.Align(inputSequences);
            ISequenceAlignment         alignment  = new SequenceAlignment();

            for (int ialigned = 0; ialigned < alignments[0].AlignedSequences.Count; ialigned++)
            {
                alignment.AlignedSequences.Add(alignments[0].AlignedSequences[ialigned]);
            }

            foreach (string key in alignments[0].Metadata.Keys)
            {
                alignment.Metadata.Add(key, alignments[0].Metadata[key]);
            }

            // Validate the properties
            for (int ialigned = 0; ialigned < alignments[0].AlignedSequences.Count; ialigned++)
            {
                Assert.AreEqual(alignments[0].AlignedSequences[ialigned].Sequences[0].ToString(),
                                alignment.AlignedSequences[ialigned].Sequences[0].ToString());
            }

            foreach (string key in alignments[0].Metadata.Keys)
            {
                Assert.AreEqual(alignments[0].Metadata[key], alignment.Metadata[key]);
            }

            ApplicationLog.WriteLine(@"Alignment BVT : Validation of sequence alignment  ctor completed successfully");
        }
Пример #12
0
        /// <summary>
        /// Initializes a new instance of the AssemblyInputDialog class.
        /// </summary>
        /// <param name="IsAlignment">Flags if the operation is alignment or assembly</param>
        /// <param name="sequenceAlphabet">Alphabet of the selected sequences</param>
        public AssemblyInputDialog(bool IsAlignment, IAlphabet sequenceAlphabet, ISequenceAligner selectedAligner = null)
        {
            this.isAlignment      = IsAlignment;
            this.sequenceAlphabet = sequenceAlphabet;
            InitializeComponent();

            if (isAlignment)
            {
                thresholdsPanel.Visibility = Visibility.Hidden;
                alignerPanel.Visibility    = Visibility.Collapsed;
                headingBlock.Text          = Resources["AssemblyInputDialog_AlignInputParameters"].ToString();
            }

            // Add aligners to the drop down
            foreach (ISequenceAligner aligner in SequenceAligners.All)
            {
                if (!IsAlignment)
                {
                    // If assembly, load only pairwise aligners
                    if (!(aligner is IPairwiseSequenceAligner))
                    {
                        continue;
                    }
                }

                alignerDropDown.Items.Add(aligner.Name);
            }
            this.alignerDropDown.SelectedIndex = 0;
            if (selectedAligner != null)
            {
                alignerDropDown.Text = selectedAligner.Name;
            }
            LoadAlignmentArguments(alignerDropDown.Text);

            this.btnSubmit.Click += new RoutedEventHandler(this.OnSubmitButtonClicked);
            this.btnCancel.Click += new RoutedEventHandler(this.OnCancelClicked);
            this.alignerDropDown.SelectionChanged += new SelectionChangedEventHandler(OnAlignerChanged);
            this.btnSubmit.Focus();
        }
Пример #13
0
        /// <summary>
        /// Gets all registered aligners in core folder and addins (optional) folders
        /// </summary>
        /// <returns>List of registered aligners</returns>
        private static IEnumerable <ISequenceAligner> GetAligners()
        {
            var implementations    = BioRegistrationService.LocateRegisteredParts <ISequenceAligner>();
            var registeredAligners = new List <ISequenceAligner>();

            foreach (var impl in implementations)
            {
                try
                {
                    ISequenceAligner aligner = Activator.CreateInstance(impl) as ISequenceAligner;
                    if (aligner != null)
                    {
                        registeredAligners.Add(aligner);
                    }
                }
                catch
                {
                    // Cannot create - no default ctor?
                }
            }

            return(registeredAligners);
        }
Пример #14
0
        /// <summary>
        ///     Validate sequence alignment instance using different aligners
        /// </summary>
        /// <param name="nodeName">xml node name</param>
        /// <param name="aligner">sw/nw/pw aligners</param>
        private void ValidateSequenceAlignment(string nodeName, ISequenceAligner aligner)
        {
            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                          Constants.AlphabetNameNode));
            string origSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
            string origSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

            // Create input sequences
            var inputSequences = new List <ISequence>();

            inputSequences.Add(new Sequence(alphabet, origSequence1));
            inputSequences.Add(new Sequence(alphabet, origSequence2));

            // Get aligned sequences
            IList <ISequenceAlignment> alignments = aligner.Align(inputSequences);
            ISequenceAlignment         alignment  = alignments[0];

            Assert.AreEqual(alignments[0].AlignedSequences.Count, alignment.AlignedSequences.Count);
            Assert.AreEqual(alignments[0].Metadata, alignment.Metadata);
            Assert.AreEqual(inputSequences[0].ToString(), alignment.Sequences[0].ToString());

            ApplicationLog.WriteLine(@"Alignment BVT : Validation of sequence alignment completed successfully");
        }
Пример #15
0
        /// <summary>
        ///     Validate aligned sequence instance using different aligners
        /// </summary>
        /// <param name="nodeName">xml node name</param>
        /// <param name="aligner">sw/nw/pw aligners</param>
        private void ValidateAlignedSequence(string nodeName, ISequenceAligner aligner)
        {
            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                     Constants.AlphabetNameNode));
            string origSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
            string origSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

            // Create input sequences
            var inputSequences = new List<ISequence>();
            inputSequences.Add(new Sequence(alphabet, origSequence1));
            inputSequences.Add(new Sequence(alphabet, origSequence2));

            // Get aligned sequences
            IList<ISequenceAlignment> alignment = aligner.Align(inputSequences);

            // Create AlignedSequence instance
            IAlignedSequence sequence = alignment[0].AlignedSequences[0];

            // Validate the alignedsequence properties
            Assert.AreEqual(alignment[0].AlignedSequences[0].Sequences, sequence.Sequences);
            Assert.AreEqual(alignment[0].AlignedSequences[0].Metadata, sequence.Metadata);

            ApplicationLog.WriteLine(@"Alignment BVT : Validation of aligned sequence completed successfully");
        }
Пример #16
0
        /// <summary>
        ///     Validate sequence alignment instance using different aligners
        /// </summary>
        /// <param name="nodeName">xml node name</param>
        /// <param name="aligner">sw/nw/pw aligners</param>
        private void ValidateSequenceAlignmentCtor(string nodeName, ISequenceAligner aligner)
        {
            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                     Constants.AlphabetNameNode));
            string origSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
            string origSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

            // Create input sequences
            var inputSequences = new List<ISequence>();
            inputSequences.Add(new Sequence(alphabet, origSequence1));
            inputSequences.Add(new Sequence(alphabet, origSequence2));

            // Get aligned sequences
            IList<ISequenceAlignment> alignments = aligner.Align(inputSequences);
            ISequenceAlignment alignment = new SequenceAlignment();
            for (int ialigned = 0; ialigned < alignments[0].AlignedSequences.Count; ialigned++)
            {
                alignment.AlignedSequences.Add(alignments[0].AlignedSequences[ialigned]);
            }

            foreach (string key in alignments[0].Metadata.Keys)
            {
                alignment.Metadata.Add(key, alignments[0].Metadata[key]);
            }

            // Validate the properties
            for (int ialigned = 0; ialigned < alignments[0].AlignedSequences.Count; ialigned++)
            {
                Assert.AreEqual(alignments[0].AlignedSequences[ialigned].Sequences[0].ToString(),
                                alignment.AlignedSequences[ialigned].Sequences[0].ToString());
            }

            foreach (string key in alignments[0].Metadata.Keys)
            {
                Assert.AreEqual(alignments[0].Metadata[key], alignment.Metadata[key]);
            }

            ApplicationLog.WriteLine(@"Alignment BVT : Validation of sequence alignment  ctor completed successfully");
        }
Пример #17
0
        /// <summary>
        /// Assign the aligner specific parameters
        /// </summary>
        /// <param name="sequenceAligner">Sequence Aligner object</param>
        /// <param name="alignerInput">Aligner Input object</param>
        private static void AssignAlignerParameter(ISequenceAligner sequenceAligner, AlignerInputEventArgs alignerInput)
        {
            if (sequenceAligner is NucmerPairwiseAligner)
            {
                var nucmer = sequenceAligner as NucmerPairwiseAligner;

                nucmer.LengthOfMUM = alignerInput.LengthOfMUM;
                nucmer.FixedSeparation = alignerInput.FixedSeparation;
                nucmer.MaximumSeparation = alignerInput.MaximumSeparation;
                nucmer.MinimumScore = alignerInput.MinimumScore;
                nucmer.SeparationFactor = alignerInput.SeparationFactor;
                nucmer.BreakLength = alignerInput.BreakLength;
            }
            else if (sequenceAligner is MUMmerAligner)
            {
                var mummer = sequenceAligner as MUMmerAligner;

                mummer.LengthOfMUM = alignerInput.LengthOfMUM;
            }
        }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the AssemblyInputEventArgs class.
 /// </summary>
 /// <param name="sequences">The list of sequences which has to be assembled.</param>
 /// <param name="selectedAligner">Aligner selected</param>
 public AssemblyInputEventArgs(List <ISequence> sequences, ISequenceAligner selectedAligner)
 {
     this.sequences = sequences;
     this.Aligner   = selectedAligner;
 }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the AssemblyInputEventArgs class.
 /// </summary>
 /// <param name="sequences">The list of sequences which has to be assembled.</param>
 /// <param name="selectedAligner">Aligner selected</param>
 public AssemblyInputEventArgs(List<ISequence> sequences, ISequenceAligner selectedAligner)
 {
     this.sequences = sequences;
     this.Aligner = selectedAligner;
 }
Пример #20
0
        /// <summary>
        ///     Validate sequence alignment instance using different aligners
        /// </summary>
        /// <param name="nodeName">xml node name</param>
        /// <param name="aligner">sw/nw/pw aligners</param>
        private void ValidateSequenceAlignment(string nodeName, ISequenceAligner aligner)
        {
            IAlphabet alphabet = Utility.GetAlphabet(this.utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                     Constants.AlphabetNameNode));
            string origSequence1 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1);
            string origSequence2 = this.utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2);

            // Create input sequences
            var inputSequences = new List<ISequence>();
            inputSequences.Add(new Sequence(alphabet, origSequence1));
            inputSequences.Add(new Sequence(alphabet, origSequence2));

            // Get aligned sequences
            IList<ISequenceAlignment> alignments = aligner.Align(inputSequences);
            ISequenceAlignment alignment = alignments[0];

            Assert.AreEqual(alignments[0].AlignedSequences.Count, alignment.AlignedSequences.Count);
            Assert.AreEqual(alignments[0].Metadata, alignment.Metadata);
            Assert.AreEqual(inputSequences[0].ToString(), alignment.Sequences[0].ToString());

            ApplicationLog.WriteLine(@"Alignment BVT : Validation of sequence alignment completed successfully");
        }