Exemple #1
0
        private static void WriteGeneralAttributes(TextWriter writer, Transcript transcript)
        {
            var geneId = transcript.TranscriptSource == TranscriptDataSource.Ensembl
                ? transcript.Gene.EnsemblId.ToString()
                : transcript.Gene.EntrezGeneId.ToString();

            if (!string.IsNullOrEmpty(geneId))
            {
                writer.Write($"gene_id \"{geneId}\"; ");
            }
            if (!string.IsNullOrEmpty(transcript.Gene.Symbol))
            {
                writer.Write($"gene_name \"{transcript.Gene.Symbol}\"; ");
            }

            if (!transcript.Id.IsEmpty)
            {
                writer.Write($"transcript_id \"{FormatUtilities.CombineIdAndVersion(transcript.Id, transcript.Version)}\"; ");
            }
            writer.Write($"transcript_type \"{BioTypeUtilities.GetBiotypeDescription(transcript.BioType)}\"; ");

            if (transcript.IsCanonical)
            {
                writer.Write("tag \"canonical\"; ");
            }

            if (!string.IsNullOrEmpty(transcript.Translation?.ProteinId.ToString()))
            {
                writer.Write($"protein_id \"{FormatUtilities.CombineIdAndVersion(transcript.Translation.ProteinId, transcript.Translation.ProteinVersion)}\"; ");
            }
        }
        public void CombineIdAndVersion(string id, byte version, string expectedVersion)
        {
            var compactId       = CompactId.Convert(id);
            var observedVersion = FormatUtilities.CombineIdAndVersion(compactId, version);

            Assert.Equal(expectedVersion, observedVersion);
        }
Exemple #3
0
        /// <summary>
        /// constructor
        /// </summary>
        public HgvsCodingNomenclature(TranscriptAnnotation ta, Transcript transcript, VariantFeature variant,
                                      ICompressedSequence compressedSequence, bool isGenomicDuplicate)
        {
            _ta                 = ta;
            _transcript         = transcript;
            _variant            = variant;
            _compressedSequence = compressedSequence;
            _isGenomicDuplicate = isGenomicDuplicate;

            _sb = new StringBuilder();

            // get reference sequence strand
            var transcriptOnReverseStrand = transcript.Gene.OnReverseStrand;

            // this may be different to the input one for insertions/deletions
            var    altAllele = ta.AlternateAllele;
            string variationFeatureSequence = altAllele.AlternateAllele;

            // get the reverse complement of the vfs if needed
            if (transcriptOnReverseStrand)
            {
                variationFeatureSequence = SequenceUtilities.GetReverseComplement(variationFeatureSequence);
            }

            // calculate the reference start and end
            GetReferenceCoordinates(transcript, altAllele, out _hgvsStart, out _hgvsEnd);

            // decide event type from HGVS nomenclature
            _hgvsNotation = new HgvsNotation(ta.TranscriptReferenceAllele, variationFeatureSequence,
                                             FormatUtilities.CombineIdAndVersion(transcript.Id, transcript.Version), _hgvsStart, _hgvsEnd,
                                             _transcript.Translation != null);
        }
 public void CombineIdAndVersion()
 {
     const string expectedResult = "ENSG00000141510.7";
     var id = CompactId.Convert("ENSG00000141510");
     var observedResult = FormatUtilities.CombineIdAndVersion(id, 7);
     Assert.Equal(expectedResult, observedResult);
 }
        internal static string GetProteinId(Transcript transcript)
        {
            var translation = transcript.Translation;

            return(translation == null
                ? null
                : FormatUtilities.CombineIdAndVersion(translation.ProteinId, translation.ProteinVersion));
        }
        /// <summary>
        /// constructor
        /// </summary>
        public HgvsProteinNomenclature(VariantEffect variantEffect, TranscriptAnnotation ta, Transcript transcript,
                                       VariantFeature variant, ICompressedSequence compressedSequence, AminoAcids aminoAcids)
        {
            _variantEffect      = variantEffect;
            _ta                 = ta;
            _transcript         = transcript;
            _variant            = variant;
            _compressedSequence = compressedSequence;
            _aminoAcids         = aminoAcids;

            _hgvsNotation = new HgvsNotation(_ta.ReferenceAminoAcids, _ta.AlternateAminoAcids,
                                             FormatUtilities.CombineIdAndVersion(_transcript.Translation.ProteinId, _transcript.Translation.ProteinVersion),
                                             _ta.ProteinBegin, _ta.ProteinEnd);
        }
 internal static string GetTranscriptId(Transcript transcript)
 {
     return(FormatUtilities.CombineIdAndVersion(transcript.Id, transcript.Version));
 }