Beispiel #1
0
        /// <summary>
        /// reads the transcript from the binary reader
        /// </summary>
        public static Transcript Read(ExtendedBinaryReader reader, Gene[] cacheGenes, SimpleInterval[] cacheIntrons,
                                      SimpleInterval[] cacheMirnas, string[] cachePeptideSeqs)
        {
            // transcript
            var referenceIndex = reader.ReadUInt16();
            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 = new EncodedTranscriptData(reader.ReadUInt16(), reader.ReadByte());

            // exons & introns
            var introns  = encoded.HasIntrons  ? ReadIndices(reader, cacheIntrons) : null;
            var cdnaMaps = encoded.HasCdnaMaps ? ReadCdnaMaps(reader)              : null;

            // protein function predictions
            int siftIndex     = encoded.HasSift     ? reader.ReadOptInt32() : -1;
            int polyphenIndex = encoded.HasPolyPhen ? reader.ReadOptInt32() : -1;

            // translation
            var translation = encoded.HasTranslation ? Translation.Read(reader, cachePeptideSeqs) : null;

            // attributes
            var mirnas = encoded.HasMirnas ? ReadIndices(reader, cacheMirnas) : null;

            return(new Transcript(referenceIndex, start, end, id, encoded.Version, translation, encoded.BioType,
                                  gene, TranscriptUtilities.GetTotalExonLength(cdnaMaps), encoded.StartExonPhase, encoded.IsCanonical,
                                  introns, mirnas, cdnaMaps, siftIndex, polyphenIndex, encoded.TranscriptSource));
        }
Beispiel #2
0
        /// <summary>
        /// reads the translation from the binary writer
        /// </summary>
        public static Translation Read(ExtendedBinaryReader reader, string[] peptideSeqs)
        {
            var codingRegion   = CdnaCoordinateMap.Read(reader);
            var proteinId      = CompactId.Read(reader);
            var proteinVersion = reader.ReadByte();
            var peptideIndex   = reader.ReadOptInt32();

            return(new Translation(codingRegion, proteinId, proteinVersion, peptideSeqs[peptideIndex]));
        }
Beispiel #3
0
        /// <summary>
        /// reads the regulatory element data from the binary reader
        /// </summary>
        public static RegulatoryElement Read(ExtendedBinaryReader reader)
        {
            var referenceIndex = reader.ReadUInt16();
            int start          = reader.ReadOptInt32();
            int end            = reader.ReadOptInt32();
            var type           = (RegulatoryElementType)reader.ReadByte();
            var id             = CompactId.Read(reader);

            return(new RegulatoryElement(referenceIndex, start, end, id, type));
        }
Beispiel #4
0
        /// <summary>
        /// reads the gene data from the binary reader
        /// </summary>
        public static Gene Read(ExtendedBinaryReader reader)
        {
            ushort referenceIndex  = reader.ReadUInt16();
            int    start           = reader.ReadOptInt32();
            int    end             = reader.ReadOptInt32();
            bool   onReverseStrand = reader.ReadBoolean();
            string symbol          = reader.ReadAsciiString();
            int    hgncId          = reader.ReadOptInt32();
            var    entrezId        = CompactId.Read(reader);
            var    ensemblId       = CompactId.Read(reader);
            int    mimNumber       = reader.ReadOptInt32();

            return(new Gene(referenceIndex, start, end, onReverseStrand, symbol, hgncId, entrezId, ensemblId, mimNumber));
        }