public static IRnaEdit Read(BufferedBinaryReader reader) { int start = reader.ReadOptInt32(); int end = reader.ReadOptInt32(); string bases = reader.ReadAsciiString(); return(new RnaEdit(start, end, bases)); }
public static ICodingRegion Read(BufferedBinaryReader reader) { int genomicStart = reader.ReadOptInt32(); int genomicEnd = reader.ReadOptInt32(); int cdnaStart = reader.ReadOptInt32(); int cdnaEnd = reader.ReadOptInt32(); int length = reader.ReadOptInt32(); return(new CodingRegion(genomicStart, genomicEnd, cdnaStart, cdnaEnd, length)); }
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 ITranslation Read(BufferedBinaryReader reader, string[] peptideSeqs) { var codingRegion = DataStructures.CodingRegion.Read(reader); var proteinId = CompactId.Read(reader); var peptideIndex = reader.ReadOptInt32(); var peptideSeq = peptideIndex == -1 ? null : peptideSeqs[peptideIndex]; return(new Translation(codingRegion, proteinId, peptideSeq)); }
private static T[] ReadItems <T>(BufferedBinaryReader reader, Func <BufferedBinaryReader, T> readFunc) { int numItems = reader.ReadOptInt32(); var items = new T[numItems]; for (int i = 0; i < numItems; i++) { items[i] = readFunc(reader); } return(items); }
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)); }