Beispiel #1
0
        private MutableTranscript GetNextTranscript()
        {
            string line = _reader.ReadLine();

            if (line == null)
            {
                return(null);
            }

            var transcriptInfo  = ReadTranscriptInfo(line);
            var gene            = ReadGene(transcriptInfo.Chromosome);
            var translation     = ReadTranslation();
            var exons           = ReadExons(transcriptInfo.Chromosome);
            var introns         = ReadIntervals("Introns");
            var cdnaMaps        = ReadCdnaMaps();
            var mirnas          = ReadIntervals("miRNAs");
            var selenocysteines = ReadSelenocysteines();
            var rnaEdits        = ReadRnaEdits();

            var transcript = new MutableTranscript(transcriptInfo.Chromosome, transcriptInfo.Start, transcriptInfo.End,
                                                   transcriptInfo.Id, transcriptInfo.Version, transcriptInfo.CcdsId, transcriptInfo.RefSeqId,
                                                   transcriptInfo.BioType, transcriptInfo.IsCanonical, translation.CodingRegion, translation.Id,
                                                   translation.Version, translation.PeptideSeq, transcriptInfo.Source, gene, exons,
                                                   transcriptInfo.StartExonPhase, transcriptInfo.TotalExonLength, introns, cdnaMaps, null, null,
                                                   transcriptInfo.TranslateableSequence, mirnas, transcriptInfo.CdsStartNotFound,
                                                   transcriptInfo.CdsEndNotFound, selenocysteines, rnaEdits, transcriptInfo.BamEditStatus);

            AddMutableContents(transcript);

            return(transcript);
        }
Beispiel #2
0
 internal void Write(MutableTranscript transcript)
 {
     WriteTranscriptInfo(transcript);
     WriteGene(_writer, transcript.Gene);
     WriteTranslation(transcript.CodingRegion, transcript.ProteinId, transcript.ProteinVersion, transcript.PeptideSequence);
     WriteExons(transcript.Exons);
     WriteIntervals(transcript.Introns, "Introns");
     WriteCdnaMaps(transcript.CdnaMaps);
     WriteIntervals(transcript.MicroRnas, "miRNAs");
     WriteSelenocysteines(transcript.SelenocysteinePositions);
     WriteRnaEdits(transcript.RnaEdits);
 }
Beispiel #3
0
        private static ITranscript ToTranscript(this MutableTranscript mt)
        {
            var translation = mt.CodingRegion == null
                ? null
                : GetTranslation(mt.CodingRegion, mt.CdsLength, CompactId.Convert(mt.ProteinId, mt.ProteinVersion),
                                 mt.PeptideSequence);

            var sortedMicroRnas = mt.MicroRnas?.OrderBy(x => x.Start).ToArray();

            return(new Transcript(mt.Chromosome, mt.Start, mt.End, CompactId.Convert(mt.Id, mt.Version), translation,
                                  mt.BioType, mt.UpdatedGene, mt.TotalExonLength, mt.NewStartExonPhase, mt.IsCanonical,
                                  mt.TranscriptRegions, (ushort)mt.Exons.Length, sortedMicroRnas, mt.SiftIndex, mt.PolyPhenIndex,
                                  mt.Source, mt.CdsStartNotFound, mt.CdsEndNotFound, mt.SelenocysteinePositions, mt.RnaEdits));
        }
Beispiel #4
0
        private void AddMutableContents(MutableTranscript mt)
        {
            mt.TranscriptRegions = TranscriptRegionMerger.GetTranscriptRegions(mt.CdnaMaps, mt.Exons, mt.Introns, mt.Gene.OnReverseStrand);
            TranscriptRegionValidater.Validate(mt.Id, mt.CdnaMaps, mt.Exons, mt.Introns, mt.TranscriptRegions);

            mt.NewStartExonPhase = mt.StartExonPhase < 0 ? (byte)0 : (byte)mt.StartExonPhase;

            if (mt.CodingRegion == null)
            {
                return;
            }

            var codingSequence = new CodingSequence(_sequence, mt.CodingRegion, mt.TranscriptRegions,
                                                    mt.Gene.OnReverseStrand, mt.NewStartExonPhase, mt.RnaEdits);

            mt.CdsLength = codingSequence.GetCodingSequence().Length;

            mt.CodingRegion = new CodingRegion(mt.CodingRegion.Start, mt.CodingRegion.End,
                                               mt.CodingRegion.CdnaStart, mt.CodingRegion.CdnaEnd, mt.CdsLength);
        }
Beispiel #5
0
 private void WriteTranscriptInfo(MutableTranscript transcript)
 {
     _writer.WriteLine($"Transcript\t{transcript.Id}\t{transcript.Version}\t{transcript.Chromosome.UcscName}\t{transcript.Chromosome.Index}\t{transcript.Start}\t{transcript.End}\t{transcript.BioType}\t{(byte)transcript.BioType}\t{BoolToChar(transcript.IsCanonical)}\t{transcript.TotalExonLength}\t{transcript.CcdsId}\t{transcript.RefSeqId}\t{(byte)transcript.Source}\t{BoolToChar(transcript.CdsStartNotFound)}\t{BoolToChar(transcript.CdsEndNotFound)}\t{transcript.StartExonPhase}\t{transcript.BamEditStatus}");
     _writer.WriteLine(transcript.TranslateableSequence);
 }
 public bool Pass(MutableTranscript transcript) => _whitelist.Any(prefix => transcript.Id.StartsWith(prefix)) && !transcript.Id.Contains("dupl");