Example #1
0
        /// <summary>
        /// Validate Add library information in existing libraries.
        /// </summary>
        /// <param name="nodeName">xml node name used for different testcases</param>
        /// <param name="IsLibraryInfo">Is library info?</param>
        internal void AddLibraryInformation(string nodeName, bool IsLibraryInfo)
        {
            string filePath = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.FilePathNode);
            string expectedPairedReadsCount = utilityObj.xmlUtil.GetTextValue(
              nodeName, Constants.PairedReadsCountNode);
            string[] backwardReadsNode = utilityObj.xmlUtil.GetTextValues(nodeName,
              Constants.BackwardReadsNode);
            string[] forwardReadsNode = utilityObj.xmlUtil.GetTextValues(nodeName,
              Constants.ForwardReadsNode);
            string expectedLibraray = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.LibraryName);
            string expectedStdDeviation = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.StdDeviation);
            string mean = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.Mean);

            IList<ISequence> sequenceReads = new List<ISequence>();
            IList<MatePair> pairedreads = new List<MatePair>();

            // Get the input reads 
            IEnumerable<ISequence> sequences = null;
            using (FastAParser parser = new FastAParser(filePath))
            {
                sequences = parser.Parse();

                foreach (ISequence seq in sequences)
                {
                    sequenceReads.Add(seq);
                }

                // Add a new library infomration.
                if (IsLibraryInfo)
                {
                    CloneLibraryInformation libraryInfo =
                      new CloneLibraryInformation();
                    libraryInfo.LibraryName = expectedLibraray;
                    libraryInfo.MeanLengthOfInsert = float.Parse(mean, (IFormatProvider)null);
                    libraryInfo.StandardDeviationOfInsert = float.Parse(expectedStdDeviation, (IFormatProvider)null);
                    CloneLibrary.Instance.AddLibrary(libraryInfo);
                }
                else
                {
                    CloneLibrary.Instance.AddLibrary(expectedLibraray,
                        float.Parse(mean, (IFormatProvider)null), float.Parse(expectedStdDeviation, (IFormatProvider)null));
                }

                // Convert reads to map paired reads.
                MatePairMapper pair = new MatePairMapper();
                pairedreads = pair.Map(sequenceReads);

                // Validate Map paired reads.
                Assert.AreEqual(expectedPairedReadsCount, pairedreads.Count.ToString((IFormatProvider)null));

                for (int index = 0; index < pairedreads.Count; index++)
                {
                    Assert.IsTrue(forwardReadsNode.Contains(new string(pairedreads[index].GetForwardRead(sequenceReads).Select(a => (char)a).ToArray())));
                    Assert.IsTrue(backwardReadsNode.Contains(new string(pairedreads[index].GetReverseRead(sequenceReads).Select(a => (char)a).ToArray())));
                    Assert.AreEqual(expectedStdDeviation,
                      pairedreads[index].StandardDeviationOfLibrary.ToString((IFormatProvider)null));
                    Assert.AreEqual(expectedLibraray, pairedreads[index].Library.ToString((IFormatProvider)null));
                    Assert.AreEqual(mean, pairedreads[index].MeanLengthOfLibrary.ToString((IFormatProvider)null));
                }
            }

            ApplicationLog.WriteLine(@"Padena P1 : Map paired reads has been verified successfully");
        }
Example #2
0
        /// <summary>
        /// Validate Map paired reads for a sequence reads.
        /// </summary>
        /// <param name="nodeName">xml node name used for different testcases</param>
        internal void ValidatePairedReads(string nodeName)
        {
            string filePath = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.FilePathNode);
            string expectedPairedReadsCount = utilityObj.xmlUtil.GetTextValue(
              nodeName, Constants.PairedReadsCountNode);
            string[] backwardReadsNode = utilityObj.xmlUtil.GetTextValues(nodeName,
              Constants.BackwardReadsNode);
            string[] forwardReadsNode = utilityObj.xmlUtil.GetTextValues(nodeName,
              Constants.ForwardReadsNode);
            string[] expectedLibrary = utilityObj.xmlUtil.GetTextValues(nodeName,
              Constants.LibraryNode);
            string[] expectedMean = utilityObj.xmlUtil.GetTextValues(nodeName,
              Constants.MeanLengthNode);
            string[] deviationNode = utilityObj.xmlUtil.GetTextValues(nodeName,
              Constants.DeviationNode);

            IList<ISequence> sequenceReads = new List<ISequence>();
            IList<MatePair> pairedreads = new List<MatePair>();

            // Get the input reads 
            IEnumerable<ISequence> sequences = null;
            using (FastAParser parser = new FastAParser(filePath))
            {
                sequences = parser.Parse();

                foreach (ISequence seq in sequences)
                {
                    sequenceReads.Add(seq);
                }

                // Convert reads to map paired reads.
                MatePairMapper pair = new MatePairMapper();
                pairedreads = pair.Map(sequenceReads);

                // Validate Map paired reads.
                Assert.AreEqual(expectedPairedReadsCount,
                    pairedreads.Count.ToString((IFormatProvider)null));

                for (int index = 0; index < pairedreads.Count; index++)
                {
                    Assert.IsTrue(forwardReadsNode.Contains(new string(pairedreads[index].GetForwardRead(sequenceReads).Select(a => (char)a).ToArray())));
                    Assert.IsTrue(backwardReadsNode.Contains(new string(pairedreads[index].GetReverseRead(sequenceReads).Select(a => (char)a).ToArray())));
                    Assert.IsTrue(deviationNode.Contains(pairedreads[index].StandardDeviationOfLibrary.ToString((IFormatProvider)null)));
                    Assert.IsTrue(expectedMean.Contains(pairedreads[index].MeanLengthOfLibrary.ToString((IFormatProvider)null)));
                    Assert.IsTrue(expectedLibrary.Contains(pairedreads[index].Library.ToString((IFormatProvider)null)));
                }
            }
            ApplicationLog.WriteLine(@"Padena P1 : Map paired reads has been verified successfully");
        }
Example #3
0
        /// <summary>
        /// Validate library information
        /// </summary>
        /// <param name="nodeName">xml node name used for different testcases</param>
        internal void GetLibraryInformation(string nodeName)
        {
            string filePath = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.FilePathNode);
            string expectedPairedReadsCount = utilityObj.xmlUtil.GetTextValue(
              nodeName, Constants.PairedReadsCountNode);
            string expectedLibraray = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.LibraryName);
            string expectedStdDeviation = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.StdDeviation);
            string mean = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.Mean);

            IList<MatePair> pairedreads = new List<MatePair>();

            // Get the input reads 
            IEnumerable<ISequence> sequences = null;
            using (FastAParser parser = new FastAParser(filePath))
            {
                sequences = parser.Parse();

                // Convert reads to map paired reads.
                MatePairMapper pair = new MatePairMapper();
                pairedreads = pair.Map(new List<ISequence>(sequences));

                // Validate Map paired reads.
                Assert.AreEqual(expectedPairedReadsCount,
                  pairedreads.Count.ToString((IFormatProvider)null));

                // Get library infomration and validate
                CloneLibraryInformation libraryInfo =
                  CloneLibrary.Instance.GetLibraryInformation
                  (pairedreads[0].Library);

                Assert.AreEqual(expectedStdDeviation, libraryInfo.StandardDeviationOfInsert.ToString((IFormatProvider)null));
                Assert.AreEqual(expectedLibraray, libraryInfo.LibraryName.ToString((IFormatProvider)null));
                Assert.AreEqual(mean, libraryInfo.MeanLengthOfInsert.ToString((IFormatProvider)null));
            }
            ApplicationLog.WriteLine(@"Padena P1 : Map paired reads has been verified successfully");
        }
Example #4
0
        /// <summary>
        /// Validate Add library information to existing libraries.
        /// </summary>
        /// <param name="nodeName">xml node name used for different testcases</param>
        internal void AddLibraryInformation(string nodeName)
        {
            string filePath = utilityObj.xmlUtil.GetTextValue(nodeName,
                Constants.FilePathNode);
            string expectedPairedReadsCount = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.PairedReadsCountNode);
            string[] backwardReadsNode = utilityObj.xmlUtil.GetTextValues(nodeName,
                Constants.BackwardReadsNode);
            string[] forwardReadsNode = utilityObj.xmlUtil.GetTextValues(nodeName,
                Constants.ForwardReadsNode);
            string[] expectedLibrary = utilityObj.xmlUtil.GetTextValues(nodeName,
                Constants.LibraryNode);
            string[] expectedMean = utilityObj.xmlUtil.GetTextValues(nodeName,
                Constants.MeanLengthNode);
            string[] deviationNode = utilityObj.xmlUtil.GetTextValues(nodeName,
                Constants.DeviationNode);
            string libraray = utilityObj.xmlUtil.GetTextValue(nodeName,
                Constants.LibraryName);
            string StdDeviation = utilityObj.xmlUtil.GetTextValue(nodeName,
                Constants.StdDeviation);
            string mean = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.Mean);


            IList<MatePair> pairedreads = new List<MatePair>();

            // Get the input reads 
            IEnumerable<ISequence> sequences = null;
            FastAParser parser = new FastAParser();
parser.Open( filePath.Replace("\\", System.IO.Path.DirectorySeparatorChar.ToString()));
            sequences = parser.Parse().ToList();
            parser.Close ();
                IList<ISequence> sequenceReads =
                    new List<ISequence>(sequences);

                // Add a new library infomration.
                CloneLibrary.Instance.AddLibrary(libraray,
                    float.Parse(mean, (IFormatProvider)null), float.Parse(StdDeviation, (IFormatProvider)null));

                // Convert reads to map paired reads. 
                MatePairMapper pair = new MatePairMapper();
                pairedreads = pair.Map(sequenceReads);

                // Validate Map paired reads.
                Assert.AreEqual(expectedPairedReadsCount, pairedreads.Count.ToString((IFormatProvider)null));

                for (int index = 0; index < pairedreads.Count; index++)
                {
                    Assert.IsTrue(forwardReadsNode.Contains(
                        new string(pairedreads[index].GetForwardRead(sequenceReads).Select(a => (char)a).ToArray())));
                    Assert.IsTrue(backwardReadsNode.Contains(
                        new string(pairedreads[index].GetReverseRead(sequenceReads).Select(a => (char)a).ToArray())));
                    Assert.IsTrue(deviationNode.Contains(pairedreads[index].StandardDeviationOfLibrary.ToString((IFormatProvider)null)));
                    Assert.IsTrue(expectedLibrary.Contains(pairedreads[index].Library.ToString((IFormatProvider)null)));
                    Assert.IsTrue(expectedMean.Contains(pairedreads[index].MeanLengthOfLibrary.ToString((IFormatProvider)null)));
                }


            ApplicationLog.WriteLine(@"Padena BVT : Map paired reads has been verified successfully");
        }