Пример #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 Translation(CdnaCoordinateMap codingRegion, CompactId proteinId, byte proteinVersion, string peptideSeq)
 {
     CodingRegion   = codingRegion;
     ProteinId      = proteinId;
     ProteinVersion = proteinVersion;
     PeptideSeq     = peptideSeq;
 }
Пример #3
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]));
        }
Пример #4
0
 /// <summary>
 /// constructor
 /// </summary>
 public Gene(ushort referenceIndex, int start, int end, bool onReverseStrand, string symbol, int hgncId,
             CompactId entrezGeneId, CompactId ensemblId, int mimNumber) : base(referenceIndex, start, end)
 {
     OnReverseStrand = onReverseStrand;
     Symbol          = symbol;
     _hgncId         = hgncId;
     EntrezGeneId    = entrezGeneId;
     EnsemblId       = ensemblId;
     _mimNumber      = mimNumber;
 }
Пример #5
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));
        }
Пример #6
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));
        }
Пример #7
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);
 }
Пример #8
0
 /// <summary>
 /// constructor
 /// </summary>
 public RegulatoryElement(ushort referenceIndex, int start, int end, CompactId id, RegulatoryElementType type)
     : base(referenceIndex, start, end)
 {
     Id   = id;
     Type = type;
 }