Пример #1
0
        public void TestConvertingFromSolexaToSanger()
        {
            string sequencestr            = "GCCCCCCCCCCCCCCCCCGGGGGGGGTTTTTTTTTTTTTTTTTTTTTTTTTGGGGGGGGGGGGAAAAA";
            string solexaQualScores       = ";<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
            string sangerQaulScores       = "!\"##$$%%&&'()*++,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
            QualitativeSequence solexaSeq = new QualitativeSequence(Alphabets.DNA,
                                                                    FastQFormatType.Solexa,
                                                                    sequencestr,
                                                                    ASCIIEncoding.ASCII.GetBytes(solexaQualScores));
            QualitativeSequence sangerSeq = solexaSeq.ConvertTo(FastQFormatType.Sanger);
            string testSanger             = ASCIIEncoding.ASCII.GetString(sangerSeq.Scores);

            Assert.AreEqual(testSanger, sangerQaulScores);
        }
Пример #2
0
        public void TestConvertingFromSolexaToIllumina()
        {
            string sequencestr            = "GCCCCCCCCCCCCCCCCCGGGGGGGGTTTTTTTTTTTTTTTTTTTTTTTTTGGGGGGGGGGGGAAAAA";
            string solexaQualScores       = ";<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
            string illuminaQualScores     = "@ABBCCDDEEFGHIJJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
            QualitativeSequence solexaSeq = new QualitativeSequence(Alphabets.DNA,
                                                                    FastQFormatType.Solexa,
                                                                    sequencestr,
                                                                    ASCIIEncoding.ASCII.GetBytes(solexaQualScores));
            QualitativeSequence illuminaSeq = solexaSeq.ConvertTo(FastQFormatType.Illumina);
            string testillumina             = ASCIIEncoding.ASCII.GetString(illuminaSeq.Scores);

            Assert.AreEqual(testillumina, illuminaQualScores);
        }
Пример #3
0
        public void TestConvertingFromSangerToIllumina()
        {
            string sequencestr            = "ACGTAAAAAAAGGGGGGGGGGGGGGGGCCCCCCCCCCCCCCCCCGGGGGGGGTTTTTTTTTTTTTTTTTTTTTTTTTGGGGGGGGGGGGAAAAA";
            string sangerQaulScores       = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
            string illuminaQualScores     = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
            QualitativeSequence sangerSeq = new QualitativeSequence(Alphabets.DNA,
                                                                    FastQFormatType.Sanger,
                                                                    sequencestr,
                                                                    ASCIIEncoding.ASCII.GetBytes(sangerQaulScores));
            QualitativeSequence illuminaSeq = sangerSeq.ConvertTo(FastQFormatType.Illumina);
            string testIllumina             = ASCIIEncoding.ASCII.GetString(illuminaSeq.Scores);

            Assert.AreEqual(testIllumina, illuminaQualScores);
        }
Пример #4
0
        public void ConvertSolexaToSangerAndIllumina()
        {
            // Gets the actual sequence and the Qual score from the Xml
            string solexaSequence = utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.SolexaSequence);
            string expectedSangerSequence = utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.SangerSequence);
            string expectedIlluminaSequence = utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.IlluminaSequence);
            string solexaQualScore = utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.SolexaQualScore);
            string expectedSangerQualScore = utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.SangerQualScore);
            string expectedIlluminaQualScore = utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.IlluminaQualScore);

            byte[] byteValue = Encoding.UTF8.GetBytes(solexaQualScore);

            string sangerQualScore   = null;
            string illuminaQualScore = null;

            byte[] qualScores = new byte[solexaSequence.Count()];

            for (int i = 0; i < solexaSequence.Count(); i++)
            {
                qualScores[i] = (byte)'{';
            }

            Byte[] solexaSequenceinBytes = Encoding.UTF8.GetBytes(solexaSequence);

            // Create a Solexa qualitative sequence.
            QualitativeSequence solexaQualSequence = new QualitativeSequence(Alphabets.DNA,
                                                                             FastQFormatType.Solexa_Illumina_v1_0, solexaSequenceinBytes, byteValue);

            // Convert Solexa to Sanger.
            QualitativeSequence sangerQualSequence = solexaQualSequence.ConvertTo(
                FastQFormatType.Sanger);
            var scores = sangerQualSequence.GetEncodedQualityScores();

            sangerQualScore = Encoding.UTF8.GetString(scores, 0, scores.Length);

            Assert.AreEqual(expectedSangerQualScore, sangerQualScore);
            Assert.AreEqual(new string(sangerQualSequence.Select(a => (char)a).ToArray()), expectedSangerSequence);

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                   "Qualitative Sequence BVT:Qualitative Sanger score type {0} is as expected.",
                                                   sangerQualScore));

            // Convert Solexa to Illumina.
            QualitativeSequence illuminaQualSequence =
                solexaQualSequence.ConvertTo(FastQFormatType.Illumina_v1_3);

            scores            = illuminaQualSequence.GetEncodedQualityScores();
            illuminaQualScore = Encoding.UTF8.GetString(scores, 0, scores.Length);
            Assert.AreEqual(expectedIlluminaQualScore, illuminaQualScore);

            string illuminaQualseq = new string(illuminaQualSequence.Select(a => (char)a).ToArray());

            // Validate converted illumina score.
            Assert.AreEqual(illuminaQualScore, expectedIlluminaQualScore);
            Assert.AreEqual(illuminaQualseq, expectedIlluminaSequence);

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                   "Qualitative Sequence BVT:Qualitative Illumina score type {0} is as expected.",
                                                   illuminaQualScore));
        }
Пример #5
0
        public void ConvertSangerToSolexaAndIllumina()
        {
            // Gets the actual sequence and the Qual score from the Xml
            string sangerSequence = utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.SangerSequence);
            string expectedSolexaSequence = utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.SolexaSequence);
            string expectedIlluminaSequence = utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.IlluminaSequence);
            string sangerQualScore = utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.SangerQualScore);
            string expectedSolexaQualScore = utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.SolexaQualScore);
            string expectedIlluminaQualScore = utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.IlluminaQualScore);

            string solexaQualScore   = null;
            string illuminaQualScore = null;

            byte[] scoreValue = Encoding.UTF8.GetBytes(sangerQualScore);

            // Create a Sanger qualitative sequence.
            QualitativeSequence sangerQualSequence = new QualitativeSequence(Alphabets.DNA,
                                                                             FastQFormatType.Sanger, sangerSequence, sangerQualScore);

            // Convert Sanger to Solexa.
            QualitativeSequence solexaQualSequence = sangerQualSequence.ConvertTo(
                FastQFormatType.Solexa_Illumina_v1_0);

            byte[] sangerToSolexa = QualitativeSequence.ConvertEncodedQualityScore(FastQFormatType.Sanger, FastQFormatType.Solexa_Illumina_v1_0, scoreValue);
            var    scores         = solexaQualSequence.GetEncodedQualityScores();

            solexaQualScore = Encoding.UTF8.GetString(scores, 0, scores.Length);

            // Validate converted solexa score.

            string qualSequence = new string(Encoding.UTF8.GetChars(sangerToSolexa));

            Assert.AreEqual(expectedSolexaQualScore, qualSequence);
            Assert.AreEqual(solexaQualScore, expectedSolexaQualScore);

            string solexaQualString = new string(solexaQualSequence.Select(a => (char)a).ToArray());

            Assert.AreEqual(solexaQualString, expectedSolexaSequence);

            ApplicationLog.WriteLine(string.Format(null,
                                                   "Qualitative Sequence BVT:Qualitative Solexa score type {0} is as expected.",
                                                   solexaQualScore));

            // Convert Sanger to Illumina.
            QualitativeSequence illuminaQualSequence = sangerQualSequence.ConvertTo(
                FastQFormatType.Illumina_v1_3);

            scores            = illuminaQualSequence.GetEncodedQualityScores();
            illuminaQualScore = Encoding.UTF8.GetString(scores, 0, scores.Length);

            byte[] sangerToIllumina = QualitativeSequence.ConvertEncodedQualityScore(FastQFormatType.Sanger, FastQFormatType.Illumina_v1_3, scoreValue);
            string illuminaQualSeq  = new string(illuminaQualSequence.Select(a => (char)a).ToArray());

            //// Validate converted illumina score.
            Assert.AreEqual(illuminaQualScore, expectedIlluminaQualScore);
            Assert.AreEqual(illuminaQualSeq, expectedIlluminaSequence);

            string sangerToIlluminaString = new string(Encoding.UTF8.GetChars(sangerToIllumina));

            Assert.AreEqual(expectedIlluminaQualScore, sangerToIlluminaString);

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                   "Qualitative Sequence BVT:Qualitative Illumina score type {0} is as expected.",
                                                   illuminaQualScore));
        }
        public void ConvertSolexaToSangerAndIllumina()
        {
            // Gets the actual sequence and the Qual score from the Xml
            string solexaSequence = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.SolexaSequence);
            string expectedSangerSequence = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.SangerSequence);
            string expectedIlluminaSequence = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.IlluminaSequence);
            string solexaQualScore = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.SolexaQualScore);
            string expectedSangerQualScore = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.SangerQualScore);
            string expectedIlluminaQualScore = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SolexaToSangerAndIlluminaNode, Constants.IlluminaQualScore);
            byte[] byteValue = Encoding.UTF8.GetBytes(solexaQualScore);

            string sangerQualScore = null;
            string illuminaQualScore = null;

            byte[] qualScores = new byte[solexaSequence.Count()];

            for (int i = 0; i < solexaSequence.Count(); i++)
            {
                qualScores[i] = (byte)'{';
            }

            Byte[] solexaSequenceinBytes = Encoding.UTF8.GetBytes(solexaSequence);

            // Create a Solexa qualitative sequence.
            QualitativeSequence solexaQualSequence = new QualitativeSequence(Alphabets.DNA,
                FastQFormatType.Solexa_Illumina_v1_0, solexaSequenceinBytes, byteValue);

            // Convert Solexa to Sanger.
            QualitativeSequence sangerQualSequence = solexaQualSequence.ConvertTo(
                FastQFormatType.Sanger);
            var scores = sangerQualSequence.GetEncodedQualityScores();
            sangerQualScore = Encoding.UTF8.GetString(scores, 0, scores.Length);

            Assert.AreEqual(expectedSangerQualScore, sangerQualScore);
            Assert.AreEqual(new string(sangerQualSequence.Select(a => (char)a).ToArray()), expectedSangerSequence);

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                "Qualitative Sequence BVT:Qualitative Sanger score type {0} is as expected.",
                sangerQualScore));

            // Convert Solexa to Illumina.
            QualitativeSequence illuminaQualSequence =
               solexaQualSequence.ConvertTo(FastQFormatType.Illumina_v1_3);
            scores = illuminaQualSequence.GetEncodedQualityScores();
            illuminaQualScore = Encoding.UTF8.GetString(scores, 0, scores.Length);
            Assert.AreEqual(expectedIlluminaQualScore, illuminaQualScore);
            
            string illuminaQualseq=new string(illuminaQualSequence.Select(a => (char)a).ToArray());

            // Validate converted illumina score.
            Assert.AreEqual(illuminaQualScore, expectedIlluminaQualScore);
            Assert.AreEqual(illuminaQualseq, expectedIlluminaSequence);
            
            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                "Qualitative Sequence BVT:Qualitative Illumina score type {0} is as expected.",
                illuminaQualScore));
        }
        public void ConvertSangerToSolexaAndIllumina()
        {
            // Gets the actual sequence and the Qual score from the Xml
            string sangerSequence = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.SangerSequence);
            string expectedSolexaSequence = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.SolexaSequence);
            string expectedIlluminaSequence = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.IlluminaSequence);
            string sangerQualScore = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.SangerQualScore);
            string expectedSolexaQualScore = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.SolexaQualScore);
            string expectedIlluminaQualScore = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SangerToSolexaAndIlluminaNode, Constants.IlluminaQualScore);

            string solexaQualScore = null;
            string illuminaQualScore = null;
            byte[] scoreValue = Encoding.UTF8.GetBytes(sangerQualScore);

            // Create a Sanger qualitative sequence.
            QualitativeSequence sangerQualSequence = new QualitativeSequence(Alphabets.DNA,
                FastQFormatType.Sanger, sangerSequence, sangerQualScore);           

            // Convert Sanger to Solexa.
            QualitativeSequence solexaQualSequence = sangerQualSequence.ConvertTo(
                FastQFormatType.Solexa_Illumina_v1_0);

            byte[] sangerToSolexa = QualitativeSequence.ConvertEncodedQualityScore(FastQFormatType.Sanger, FastQFormatType.Solexa_Illumina_v1_0, scoreValue);
            var scores = solexaQualSequence.GetEncodedQualityScores();
            solexaQualScore = Encoding.UTF8.GetString(scores, 0, scores.Length);

            // Validate converted solexa score.            

            string qualSequence = new string(Encoding.UTF8.GetChars(sangerToSolexa));

            Assert.AreEqual(expectedSolexaQualScore, qualSequence);
            Assert.AreEqual(solexaQualScore, expectedSolexaQualScore);

            string solexaQualString=new string(solexaQualSequence.Select(a => (char)a).ToArray());
            Assert.AreEqual(solexaQualString,expectedSolexaSequence);

            ApplicationLog.WriteLine(string.Format(null,
                "Qualitative Sequence BVT:Qualitative Solexa score type {0} is as expected.",
                solexaQualScore));

            // Convert Sanger to Illumina.
            QualitativeSequence illuminaQualSequence = sangerQualSequence.ConvertTo(
                FastQFormatType.Illumina_v1_3);
            scores = illuminaQualSequence.GetEncodedQualityScores();
            illuminaQualScore = Encoding.UTF8.GetString(scores, 0, scores.Length);

            byte[] sangerToIllumina = QualitativeSequence.ConvertEncodedQualityScore(FastQFormatType.Sanger, FastQFormatType.Illumina_v1_3, scoreValue);
            string illuminaQualSeq = new string(illuminaQualSequence.Select(a => (char)a).ToArray());

            //// Validate converted illumina score.
            Assert.AreEqual(illuminaQualScore, expectedIlluminaQualScore);
            Assert.AreEqual(illuminaQualSeq, expectedIlluminaSequence);

            string sangerToIlluminaString = new string(Encoding.UTF8.GetChars(sangerToIllumina));            
            Assert.AreEqual(expectedIlluminaQualScore, sangerToIlluminaString);

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                "Qualitative Sequence BVT:Qualitative Illumina score type {0} is as expected.",
                illuminaQualScore));
        }