private void CreateMitoMapVarTsv(IReadOnlyList <string> mitoMapFileNames) { if (mitoMapFileNames.Count == 0 || mitoMapFileNames.Any(string.IsNullOrEmpty)) { return; } var benchMark = new Benchmark(); var rootDirectory = new FileInfo(mitoMapFileNames[0]).Directory; var version = DataSourceVersionReader.GetSourceVersion(Path.Combine(rootDirectory.ToString(), "mitoMapVar")); var sequenceProvider = new ReferenceSequenceProvider(FileUtilities.GetReadStream(_compressedReferencePath)); sequenceProvider.LoadChromosome(new Chromosome("chrM", "MT", 24)); var mitoMapVarReaders = new List <MitoMapVariantReader>(); foreach (var mitoMapFileName in mitoMapFileNames) { mitoMapVarReaders.Add(new MitoMapVariantReader(new FileInfo(mitoMapFileName), sequenceProvider)); } var mergedMitoMapVarItems = MitoMapVariantReader.MergeAndSort(mitoMapVarReaders); const string outputFilePrefix = InterimSaCommon.MitoMapTag; using (var writer = new MitoMapVarTsvWriter(version, _outputDirectory, outputFilePrefix, sequenceProvider)) TsvWriterUtilities.WriteSortedItems(mergedMitoMapVarItems, writer); var timeSpan = Benchmark.ToHumanReadable(benchMark.GetElapsedTime()); TsvWriterUtilities.WriteCompleteInfo(InterimSaCommon.MitoMapTag, version.Version, timeSpan); }
public void ParseLine_AsExpected(string line, string fileName, string expectedJsonString) { string jsonString = MitoMapVariantReader.ParseLine(line, fileName, SequenceProvider, VariantAligner, ChromosomeUtilities.ChrM, MitoMapInputDb) .FirstOrDefault() ?.GetJsonString(); Assert.Equal(expectedJsonString, jsonString); }
public void GetAltAllelesTests() { const string altAlleleString1 = "ACT"; const string altAlleleString2 = "ACT;AGT"; const string altAlleleString3 = "AKY"; const string altAlleleString4 = "ACT;AKY"; const string altAlleleString5 = "CNT;AKY"; Assert.Equal(new[] { "ACT" }, MitoMapVariantReader.GetAltAlleles(altAlleleString1)); Assert.Equal(new[] { "ACT", "AGT" }, MitoMapVariantReader.GetAltAlleles(altAlleleString2)); Assert.Equal(new[] { "AGC", "AGT", "ATC", "ATT" }, MitoMapVariantReader.GetAltAlleles(altAlleleString3)); Assert.Equal(new[] { "ACT", "AGC", "AGT", "ATC", "ATT" }, MitoMapVariantReader.GetAltAlleles(altAlleleString4)); Assert.Equal(new[] { "CNT", "AGC", "AGT", "ATC", "ATT" }, MitoMapVariantReader.GetAltAlleles(altAlleleString5)); }
public void GetNumFullLengthSequences_AsExpected(string field, string dataType, int numFullLengthSequences) { Assert.Equal(numFullLengthSequences, MitoMapVariantReader.GetNumFullLengthSequences(field, dataType)); }