public void TestConvertFromSolexaToIllumina() { byte[] bs; byte[] bs1 = new byte[2]; bs1[0] = (byte)60; bs1[1] = (byte)60; bs = QualitativeSequence.ConvertFromSolexaToIllumina(bs1); Assert.IsNotNull((object)bs); Assert.AreEqual <int>(2, bs.Length); Assert.AreEqual <byte>((byte)65, bs[0]); Assert.AreEqual <byte>((byte)65, bs[1]); }
public void TestConvertFromSolexaToIllumina() { byte[] illuminaScores; byte[] solexaScores = new byte[2]; solexaScores[0] = (byte)60; solexaScores[1] = (byte)60; illuminaScores = QualitativeSequence.ConvertFromSolexaToIllumina(solexaScores); Assert.IsNotNull((object)illuminaScores); Assert.AreEqual <int>(2, illuminaScores.Length); Assert.AreEqual <byte>((byte)65, illuminaScores[0]); Assert.AreEqual <byte>((byte)65, illuminaScores[1]); }
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 = ASCIIEncoding.ASCII.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 = encodingObj.GetBytes(solexaSequence); // Create a Solexa qualitative sequence. //QualitativeSequence solexaQualSequence = new QualitativeSequence(Alphabets.DNA, // FastQFormatType.Solexa, solexaSequence, byteValue); //QualitativeSequence solexaQualSequence = new QualitativeSequence(Alphabets.DNA,******************** // FastQFormatType.Solexa, solexaSequenceinBytes, byteValue); //// Convert Solexa to Sanger. //QualitativeSequence sangerQualSequence = solexaQualSequence.ConvertTo( // FastQFormatType.Sanger); //sangerQualScore = ASCIIEncoding.ASCII.GetString(sangerQualSequence.Scores); byte[] sangerQualScore = QualitativeSequence.ConvertFromSolexaToSanger(byteValue); // Validate converted sanger score. string qualSequence = new string(encodingObj.GetChars(sangerQualScore)); Assert.AreEqual(expectedSangerQualScore, qualSequence); //Assert.AreEqual(sangerQualSequence.ToString(), expectedSangerSequence); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Qualitative Sequence BVT:Qualitative Sanger score type {0} is as expected.", sangerQualScore)); //Console.WriteLine(string.Format((IFormatProvider)null, // "Qualitative Sequence BVT:Qualitative Sanger score type {0} is as expected.", // sangerQualSequence.ToString())); // Convert Solexa to Illumina. //QualitativeSequence illuminaQualSequence = // solexaQualSequence.ConvertTo(FastQFormatType.Illumina); //illuminaQualScore = ASCIIEncoding.ASCII.GetString(illuminaQualSequence.Scores); byte[] illuminaQualScore = QualitativeSequence.ConvertFromSolexaToIllumina(byteValue); string qualSequenceIllumina = new string(encodingObj.GetChars(illuminaQualScore)); Assert.AreEqual(expectedIlluminaQualScore, qualSequenceIllumina); // Validate converted illumina score. //Assert.AreEqual(illuminaQualScore, expectedIlluminaQualScore); //Assert.AreEqual(illuminaQualSequence.ToString(), expectedIlluminaSequence); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Qualitative Sequence BVT:Qualitative Illumina score type {0} is as expected.", illuminaQualScore)); //Console.WriteLine(string.Format((IFormatProvider)null, // "Qualitative Sequence BVT:Qualitative Illumina score type {0} is as expected.", // illuminaQualSequence.ToString())); }