Пример #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));
        }
Пример #2
0
 /// <summary>
 /// constructor
 /// </summary>
 public Transcript(ushort referenceIndex, int start, int end, CompactId id, byte version,
                   Translation translation, BioType bioType, Gene gene, int totalExonLength, byte startExonPhase,
                   bool isCanonical, SimpleInterval[] introns, SimpleInterval[] microRnas, CdnaCoordinateMap[] cdnaMaps,
                   int siftIndex, int polyPhenIndex, TranscriptDataSource transcriptSource) : base(referenceIndex, start, end)
 {
     Id               = id;
     Version          = version;
     Translation      = translation;
     BioType          = bioType;
     Gene             = gene;
     TotalExonLength  = totalExonLength;
     StartExonPhase   = startExonPhase;
     IsCanonical      = isCanonical;
     Introns          = introns;
     MicroRnas        = microRnas;
     CdnaMaps         = cdnaMaps;
     SiftIndex        = siftIndex;
     PolyPhenIndex    = polyPhenIndex;
     TranscriptSource = transcriptSource;
     TotalExonLength  = TranscriptUtilities.GetTotalExonLength(cdnaMaps);
 }