/// <summary> /// constructor /// </summary> public PredictionCacheStaging(PredictionCacheHeader header, Prediction.Entry[] lut, Prediction[][] predictionsPerRef) { _header = header; _lookupTable = lut; _predictionsPerRef = predictionsPerRef; }
public void Convert(string outputPath, string description, GlobalImportCommon.FileType fileType) { var inputPath = outputPath.Replace(".dat", ".dat.tmp"); using (var reader = new TempPredictionReader(inputPath, description, fileType)) { Console.Write($"- loading {description}... "); var tempPredictions = Load(reader); Console.WriteLine("finished."); Console.Write($"- creating {description} LUT... "); var oldLut = TempPrediction.CreateLookupTable(tempPredictions); var newLut = TempPrediction.ConvertLookupTable(oldLut); Console.WriteLine("finished."); Console.Write($"- converting {description} matrices... "); var predictionsPerRef = TempPrediction.ConvertMatrices(tempPredictions, oldLut, newLut, _numReferenceSeqs); Console.WriteLine("finished."); tempPredictions.Clear(); var header = PredictionCacheHeader.GetHeader(CurrentTimeTicks, reader.Header.GenomeAssembly, _numReferenceSeqs); Console.Write($"- writing to {Path.GetFileName(outputPath)}... "); using (var writer = new PredictionCacheWriter(outputPath, header)) { writer.Write(newLut, predictionsPerRef); } Console.WriteLine("finished."); } }
private static PredictionCacheStaging GetStagingWithPredictionIndices(PredictionCache cache, bool useSift, List <TranscriptPacket> packets, int numRefSeqs) { var predictionsPerRef = new Prediction[numRefSeqs][]; for (ushort refIndex = 0; refIndex < numRefSeqs; refIndex++) { predictionsPerRef[refIndex] = GetPredictions(packets, useSift, refIndex); } var header = PredictionCacheHeader.GetHeader(cache.Header.CreationTimeTicks, cache.Header.GenomeAssembly, numRefSeqs); return(new PredictionCacheStaging(header, cache.LookupTable, predictionsPerRef)); }
private void CombinePredictionsCaches() { Console.WriteLine("Writing combined Sift..."); var mergedSift = GetMergedPredictions(CacheConstants.SiftPath(_prefix1), CacheConstants.SiftPath(_prefix2)); using (var writer = new PredictionCacheWriter(CacheConstants.SiftPath(_outPrefix), PredictionCacheHeader.GetHeader(DateTime.Now.Ticks, _genomeAssembly, _numRefSeq))) { var lookupTableList = new List <Prediction.Entry>(); foreach (var predictionCach in mergedSift) { lookupTableList.AddRange(predictionCach.LookupTable); } writer.Write(lookupTableList.ToArray(), mergedSift.Select(cache => cache.Predictions).ToArray()); } Console.WriteLine("Done."); Console.WriteLine("writing combined polyphen"); var mergedPolyphen = GetMergedPredictions(CacheConstants.PolyPhenPath(_prefix1), CacheConstants.PolyPhenPath(_prefix2)); using (var writer = new PredictionCacheWriter(CacheConstants.PolyPhenPath(_outPrefix), PredictionCacheHeader.GetHeader(DateTime.Now.Ticks, _genomeAssembly, _numRefSeq))) { var lookupTableList = new List <Prediction.Entry>(); foreach (var predictionCach in mergedPolyphen) { lookupTableList.AddRange(predictionCach.LookupTable); } writer.Write(lookupTableList.ToArray(), mergedPolyphen.Select(cache => cache.Predictions).ToArray()); } Console.WriteLine("Done"); }