/// <summary> /// Constructor to initialize an instance of BAMSortedIndex class with specified filename. /// </summary> /// <param name="filename">Sorted filename.</param> /// <param name="sortType">Type of sort required.</param> public BAMSortedIndex(string filename, BAMSortByFields sortType) { sortedFilenames = new List <string> { filename }; sortField = sortType; }
/// <summary> /// Default Constructor /// Initializes a new instance of the BAMSorter class /// </summary> /// <param name="seqAlignMap">SequenceAlignmentMap object to be sorted.</param> /// <param name="sortType">Type of sort required.</param> public BAMSort(SequenceAlignmentMap seqAlignMap, BAMSortByFields sortType) { sequenceAlignMap = seqAlignMap; sortField = sortType; }
/// <summary> /// Sort Sequence Alignments. /// </summary> /// <param name="map">SAM object to be sorted.</param> /// <param name="bAMSortType">Sort based on genomic coordinates or read name.</param> /// <returns></returns> private IList <BAMSortedIndex> Sort(SequenceAlignmentMap map, BAMSortByFields bAMSortType) { BAMSort sort = new BAMSort(map, bAMSortType); return(sort.Sort()); }
/// <summary> /// Checks if the BAMSorted Index is sorted /// </summary> /// <param name="sortedIndex">The BAMSortedIndex that needs to be checked for proper sorting</param> /// <param name="sortType">The sort type to be used when sorting using BAMSort</param> /// <returns>true if properly sorted</returns> private bool IsSortedIndex(IList<BAMSortedIndex> sortedIndex, BAMSortByFields sortType) { bool isSorted = true; string matchFile1 = this.utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode, Constants.MediumSizeBAMSortOutputMatchReadNames); string matchFile2 = this.utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode, Constants .MediumSizeBAMSortOutputMatchChromosomeCoordinates); string matchFile3 = this.utilityObj.xmlUtil.GetTextValue(Constants.MediumSizeBAMFileNode, Constants .MediumSizeBAMSortOutputMatchChromosomeNameAndCoordinates); string temp = string.Empty; switch (sortType) { case BAMSortByFields.ReadNames: temp = File.ReadAllText(matchFile1); Assert.AreEqual(temp, this.getSortedOutput(sortedIndex)); break; case BAMSortByFields.ChromosomeCoordinates: temp = File.ReadAllText(matchFile2); Assert.AreEqual(temp, this.getSortedOutput(sortedIndex)); break; case BAMSortByFields.ChromosomeNameAndCoordinates: temp = File.ReadAllText(matchFile3); Assert.AreEqual(temp, this.getSortedOutput(sortedIndex)); break; default: break; } return isSorted; }
/// <summary> /// calls the Sort() method in BAMSort and checks if a BAMSortedIndex is returned. /// </summary> /// <param name="seqAlignment">SequenceAlignmentMap to be sorted</param> /// <param name="sortType">The sort type to be used when sorting using BAMSort</param> private void ValidateSort(SequenceAlignmentMap seqAlignment, BAMSortByFields sortType) { var sorter = new BAMSort(seqAlignment, sortType); IList<BAMSortedIndex> sortedIndex = sorter.Sort(); Assert.IsNotNull(sortedIndex); Assert.IsTrue(this.IsSortedIndex(sortedIndex, sortType)); }
/// <summary> /// Constructor to initialize an instance of BAMSortedIndex class with specified list of filenames. /// </summary> /// <param name="filenames">Sorted filenames.</param> /// <param name="sortType">Type of sort required.</param> public BAMSortedIndex(IList <string> filenames, BAMSortByFields sortType) { sortedFilenames = filenames; sortField = sortType; }
/// <summary> /// Sort Sequence Alignments. /// </summary> /// <param name="map">SAM object to be sorted.</param> /// <param name="bAMSortType">Sort based on genomic coordinates or read name.</param> /// <returns></returns> private IList<BAMSortedIndex> Sort(SequenceAlignmentMap map, BAMSortByFields bAMSortType) { BAMSort sort = new BAMSort(map, bAMSortType); return sort.Sort(); }
/// <summary> /// Constructor to initialize an instance of BAMSortedIndex class with specified filename. /// </summary> /// <param name="filename">Sorted filename.</param> /// <param name="sortType">Type of sort required.</param> public BAMSortedIndex(string filename, BAMSortByFields sortType) { _filenames = new List <string>(); _filenames.Add(filename); _sortType = sortType; }
/// <summary> /// Constructor to initialize an instance of BAMSortedIndex class with specified list of filenames. /// </summary> /// <param name="filenames">Sorted filenames.</param> /// <param name="sortType">Type of sort required.</param> public BAMSortedIndex(IList <string> filenames, BAMSortByFields sortType) { _filenames = filenames; _sortType = sortType; }