Ejemplo n.º 1
0
        /// <summary>
        /// updates a transcript
        /// mini-cache filename example: ENST00000255416_chr1_Ensembl79.ndb
        /// </summary>
        public UpdateStatus Update(DataBundle bundle, string outputCacheDir, ushort desiredVepVersion, List <string> outputFiles)
        {
            var transcript = MiniCacheUtilities.GetDesiredTranscript(bundle, _transcriptId, RefIndex);

            if (transcript == null)
            {
                return(UpdateStatus.IdNotFound);
            }

            var packets = new List <TranscriptPacket> {
                new TranscriptPacket(transcript)
            };

            foreach (var packet in packets)
            {
                bundle.Load(packet.ReferenceIndex);

                packet.SiftPrediction = packet.Transcript.SiftIndex == -1
                    ? null
                    : bundle.SiftCache.Predictions[packet.Transcript.SiftIndex];

                packet.PolyPhenPrediction = packet.Transcript.PolyPhenIndex == -1
                    ? null
                    : bundle.PolyPhenCache.Predictions[packet.Transcript.PolyPhenIndex];
            }

            var numRefSeqs = bundle.Sequence.Renamer.NumRefSeqs;

            var sift     = PredictionUtilities.GetStaging(bundle, true, packets, numRefSeqs);
            var polyphen = PredictionUtilities.GetStaging(bundle, false, packets, numRefSeqs);

            PredictionUtilities.FixIndices(packets);

            var outputCache = MiniCacheUtilities.CreateCache(bundle.Cache.Header, packets);

            var outputStub = GetOutputStub(outputCacheDir, _transcriptId,
                                           bundle.Sequence.Renamer.UcscReferenceNames[transcript.ReferenceIndex], TranscriptDataSource,
                                           desiredVepVersion);

            MiniCacheUtilities.WriteTranscriptCache(outputCache, outputStub, outputFiles);
            MiniCacheUtilities.WritePredictionCaches(sift, polyphen, outputStub, outputFiles);
            MiniCacheUtilities.WriteBases(bundle, packets, outputStub, outputFiles);

            return(UpdateStatus.Current);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// updates a position
        /// mini-cache filename example: chr1_713044_755966_RefSeq79_pos.ndb
        /// </summary>
        public UpdateStatus Update(DataBundle bundle, string outputCacheDir, ushort desiredVepVersion, List <string> outputFiles)
        {
            bundle.Load(RefIndex);

            string vcfLine     = $"{bundle.Sequence.Renamer.UcscReferenceNames[RefIndex]}\t{_position}\t.\tC\t<CN0>\t100\tPASS\tEND={_endPosition};SVTYPE=CNV";
            var    transcripts = MiniCacheUtilities.GetTranscriptsByVcf(bundle, vcfLine);

            if (transcripts == null)
            {
                return(UpdateStatus.IdNotFound);
            }

            var packets = transcripts.Select(transcript => new TranscriptPacket(transcript)).ToList();

            foreach (var packet in packets)
            {
                bundle.Load(packet.ReferenceIndex);

                packet.SiftPrediction = packet.Transcript.SiftIndex == -1
                    ? null
                    : bundle.SiftCache.Predictions[packet.Transcript.SiftIndex];

                packet.PolyPhenPrediction = packet.Transcript.PolyPhenIndex == -1
                    ? null
                    : bundle.PolyPhenCache.Predictions[packet.Transcript.PolyPhenIndex];
            }

            var numRefSeqs = bundle.Sequence.Renamer.NumRefSeqs;

            var sift     = PredictionUtilities.GetStaging(bundle, true, packets, numRefSeqs);
            var polyphen = PredictionUtilities.GetStaging(bundle, false, packets, numRefSeqs);

            PredictionUtilities.FixIndices(packets);

            var outputCache = MiniCacheUtilities.CreateCache(bundle.Cache.Header, packets);

            var outputStub = GetOutputStub(outputCacheDir, bundle.Sequence.Renamer.UcscReferenceNames[RefIndex],
                                           _position, _endPosition, TranscriptDataSource, desiredVepVersion);

            MiniCacheUtilities.WriteTranscriptCache(outputCache, outputStub, outputFiles);
            MiniCacheUtilities.WritePredictionCaches(sift, polyphen, outputStub, outputFiles);
            MiniCacheUtilities.WriteBases(bundle, packets, outputStub, outputFiles);

            return(UpdateStatus.Current);
        }