public static ITranscriptRegion Read(BufferedBinaryReader reader) { TranscriptRegionType type = (TranscriptRegionType)reader.ReadByte(); ushort id = reader.ReadOptUInt16(); int genomicStart = reader.ReadOptInt32(); int genomicEnd = reader.ReadOptInt32(); int cdnaStart = reader.ReadOptInt32(); int cdnaEnd = reader.ReadOptInt32(); return(new TranscriptRegion(type, id, genomicStart, genomicEnd, cdnaStart, cdnaEnd)); }
public static ITranscript Read(BufferedBinaryReader reader, IDictionary <ushort, IChromosome> chromosomeIndexDictionary, IGene[] cacheGenes, ITranscriptRegion[] cacheTranscriptRegions, IInterval[] cacheMirnas, string[] cachePeptideSeqs) { // transcript var referenceIndex = reader.ReadOptUInt16(); var start = reader.ReadOptInt32(); var end = reader.ReadOptInt32(); var id = CompactId.Read(reader); // gene var geneIndex = reader.ReadOptInt32(); var gene = cacheGenes[geneIndex]; // encoded data var encoded = EncodedTranscriptData.Read(reader); // transcript regions var transcriptRegions = encoded.HasTranscriptRegions ? ReadIndices(reader, cacheTranscriptRegions) : null; ushort numExons = reader.ReadOptUInt16(); // protein function predictions int siftIndex = encoded.HasSift ? reader.ReadOptInt32() : -1; int polyphenIndex = encoded.HasPolyPhen ? reader.ReadOptInt32() : -1; // translation var translation = encoded.HasTranslation ? DataStructures.Translation.Read(reader, cachePeptideSeqs) : null; // attributes var mirnas = encoded.HasMirnas ? ReadIndices(reader, cacheMirnas) : null; var rnaEdits = encoded.HasRnaEdits ? ReadItems(reader, RnaEdit.Read) : null; var selenocysteines = encoded.HasSelenocysteines ? ReadItems(reader, x => x.ReadOptInt32()) : null; return(new Transcript(chromosomeIndexDictionary[referenceIndex], start, end, id, translation, encoded.BioType, gene, ExonUtilities.GetTotalExonLength(transcriptRegions), encoded.StartExonPhase, encoded.IsCanonical, transcriptRegions, numExons, mirnas, siftIndex, polyphenIndex, encoded.TranscriptSource, encoded.CdsStartNotFound, encoded.CdsEndNotFound, selenocysteines, rnaEdits)); }