PageRenderTime 46ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/bio/Tests/Bio.TestAutomation/IO/BAM/BAMBvtTestCases.cs

#
C# | 1217 lines | 848 code | 110 blank | 259 comment | 23 complexity | e19a9d9ddc1b098e2b8a86b2719c5493 MD5 | raw file
Possible License(s): Apache-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0

Large files files are truncated, but you can click here to view the full file

  1. /****************************************************************************
  2. * BAMBvtTestCases.cs
  3. *
  4. * This file contains the BAM - Parsers and Formatters Bvt test cases.
  5. *
  6. ***************************************************************************/
  7. using System;
  8. using System.Linq;
  9. using System.Collections.Generic;
  10. using System.IO;
  11. using System.Text;
  12. using Bio.TestAutomation.Util;
  13. using Bio.Util.Logging;
  14. using Microsoft.VisualStudio.TestTools.UnitTesting;
  15. using Bio.IO.SAM;
  16. using Bio.IO.BAM;
  17. using Bio.IO.FastA;
  18. using Bio.IO;
  19. using System.Globalization;
  20. using Bio;
  21. namespace Bio.TestAutomation.IO.BAM
  22. {
  23. /// <summary>
  24. /// BAM Bvt parser and formatter Test case implementation.
  25. /// </summary>
  26. [TestClass]
  27. public class BAMBvtTestCases
  28. {
  29. #region Enums
  30. /// <summary>
  31. /// BAM Parser ctor parameters used for different test cases.
  32. /// </summary>
  33. enum BAMParserParameters
  34. {
  35. StreamReader,
  36. FileName,
  37. ParseRangeFileName,
  38. ParseRangeWithIndex,
  39. ParserWithEncoding,
  40. IndexFile,
  41. IndexStreamWriter,
  42. StreamWriter,
  43. ParseRangeUsingRefSeq,
  44. ParseRangeUsingRefSeqAndFlag,
  45. ParseRangeUsingRefSeqUsingIndex,
  46. ParseRangeUsingIndexesAndFlag,
  47. Default
  48. }
  49. /// <summary>
  50. /// PairedReadType method parameters
  51. /// </summary>
  52. enum GetPairedReadTypeParameters
  53. {
  54. PaireReadTypeUsingLibraryName,
  55. PaireReadTypeUsingCloneLibraryInfo,
  56. PaireReadTypeUsingMeanAndDeviation,
  57. PaireReadTypeUsingReadsAndLibraryInfo,
  58. PaireReadTypeUsingReadsAndLibrary,
  59. GetInsertLength,
  60. Default
  61. }
  62. /// <summary>
  63. /// Get Paired parameters
  64. /// </summary>
  65. enum GetPairedReadParameters
  66. {
  67. GetPairedReadWithParameters,
  68. GetPairedReadWithLibraryName,
  69. GetPairedReadWithCloneLibraryInfo,
  70. Default
  71. }
  72. #endregion Enums
  73. #region Global Variables
  74. Utility utilityObj = new Utility(@"TestUtils\SAMBAMTestData\SAMBAMTestsConfig.xml");
  75. #endregion Global Variables
  76. #region Constructor
  77. /// <summary>
  78. /// Static constructor to open log and make other settings needed for test
  79. /// </summary>
  80. static BAMBvtTestCases()
  81. {
  82. Trace.Set(Trace.SeqWarnings);
  83. if (!ApplicationLog.Ready)
  84. {
  85. ApplicationLog.Open("bio.automation.log");
  86. }
  87. }
  88. #endregion Constructor
  89. #region BAM Parser Test Cases
  90. /// <summary>
  91. /// Validate BAM Parse(Stream) by passing valid BAM file
  92. /// Input : Small size BAM file.
  93. /// Output : Validation of aligned sequence.
  94. /// </summary>
  95. [TestMethod]
  96. [Priority(0)]
  97. [TestCategory("Priority0")]
  98. public void ValidateBAMParserWithStreamReader()
  99. {
  100. ValidateBAMParser(Constants.SmallSizeBAMFileNode,
  101. BAMParserParameters.StreamReader, false);
  102. }
  103. /// <summary>
  104. /// Validate BAM Parse(filename) by passing valid BAM file
  105. /// Input : Small size BAM file.
  106. /// Output : Validation of aligned sequence.
  107. /// </summary>
  108. [TestMethod]
  109. [Priority(0)]
  110. [TestCategory("Priority0")]
  111. public void ValidateBAMParserWithFilePath()
  112. {
  113. ValidateBAMParser(Constants.SmallSizeBAMFileNode,
  114. BAMParserParameters.FileName, false);
  115. }
  116. /// <summary>
  117. /// Validate BAM ParseRange(filename,RefIndex) by passing valid BAM file
  118. /// Input : Small size BAM file.
  119. /// Output : Validation of aligned sequence.
  120. /// </summary>
  121. [TestMethod]
  122. [Priority(0)]
  123. [TestCategory("Priority0")]
  124. public void ValidateBAMParserRangeWithFilePath()
  125. {
  126. ValidateBAMParser(Constants.SmallSizeBAMFileNode,
  127. BAMParserParameters.ParseRangeFileName, false);
  128. }
  129. /// <summary>
  130. /// Validate BAM ParseRange(filename,refSeqName)
  131. /// by passing valid BAM file
  132. /// Input : Small size BAM file.
  133. /// Output : Validation of aligned sequence.
  134. /// </summary>
  135. [TestMethod]
  136. [Priority(0)]
  137. [TestCategory("Priority0")]
  138. public void ValidateBAMParseRangeUsingRefSeqName()
  139. {
  140. ValidateBAMParser(Constants.BAMFileWithSequenceRangeRefSeqsNode,
  141. BAMParserParameters.ParseRangeUsingRefSeq, false);
  142. }
  143. /// <summary>
  144. /// Validate BAM ParseRange(filename,refSeqName,flag)
  145. /// by passing valid BAM file
  146. /// Input : Small size BAM file.
  147. /// Output : Validation of aligned sequence.
  148. /// </summary>
  149. [TestMethod]
  150. [Priority(0)]
  151. [TestCategory("Priority0")]
  152. public void ValidateBAMParseRangeUsingRefSeqNameAndFlag()
  153. {
  154. ValidateBAMParser(Constants.BAMFileWithSequenceRangeRefSeqsNode,
  155. BAMParserParameters.ParseRangeUsingRefSeqAndFlag, false);
  156. }
  157. /// <summary>
  158. /// Validate BAM ParseRange(filename,refSeqName,Start,end)
  159. /// by passing valid BAM file
  160. /// Input : Small size BAM file.
  161. /// Output : Validation of aligned sequence.
  162. /// </summary>
  163. [TestMethod]
  164. [Priority(0)]
  165. [TestCategory("Priority0")]
  166. public void ValidateBAMParseRangeUsingStartAndEndIndex()
  167. {
  168. ValidateBAMParser(Constants.SeqRangeBAMFileNode,
  169. BAMParserParameters.ParseRangeUsingRefSeqUsingIndex, false);
  170. }
  171. /// <summary>
  172. /// Validate BAM ParseRange(filename,refSeqName,Start,end,bool)
  173. /// by passing valid BAM file
  174. /// Input : Small size BAM file.
  175. /// Output : Validation of aligned sequence.
  176. /// </summary>
  177. [TestMethod]
  178. [Priority(0)]
  179. [TestCategory("Priority0")]
  180. public void ValidateBAMParseRangeUsingStartAndEndIndexWithFlag()
  181. {
  182. ValidateBAMParser(Constants.SeqRangeBAMFileNode,
  183. BAMParserParameters.ParseRangeUsingIndexesAndFlag, false);
  184. }
  185. /// <summary>
  186. /// Validate BAM GetPairedRead(Mean,Deviation)
  187. /// by passing valid BAM file
  188. /// Input : Small size BAM file.
  189. /// Output : Validation of aligned sequence.
  190. /// </summary>
  191. [TestMethod]
  192. [Priority(0)]
  193. [TestCategory("Priority0")]
  194. public void ValidatePairedReadUsingMeanAndDeviation()
  195. {
  196. ValidatePairedReads(Constants.PairedReadForSmallFileNodeName,
  197. GetPairedReadParameters.GetPairedReadWithParameters);
  198. }
  199. /// <summary>
  200. /// Validate BAM GetPairedRead()
  201. /// by passing valid BAM file
  202. /// Input : Small size BAM file.
  203. /// Output : Validation of aligned sequence.
  204. /// </summary>
  205. [TestMethod]
  206. [Priority(0)]
  207. [TestCategory("Priority0")]
  208. public void ValidatePairedReads()
  209. {
  210. ValidatePairedReads(Constants.PairedReadForSmallFileNodeName,
  211. GetPairedReadParameters.Default);
  212. }
  213. /// <summary>
  214. /// Validate BAM GetPairedRead(libraryName)
  215. /// by passing valid BAM file
  216. /// Input : Small size BAM file.
  217. /// Output : Validation of aligned sequence.
  218. /// </summary>
  219. [TestMethod]
  220. [Priority(0)]
  221. [TestCategory("Priority0")]
  222. public void ValidatePairedReadUsingLibraryName()
  223. {
  224. ValidatePairedReads(Constants.PairedReadForSmallFileNodeName,
  225. GetPairedReadParameters.GetPairedReadWithLibraryName);
  226. }
  227. /// <summary>
  228. /// Validate BAM GetPairedRead(CloneLibraryInfo)
  229. /// by passing valid BAM file
  230. /// Input : Small size BAM file.
  231. /// Output : Validation of aligned sequence.
  232. /// </summary>
  233. [TestMethod]
  234. [Priority(0)]
  235. [TestCategory("Priority0")]
  236. public void ValidatePairedReadUsingCloneLibraryInfo()
  237. {
  238. ValidatePairedReads(Constants.PairedReadForSmallFileNodeName,
  239. GetPairedReadParameters.GetPairedReadWithCloneLibraryInfo);
  240. }
  241. /// <summary>
  242. /// Validate BAM GetPairedReadType(PairedRead,CloneLibraryInfo)
  243. /// by passing valid BAM file
  244. /// Input : Small size BAM file.
  245. /// Output : Validation of aligned sequence.
  246. /// </summary>
  247. [TestMethod]
  248. [Priority(0)]
  249. [TestCategory("Priority0")]
  250. public void ValidatePairedReadTypeUsingCloneLibraryInfo()
  251. {
  252. ValidatePairedReadTypes(Constants.PairedReadTypesNode,
  253. GetPairedReadTypeParameters.PaireReadTypeUsingCloneLibraryInfo);
  254. }
  255. /// <summary>
  256. /// Validate BAM GetPairedReadType(PairedRead,Library)
  257. /// by passing valid BAM file
  258. /// Input : Small size BAM file.
  259. /// Output : Validation of aligned sequence.
  260. /// </summary>
  261. [TestMethod]
  262. [Priority(0)]
  263. [TestCategory("Priority0")]
  264. public void ValidatePairedReadTypeUsingLibrary()
  265. {
  266. ValidatePairedReadTypes(Constants.PairedReadTypesNode,
  267. GetPairedReadTypeParameters.PaireReadTypeUsingLibraryName);
  268. }
  269. /// <summary>
  270. /// Validate BAM GetPairedReadType(PairedRead,Mean,Devn)
  271. /// by passing valid BAM file
  272. /// Input : Small size BAM file.
  273. /// Output : Validation of aligned sequence.
  274. /// </summary>
  275. [TestMethod]
  276. [Priority(0)]
  277. [TestCategory("Priority0")]
  278. public void ValidatePairedReadTypeUsingMeanAndDeviation()
  279. {
  280. ValidatePairedReadTypes(Constants.PairedReadTypesForMeanAndDeviationNode,
  281. GetPairedReadTypeParameters.PaireReadTypeUsingMeanAndDeviation);
  282. }
  283. /// <summary>
  284. /// Validate BAM GetPairedReadType(Read1,Read2,Library)
  285. /// by passing valid BAM file
  286. /// Input : Small size BAM file.
  287. /// Output : Validation of aligned sequence.
  288. /// </summary>
  289. [TestMethod]
  290. [Priority(0)]
  291. [TestCategory("Priority0")]
  292. public void ValidatePairedReadTypeUsingReadsAndLibrary()
  293. {
  294. ValidatePairedReadTypes(Constants.PairedReadTypesForLibraryInfoNode,
  295. GetPairedReadTypeParameters.PaireReadTypeUsingReadsAndLibrary);
  296. }
  297. /// <summary>
  298. /// Validate BAM GetPairedReadType(Read1,Read2,CloneLibraryInfo)
  299. /// by passing valid BAM file
  300. /// Input : Small size BAM file.
  301. /// Output : Validation of aligned sequence.
  302. /// </summary>
  303. [TestMethod]
  304. [Priority(0)]
  305. [TestCategory("Priority0")]
  306. public void ValidatePairedReadTypeUsingReadsAndCloneLibraryInfo()
  307. {
  308. ValidatePairedReadTypes(Constants.PairedReadTypesForLibraryInfoNode,
  309. GetPairedReadTypeParameters.PaireReadTypeUsingReadsAndLibraryInfo);
  310. }
  311. /// <summary>
  312. /// Validate BAM GetInsertLength(Read1,Read2)
  313. /// by passing valid BAM file
  314. /// Input : Small size BAM file.
  315. /// Output : Validation of aligned sequence.
  316. /// </summary>
  317. [TestMethod]
  318. [Priority(0)]
  319. [TestCategory("Priority0")]
  320. public void ValidateInsertLengthForPairedReads()
  321. {
  322. ValidatePairedReadTypes(Constants.PairedReadTypesForLibraryInfoNode,
  323. GetPairedReadTypeParameters.GetInsertLength);
  324. }
  325. /// <summary>
  326. /// Validates the GetInsertLength method with a bool value passed for validate
  327. /// Input : Small size BAM file.
  328. /// Output : Validation of aligned sequence.
  329. /// </summary>
  330. /// </summary>
  331. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "System.String.Split(System.Char[])"), TestMethod]
  332. [Priority(0)]
  333. [TestCategory("Priority0")]
  334. public void ValidateGetInsertLengthWithValidate()
  335. {
  336. // Get input and output values from xml node.
  337. string bamFilePath = utilityObj.xmlUtil.GetTextValue(Constants.PairedReadTypesForLibraryInfoNode,
  338. Constants.FilePathNode);
  339. string mean = utilityObj.xmlUtil.GetTextValue(
  340. Constants.PairedReadTypesForLibraryInfoNode, Constants.MeanNode);
  341. string deviation = utilityObj.xmlUtil.GetTextValue(
  342. Constants.PairedReadTypesForLibraryInfoNode, Constants.DeviationValueNode);
  343. string[] insertLength = utilityObj.xmlUtil.GetTextValue(
  344. Constants.PairedReadTypesForLibraryInfoNode, Constants.InsertLengthNode).Split(',');
  345. IList<PairedRead> pairedReads = null;
  346. using (BAMParser bamParser = new BAMParser())
  347. {
  348. SequenceAlignmentMap seqAlignmentMapObj = bamParser.Parse(bamFilePath);
  349. int i = 0;
  350. try
  351. {
  352. pairedReads = seqAlignmentMapObj.GetPairedReads(float.Parse(mean, (IFormatProvider)null),
  353. float.Parse(deviation, (IFormatProvider)null));
  354. foreach (PairedRead read in pairedReads)
  355. {
  356. //pass true for validate parameter
  357. int length = PairedRead.GetInsertLength(read.Read1, read.Read2, true);
  358. Assert.AreEqual(length.ToString((IFormatProvider)null), insertLength[i]);
  359. i++;
  360. }
  361. ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
  362. "BAM Parser BVT : Validated GetInsertLength Successfully"));
  363. }
  364. finally
  365. {
  366. bamParser.Dispose();
  367. }
  368. }
  369. }
  370. #endregion BAM Parser Test Cases
  371. #region BAM Formatter Test Cases
  372. /// <summary>
  373. /// Validate format(seqAlignment,bamFile,indexFile) by
  374. /// parsing formatting valid BAM file.
  375. /// Input : Small size BAM file and index file.
  376. /// Output : Validation of aligned sequence.
  377. /// </summary>
  378. [TestMethod]
  379. [Priority(0)]
  380. [TestCategory("Priority0")]
  381. public void ValidateBAMFormatterWithIndexFile()
  382. {
  383. ValidateBAMFormatter(Constants.SmallSizeBAMFileNode,
  384. BAMParserParameters.IndexFile);
  385. }
  386. /// <summary>
  387. /// Validate format(seqAlignment, Stream) by
  388. /// parsing formatting valid BAM file.
  389. /// Input : Small size BAM file.
  390. /// Output : Validation of aligned sequence.
  391. /// </summary>
  392. [TestMethod]
  393. [Priority(0)]
  394. [TestCategory("Priority0")]
  395. public void ValidateBAMFormatterWithStreamWriter()
  396. {
  397. ValidateBAMFormatter(Constants.SmallSizeBAMFileNode,
  398. BAMParserParameters.StreamWriter);
  399. }
  400. /// <summary>
  401. /// Validate format(seqAlignment, filename) by
  402. /// parsing formatting valid BAM file.
  403. /// Input : Small size BAM file.
  404. /// Output : Validation of aligned sequence.
  405. /// </summary>
  406. [TestMethod]
  407. [Priority(0)]
  408. [TestCategory("Priority0")]
  409. public void ValidateBAMFormatterWithFilename()
  410. {
  411. ValidateBAMFormatter(Constants.SmallSizeBAMFileNode,
  412. BAMParserParameters.FileName);
  413. }
  414. /// <summary>
  415. /// Validate create bam index file
  416. /// </summary>
  417. [TestMethod]
  418. [Priority(0)]
  419. [TestCategory("Priority0")]
  420. public void ValidateCreateBAMIndexFile()
  421. {
  422. string bamFilePath = utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode,
  423. Constants.FilePathNode);
  424. BAMFormatter.CreateBAMIndexFile(bamFilePath);
  425. }
  426. #endregion BAM Formatter Test Cases.
  427. #region BAM Sort Test Cases
  428. /// <summary>
  429. /// Validates BAM Sort on ReadNames
  430. /// </summary>
  431. [TestMethod]
  432. [Priority(0)]
  433. [TestCategory("Priority0")]
  434. public void ValidateSortByReadNames()
  435. {
  436. using (BAMParser parser = new BAMParser())
  437. {
  438. string bamFilePath = utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode,
  439. Constants.FilePathNode);
  440. SequenceAlignmentMap seqAlignment = parser.Parse(bamFilePath);
  441. this.ValidateSort(seqAlignment, BAMSortByFields.ReadNames);
  442. }
  443. }
  444. /// <summary>
  445. /// Validates BAM Sort by ChromosomeCoordinates
  446. /// </summary>
  447. [TestMethod]
  448. [Priority(0)]
  449. [TestCategory("Priority0")]
  450. public void ValidateSortByChromosomeCoordinates()
  451. {
  452. using (BAMParser parser = new BAMParser())
  453. {
  454. string bamFilePath = utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode,
  455. Constants.FilePathNode);
  456. Assert.IsNotNull(bamFilePath);
  457. SequenceAlignmentMap seqAlignment = parser.Parse(bamFilePath);
  458. this.ValidateSort(seqAlignment, BAMSortByFields.ChromosomeCoordinates);
  459. }
  460. }
  461. /// <summary>
  462. /// Validates BAM Sort by ChromosomeNameAndCoordinates
  463. /// </summary>
  464. [TestMethod]
  465. [Priority(0)]
  466. [TestCategory("Priority0")]
  467. public void ValidateSortByChromosomeNameAndCoordinates()
  468. {
  469. using (BAMParser parser = new BAMParser())
  470. {
  471. string bamFilePath = utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode,
  472. Constants.FilePathNode);
  473. Assert.IsNotNull(bamFilePath);
  474. SequenceAlignmentMap seqAlignment = parser.Parse(bamFilePath);
  475. this.ValidateSort(seqAlignment, BAMSortByFields.ChromosomeNameAndCoordinates);
  476. }
  477. }
  478. #endregion BAM Sort Test Cases
  479. #region SAM BAM InterConversion Test Cases
  480. /// <summary>
  481. /// Validate BAM to SAM file conversion.
  482. /// Input : BAM file.
  483. /// Output : SAM file.
  484. /// </summary>
  485. [TestMethod]
  486. [Priority(0)]
  487. [TestCategory("Priority0")]
  488. public void ValidateBAMToSAMConversion()
  489. {
  490. // Get values from xml config file.
  491. string expectedSamFilePath = utilityObj.xmlUtil.GetTextValue(Constants.BAMToSAMConversionNode,
  492. Constants.FilePathNode1);
  493. string bamFilePath = utilityObj.xmlUtil.GetTextValue(Constants.BAMToSAMConversionNode,
  494. Constants.FilePathNode);
  495. using (BAMParser bamParserObj = new BAMParser())
  496. {
  497. using (SAMParser samParserObj = new SAMParser())
  498. {
  499. SAMFormatter samFormatterObj = new SAMFormatter();
  500. SequenceAlignmentMap samSeqAlignment = null;
  501. SequenceAlignmentMap bamSeqAlignment = null;
  502. // Parse expected SAM file.
  503. SequenceAlignmentMap expextedSamAlignmentObj = samParserObj.Parse(
  504. expectedSamFilePath);
  505. // Parse a BAM file.
  506. bamSeqAlignment = bamParserObj.Parse(bamFilePath);
  507. // Format BAM sequenceAlignment object to SAM file.
  508. samFormatterObj.Format(bamSeqAlignment, Constants.SAMTempFileName);
  509. // Parse a formatted SAM file.
  510. samSeqAlignment = samParserObj.Parse(Constants.SAMTempFileName);
  511. // Validate converted SAM file with expected SAM file.
  512. Assert.IsTrue(CompareSequencedAlignmentHeader(samSeqAlignment, expextedSamAlignmentObj));
  513. // Validate SAM file aligned sequences.
  514. Assert.IsTrue(CompareAlignedSequences(samSeqAlignment, expextedSamAlignmentObj));
  515. }
  516. }
  517. // Log message to VSTest GUI.
  518. ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
  519. "BAM Parser BVT : Validated the BAM->SAM conversion successfully"));
  520. Console.WriteLine(string.Format((IFormatProvider)null,
  521. "BAM Parser BVT : Validated the BAM->SAM conversion successfully"));
  522. // Delete temporary file.
  523. File.Delete(Constants.SAMTempFileName);
  524. ApplicationLog.WriteLine("Deleted the temp file created.");
  525. }
  526. /// <summary>
  527. /// Validate SAM to BAM file conversion.
  528. /// Input : SAM file.
  529. /// Output : BAM file.
  530. /// </summary>
  531. [TestMethod]
  532. [Priority(0)]
  533. [TestCategory("Priority0")]
  534. public void ValidateSAMToBAMConversion()
  535. {
  536. // Get values from xml config file.
  537. string expectedBamFilePath = utilityObj.xmlUtil.GetTextValue(
  538. Constants.BAMToSAMConversionNode, Constants.FilePathNode);
  539. string samFilePath = utilityObj.xmlUtil.GetTextValue(
  540. Constants.BAMToSAMConversionNode, Constants.FilePathNode1);
  541. using (BAMParser bamParserObj = new BAMParser())
  542. {
  543. using (SAMParser samParserObj = new SAMParser())
  544. {
  545. BAMFormatter bamFormatterObj = new BAMFormatter();
  546. SequenceAlignmentMap samSeqAlignment = null;
  547. SequenceAlignmentMap bamSeqAlignment = null;
  548. // Parse expected BAM file.
  549. SequenceAlignmentMap expextedBamAlignmentObj = bamParserObj.Parse(
  550. expectedBamFilePath);
  551. // Parse a SAM file.
  552. samSeqAlignment = samParserObj.Parse(samFilePath);
  553. // Format SAM sequenceAlignment object to BAM file.
  554. bamFormatterObj.Format(samSeqAlignment, Constants.BAMTempFileName);
  555. // Parse a formatted BAM file.
  556. bamSeqAlignment = bamParserObj.Parse(Constants.BAMTempFileName);
  557. // Validate converted BAM file with expected BAM file.
  558. Assert.IsTrue(CompareSequencedAlignmentHeader(bamSeqAlignment, expextedBamAlignmentObj));
  559. // Validate BAM file aligned sequences.
  560. Assert.IsTrue(CompareAlignedSequences(bamSeqAlignment, expextedBamAlignmentObj));
  561. }
  562. }
  563. // Log message to VSTest GUI.
  564. ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
  565. "BAM Parser BVT : Validated the SAM->BAM conversion successfully"));
  566. Console.WriteLine(string.Format((IFormatProvider)null,
  567. "BAM Parser BVT : Validated the SAM->BAM conversion successfully"));
  568. // Delete temporary file.
  569. File.Delete(Constants.BAMTempFileName);
  570. ApplicationLog.WriteLine("Deleted the temp file created.");
  571. }
  572. #endregion SAM BAM InterConversion Test Cases
  573. #region Helper Methods
  574. /// <summary>
  575. /// calls the Sort() method in BAMSort and checks if a BAMSortedIndex is returned.
  576. /// </summary>
  577. /// <param name="seqAlignment">SequenceAlignmentMap to be sorted</param>
  578. /// <param name="sortType">The sort type to be used when sorting using BAMSort</param>
  579. void ValidateSort(SequenceAlignmentMap seqAlignment, BAMSortByFields sortType)
  580. {
  581. BAMSort sorter = new BAMSort(seqAlignment, sortType);
  582. IList<BAMSortedIndex> sortedIndex = sorter.Sort();
  583. Assert.IsNotNull(sortedIndex);
  584. Assert.IsTrue(IsSortedIndex(sortedIndex,sortType));
  585. }
  586. /// <summary>
  587. /// Checks if the BAMSorted Index is sorted
  588. /// </summary>
  589. /// <param name="sortedIndex">The BAMSortedIndex that needs to be checked for proper sorting</param>
  590. /// <param name="sortType">The sort type to be used when sorting using BAMSort</param>
  591. /// <returns>true if properly sorted</returns>
  592. bool IsSortedIndex(IList<BAMSortedIndex> sortedIndex, BAMSortByFields sortType)
  593. {
  594. bool isSorted = true;
  595. string matchFile1 = utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode,
  596. Constants.MediumSizeBAMSortOutputMatchReadNames);
  597. string matchFile2 = utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode,
  598. Constants.MediumSizeBAMSortOutputMatchChromosomeCoordinates);
  599. string matchFile3 = utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode,
  600. Constants.MediumSizeBAMSortOutputMatchChromosomeNameAndCoordinates);
  601. string temp = string.Empty;
  602. switch (sortType)
  603. {
  604. case BAMSortByFields.ReadNames:
  605. temp = File.ReadAllText(matchFile1);
  606. Assert.AreEqual(temp, getSortedOutput(sortedIndex));
  607. break;
  608. case BAMSortByFields.ChromosomeCoordinates:
  609. temp = File.ReadAllText(matchFile2);
  610. Assert.AreEqual(temp, getSortedOutput(sortedIndex));
  611. break;
  612. case BAMSortByFields.ChromosomeNameAndCoordinates:
  613. temp = File.ReadAllText(matchFile3);
  614. Assert.AreEqual(temp, getSortedOutput(sortedIndex));
  615. break;
  616. default:
  617. break;
  618. }
  619. return isSorted;
  620. }
  621. /// <summary>
  622. /// Gets the sorted outpur from the BAMSortedIndex
  623. /// </summary>
  624. /// <param name="sortedIndex">The BAMSortedIndex for which sortedindex values are required.</param>
  625. /// <returns>Sorted index values as a string</returns>
  626. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
  627. private string getSortedOutput(IList<BAMSortedIndex> sortedIndex)
  628. {
  629. using (BAMParser parser = new BAMParser())
  630. {
  631. BAMSortedIndex index = sortedIndex.ElementAt(0);
  632. IEnumerator<int> sortedIndexList = index.GetEnumerator();
  633. StringBuilder temp = new StringBuilder();
  634. temp.Append(sortedIndexList.Current.ToString((IFormatProvider)null));
  635. while (sortedIndexList.MoveNext())
  636. {
  637. temp.Append("|" + sortedIndexList.Current.ToString((IFormatProvider)null));
  638. }
  639. Assert.IsNotNull(temp);
  640. Assert.AreNotEqual(0, temp.Length);
  641. sortedIndexList.Dispose();
  642. return temp.ToString();
  643. }
  644. }
  645. /// <summary>
  646. /// Parse BAM and validate parsed aligned sequences and its properties.
  647. /// </summary>
  648. /// <param name="nodeName">Different xml nodes used for different test cases</param>
  649. /// <param name="BAMParserPam">BAM Parse method parameters</param>
  650. /// <param name="IsEncoding">True for BAMParser ctor with encoding.
  651. /// False otherwise </param>
  652. void ValidateBAMParser(string nodeName,
  653. BAMParserParameters BAMParserPam,
  654. bool IsReferenceIndex)
  655. {
  656. // Get input and output values from xml node.
  657. string bamFilePath = utilityObj.xmlUtil.GetTextValue(nodeName,
  658. Constants.FilePathNode);
  659. string expectedAlignedSeqFilePath = utilityObj.xmlUtil.GetTextValue(
  660. nodeName, Constants.ExpectedSequence);
  661. string refIndexValue = utilityObj.xmlUtil.GetTextValue(
  662. nodeName, Constants.RefIndexNode);
  663. string startIndexValue = utilityObj.xmlUtil.GetTextValue(
  664. nodeName, Constants.StartIndexNode);
  665. string endIndexValue = utilityObj.xmlUtil.GetTextValue(
  666. nodeName, Constants.EndIndexNode);
  667. string alignedSeqCount = utilityObj.xmlUtil.GetTextValue(
  668. nodeName, Constants.AlignedSeqCountNode);
  669. string refSeqName = utilityObj.xmlUtil.GetTextValue(
  670. nodeName, Constants.ChromosomeNameNode);
  671. SequenceAlignmentMap seqAlignment = null;
  672. BAMParser bamParser = null;
  673. try
  674. {
  675. bamParser = new BAMParser();
  676. // Parse a BAM file with different parameters.
  677. switch (BAMParserPam)
  678. {
  679. case BAMParserParameters.StreamReader:
  680. using (Stream stream = new FileStream(bamFilePath, FileMode.Open,
  681. FileAccess.Read))
  682. {
  683. seqAlignment = bamParser.Parse(stream);
  684. }
  685. break;
  686. case BAMParserParameters.FileName:
  687. seqAlignment = bamParser.Parse(bamFilePath);
  688. break;
  689. case BAMParserParameters.ParseRangeFileName:
  690. seqAlignment = bamParser.ParseRange(bamFilePath,
  691. Convert.ToInt32(refIndexValue, (IFormatProvider)null));
  692. break;
  693. case BAMParserParameters.ParseRangeWithIndex:
  694. seqAlignment = bamParser.ParseRange(bamFilePath,
  695. Convert.ToInt32(refIndexValue, (IFormatProvider)null),
  696. Convert.ToInt32(startIndexValue, (IFormatProvider)null),
  697. Convert.ToInt32(endIndexValue, (IFormatProvider)null));
  698. break;
  699. case BAMParserParameters.ParseRangeUsingRefSeq:
  700. seqAlignment = bamParser.ParseRange(bamFilePath, refSeqName);
  701. break;
  702. case BAMParserParameters.ParseRangeUsingRefSeqAndFlag:
  703. seqAlignment = bamParser.ParseRange(bamFilePath, refSeqName);
  704. break;
  705. case BAMParserParameters.ParseRangeUsingRefSeqUsingIndex:
  706. seqAlignment = bamParser.ParseRange(bamFilePath, refSeqName,
  707. Convert.ToInt32(startIndexValue, (IFormatProvider)null),
  708. Convert.ToInt32(endIndexValue, (IFormatProvider)null));
  709. break;
  710. case BAMParserParameters.ParseRangeUsingIndexesAndFlag:
  711. seqAlignment = bamParser.ParseRange(bamFilePath, refSeqName,
  712. Convert.ToInt32(startIndexValue, (IFormatProvider)null),
  713. Convert.ToInt32(endIndexValue, (IFormatProvider)null));
  714. break;
  715. }
  716. // Validate BAM Header record fileds.
  717. if (!IsReferenceIndex)
  718. {
  719. ValidateBAMHeaderRecords(nodeName, seqAlignment);
  720. }
  721. IList<SAMAlignedSequence> alignedSeqs = seqAlignment.QuerySequences;
  722. Assert.AreEqual(alignedSeqCount, alignedSeqs.Count.ToString((IFormatProvider)null));
  723. // Get expected sequences
  724. using (FastAParser parserObj = new FastAParser(expectedAlignedSeqFilePath))
  725. {
  726. IEnumerable<ISequence> expectedSequences = parserObj.Parse();
  727. IList<ISequence> expectedSequencesList = expectedSequences.ToList();
  728. // Validate aligned sequences from BAM file.
  729. for (int index = 0; index < alignedSeqs.Count; index++)
  730. {
  731. Assert.AreEqual(
  732. new string(expectedSequencesList[index].Select(a => (char)a).ToArray()),
  733. new string(alignedSeqs[index].QuerySequence.Select(a => (char)a).ToArray()));
  734. // Log to VSTest GUI.
  735. ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
  736. "BAM Parser BVT : Validated Aligned sequence :{0} successfully",
  737. alignedSeqs[index].QuerySequence.ToString()));
  738. Console.WriteLine(string.Format((IFormatProvider)null,
  739. "BAM Parser BVT : Validated the aligned sequence :{0} successfully",
  740. alignedSeqs[index].QuerySequence.ToString()));
  741. }
  742. }
  743. }
  744. finally
  745. {
  746. bamParser.Dispose();
  747. }
  748. }
  749. /// <summary>
  750. /// Validate BAM file Header fields.
  751. /// </summary>
  752. /// <param name="nodeName">XML nodename used for different test cases</param>
  753. /// <param name="seqAlignment">seqAlignment object</param>
  754. void ValidateBAMHeaderRecords(string nodeName,
  755. SequenceAlignmentMap seqAlignment)
  756. {
  757. string expectedHeaderTagValues = utilityObj.xmlUtil.GetTextValue(
  758. nodeName, Constants.RecordTagValuesNode);
  759. string expectedHeaderTagKeys = utilityObj.xmlUtil.GetTextValue(
  760. nodeName, Constants.RecordTagKeysNode);
  761. string expectedHeaderTypes = utilityObj.xmlUtil.GetTextValue(
  762. nodeName, Constants.HeaderTyepsNodes);
  763. string[] expectedHeaderTagsValues = expectedHeaderTagValues.Split(',');
  764. string[] expectedHeaderKeys = expectedHeaderTagKeys.Split(',');
  765. string[] expectedHeaders = expectedHeaderTypes.Split(',');
  766. SAMAlignmentHeader header = seqAlignment.Header;
  767. IList<SAMRecordField> recordFields = header.RecordFields;
  768. int tagKeysCount = 0;
  769. int tagValuesCount = 0;
  770. for (int index = 0; index < recordFields.Count; index++)
  771. {
  772. Assert.AreEqual(expectedHeaders[index].Replace("/", ""),
  773. recordFields[index].Typecode.ToString((IFormatProvider)null).Replace("/", ""));
  774. for (int tags = 0; tags < recordFields[index].Tags.Count; tags++)
  775. {
  776. Assert.AreEqual(expectedHeaderKeys[tagKeysCount].Replace("/", ""),
  777. recordFields[index].Tags[tags].Tag.ToString((IFormatProvider)null).Replace("/", ""));
  778. Assert.AreEqual(expectedHeaderTagsValues[tagValuesCount].Replace("/", ""),
  779. recordFields[index].Tags[tags].Value.ToString((IFormatProvider)null).Replace("/", "").Replace("\r", "").Replace("\n", ""));
  780. tagKeysCount++;
  781. tagValuesCount++;
  782. }
  783. }
  784. }
  785. /// <summary>
  786. /// Validate formatted BAM file.
  787. /// </summary>
  788. /// <param name="nodeName">Different xml nodes used for different test cases</param>
  789. /// <param name="BAMParserPam">BAM Format method parameters</param>
  790. void ValidateBAMFormatter(string nodeName,
  791. BAMParserParameters BAMParserPam)
  792. {
  793. // Get input and output values from xml node.
  794. string bamFilePath = utilityObj.xmlUtil.GetTextValue(nodeName,
  795. Constants.FilePathNode);
  796. string expectedAlignedSeqFilePath = utilityObj.xmlUtil.GetTextValue(
  797. nodeName, Constants.ExpectedSequence);
  798. string alignedSeqCount = utilityObj.xmlUtil.GetTextValue(
  799. nodeName, Constants.AlignedSeqCountNode);
  800. Stream stream = null;
  801. SequenceAlignmentMap seqAlignment = null;
  802. using (BAMParser bamParserObj = new BAMParser())
  803. {
  804. // Parse a BAM file.
  805. seqAlignment = bamParserObj.Parse(bamFilePath);
  806. // Create a BAM formatter object.
  807. BAMFormatter formatterObj = new BAMFormatter();
  808. // Write/Format aligned sequences to BAM file.
  809. switch (BAMParserPam)
  810. {
  811. case BAMParserParameters.StreamWriter:
  812. using (stream = new
  813. FileStream(Constants.BAMTempFileName,
  814. FileMode.Create, FileAccess.Write))
  815. {
  816. formatterObj.Format(seqAlignment, stream);
  817. }
  818. break;
  819. case BAMParserParameters.FileName:
  820. formatterObj.Format(seqAlignment, Constants.BAMTempFileName);
  821. break;
  822. case BAMParserParameters.IndexFile:
  823. formatterObj.Format(seqAlignment, Constants.BAMTempFileName,
  824. Constants.BAMTempIndexFile);
  825. File.Exists(Constants.BAMTempIndexFile);
  826. break;
  827. default:
  828. break;
  829. }
  830. // Parse formatted BAM file and validate aligned sequences.
  831. SequenceAlignmentMap expectedSeqAlignmentMap = bamParserObj.Parse(
  832. Constants.BAMTempFileName);
  833. // Validate Parsed BAM file Header record fileds.
  834. ValidateBAMHeaderRecords(nodeName, expectedSeqAlignmentMap);
  835. IList<SAMAlignedSequence> alignedSeqs = expectedSeqAlignmentMap.QuerySequences;
  836. Assert.AreEqual(alignedSeqCount, alignedSeqs.Count.ToString((IFormatProvider)null));
  837. // Get expected sequences
  838. using (FastAParser parserObj = new FastAParser(expectedAlignedSeqFilePath))
  839. {
  840. IEnumerable<ISequence> expectedSequences = parserObj.Parse();
  841. IList<ISequence> expectedSequencesList = expectedSequences.ToList();
  842. // Validate aligned sequences from BAM file.
  843. for (int index = 0; index < alignedSeqs.Count; index++)
  844. {
  845. Assert.AreEqual(
  846. new string(expectedSequencesList[index].Select(a => (char)a).ToArray()),
  847. new string(alignedSeqs[index].QuerySequence.Select(a => (char)a).ToArray()));
  848. // Log to VSTest GUI.
  849. ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
  850. "BAM Formatter BVT : Validated Aligned sequence :{0} successfully",
  851. alignedSeqs[index].QuerySequence.ToString()));
  852. Console.WriteLine(string.Format((IFormatProvider)null,
  853. "BAM Formatter BVT : Validated the aligned sequence :{0} successfully",
  854. alignedSeqs[index].QuerySequence.ToString()));
  855. }
  856. }
  857. }
  858. File.Delete(Constants.BAMTempFileName);
  859. File.Delete(Constants.BAMTempIndexFile);
  860. }
  861. /// <summary>
  862. /// Comapare Sequence Alignment Header fields
  863. /// </summary>
  864. /// <param name="actualAlignment">Actual sequence alignment object</param>
  865. /// <param name="expectedAlignment">Expected sequence alignment object</param>
  866. /// <returns></returns>
  867. private static bool CompareSequencedAlignmentHeader(SequenceAlignmentMap actualAlignment,
  868. SequenceAlignmentMap expectedAlignment)
  869. {
  870. SAMAlignmentHeader aheader = actualAlignment.Header;
  871. IList<SAMRecordField> arecordFields = aheader.RecordFields;
  872. SAMAlignmentHeader expectedheader = expectedAlignment.Header;
  873. IList<SAMRecordField> expectedrecordFields = expectedheader.RecordFields;
  874. int tagKeysCount = 0;
  875. int tagValuesCount = 0;
  876. for (int index = 0; index < expectedrecordFields.Count; index++)
  877. {
  878. if (0 != string.Compare(expectedrecordFields[index].Typecode.ToString((IFormatProvider)null),
  879. arecordFields[index].Typecode.ToString((IFormatProvider)null), StringComparison.CurrentCulture))
  880. {
  881. return false;
  882. }
  883. for (int tags = 0; tags < expectedrecordFields[index].Tags.Count; tags++)
  884. {
  885. if ((0 != string.Compare(expectedrecordFields[index].Tags[tags].Tag.ToString((IFormatProvider)null),
  886. arecordFields[index].Tags[tags].Tag.ToString((IFormatProvider)null), StringComparison.CurrentCulture))
  887. || (0 != string.Compare(expectedrecordFields[index].Tags[tags].Value.ToString((IFormatProvider)null),
  888. arecordFields[index].Tags[tags].Value.ToString((IFormatProvider)null), StringComparison.CurrentCulture)))
  889. {
  890. Console.WriteLine(string.Format((IFormatProvider)null,
  891. "BAM Parser BVT : Sequence alignment header does not match"));
  892. ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
  893. "BAM Parser BVT : Sequence alignment header does not match"));
  894. return false;
  895. }
  896. tagKeysCount++;
  897. tagValuesCount++;
  898. }
  899. }
  900. return true;
  901. }
  902. /// <summary>
  903. /// Compare BAM file aligned sequences.
  904. /// </summary>
  905. /// <param name="expectedAlignment">Expected sequence alignment object</param>
  906. /// <param name="actualAlignment">Actual sequence alignment object</param>
  907. /// <returns></returns>
  908. private static bool CompareAlignedSequences(SequenceAlignmentMap expectedAlignment,
  909. SequenceAlignmentMap actualAlignment)
  910. {
  911. IList<SAMAlignedSequence> actualAlignedSeqs = actualAlignment.QuerySequences;
  912. IList<SAMAlignedSequence> expectedAlignedSeqs = expectedAlignment.QuerySequences;
  913. for (int i = 0; i < expectedAlignedSeqs.Count; i++)
  914. {
  915. if (0 != string.Compare(new string(expectedAlignedSeqs.ElementAt(i).QuerySequence.Select(a => (char)a).ToArray()),
  916. new string(actualAlignedSeqs[i].QuerySequence.Select(a => (char)a).ToArray()),
  917. true, CultureInfo.CurrentCulture))
  918. {
  919. Console.WriteLine(string.Format((IFormatProvider)null,
  920. "BAM Parser BVT : Sequence alignment aligned seq does not match"));
  921. ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
  922. "BAM Parser BVT : Sequence alignment aligned seq does match"));
  923. return false;
  924. }
  925. }
  926. return true;
  927. }
  928. /// <summary>
  929. /// Validate GetPaired method
  930. /// </summary>
  931. /// <param name="nodeName">XML node name</param>
  932. /// <param name="pams">GetPairedReads method parameters</param>
  933. void ValidatePairedReads(string nodeName, GetPairedReadParameters pams)
  934. {
  935. // Get input and output values from xml node.
  936. string bamFilePath = utilityObj.xmlUtil.GetTextValue(nodeName,
  937. Constants.FilePathNode);
  938. string expectedAlignedSeqFilePath = utilityObj.xmlUtil.GetTextValue(
  939. nodeName, Constants.ExpectedSequence);
  940. string mean = utilityObj.xmlUtil.GetTextValue(
  941. nodeName, Constants.MeanNode);
  942. string deviation = utilityObj.xmlUtil.GetTextValue(
  943. nodeName, Constants.DeviationValueNode);
  944. string library = utilityObj.xmlUtil.GetTextValue(
  945. nodeName, Constants.LibraryNameNode);
  946. string pairedReadsCount = utilityObj.xmlUtil.GetTextValue(
  947. nodeName, Constants.PairedReadsNode);
  948. string[] insertLength = utilityObj.xmlUtil.GetTextValue(
  949. nodeName, Constants.InsertLengthNode).Split(',');
  950. string[] pairedReadType = utilityObj.xmlUtil.GetTextValue(
  951. nodeName, Constants.PairedReadTypeNode).Split(',');
  952. SequenceAlignmentMap seqAlignment = null;
  953. IList<PairedRead> pairedReads = null;
  954. BAMParser bamParser = new BAMParser();
  955. FastAParser parserObj = new FastAParser(expectedAlignedSeqFilePath);
  956. try
  957. {
  958. seqAlignment = bamParser.Parse(bamFilePath);
  959. IEnumerable<ISequence> expectedSequences = parserObj.Parse();
  960. switch (pams)
  961. {
  962. case GetPairedReadParameters.GetPairedReadWithParameters:
  963. pairedReads = seqAlignment.GetPairedReads(float.Parse(mean, (IFormatProvider)null),
  964. float.Parse(deviation, (IFormatProvider)null));
  965. break;
  966. case GetPairedReadParameters.GetPairedReadWithLibraryName:
  967. pairedReads = seqAlignment.GetPairedReads(library);
  968. break;
  969. case GetPairedReadParameters.GetPairedReadWithCloneLibraryInfo:
  970. CloneLibraryInformation libraryInfo =
  971. CloneLibrary.Instance.GetLibraryInformation(library);
  972. pairedReads = seqAlignment.GetPairedReads(libraryInfo);
  973. break;
  974. case GetPairedReadParameters.Default:
  975. pairedReads = seqAlignment.GetPairedReads();
  976. break;
  977. }
  978. Assert.AreEqual(pairedReadsCount, pairedReads.Count.ToString((IFormatProvider)null));
  979. int i = 0;
  980. foreach (PairedRead read in pairedReads)
  981. {
  982. Assert.AreEqual(insertLength[i], read.InsertLength.ToString((IFormatProvider)null));
  983. Assert.AreEqual(pairedReadType[i], read.PairedType.ToString());
  984. foreach (SAMAlignedSequence seq in read.Reads)
  985. {
  986. Assert.AreEqual(new string(expectedSequences.ElementAt(i).Select(a => (char)a).ToArray()),
  987. new string(seq.QuerySequence.Select(a => (char)a).ToArray()));
  988. // Log to VSTest GUI.
  989. ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
  990. "BAM Parser BVT : Validated Paired read :{0} successfully",
  991. seq.QuerySequence.ToString()));
  992. }
  993. i++;
  994. }
  995. }
  996. finally
  997. {
  998. bamParser.Dispose();
  999. }
  1000. }
  1001. /// <summary>
  1002. /// Validate different paired read types
  1003. /// </summary>
  1004. /// <param name="nodeName">XML node name</param>
  1005. /// <param name="pams">GetPairedReadTypes method parameters</param>
  1006. void ValidatePairedReadTypes(string nodeName, GetPairedReadTypeParameters pams)
  1007. {
  1008. // Get input and output values from xml node.
  1009. string bamFilePath = utilityObj.xmlUtil.GetTextValue(nodeName,
  1010. Constants.FilePathNode);
  1011. string mean = utilityObj.xmlUtil.GetTextValue(
  1012. nodeName, Constants.MeanNode);
  1013. string deviation = utilityObj.xmlUtil.GetTextValue(
  1014. nodeName, Constants.DeviationValueNode);
  1015. string library = utilityObj.xmlUtil.GetTextValue(
  1016. nodeName, Constants.LibraryNameNode);
  1017. string[] pairedReadType = utilityObj.xmlUtil.GetTextValue(
  1018. nodeName, Constants.PairedReadTypeNode).Split(',');
  1019. string[] insertLength = utilityObj.xmlUtil.GetTextValue(
  1020. nodeName, Constants.InsertLengthNode).Split(',');
  1021. IList<PairedRead> pairedReads = null;
  1022. BAMParser bamParser = new BAMParser();
  1023. SequenceAlignmentMap seqAlignmentMapObj = bamParser.Parse(bamFilePath);
  1024. CloneLibrary

Large files files are truncated, but you can click here to view the full file