Пример #1
0
 public Transcript(IChromosome chromosome, int start, int end, ICompactId id, ITranslation translation,
                   BioType bioType, IGene gene, int totalExonLength, byte startExonPhase, bool isCanonical,
                   ITranscriptRegion[] transcriptRegions, ushort numExons, IInterval[] microRnas, int siftIndex,
                   int polyPhenIndex, Source source, bool cdsStartNotFound, bool cdsEndNotFound, int[] selenocysteines,
                   IRnaEdit[] rnaEdits)
 {
     Chromosome        = chromosome;
     Start             = start;
     End               = end;
     Id                = id;
     Translation       = translation;
     BioType           = bioType;
     Gene              = gene;
     TotalExonLength   = totalExonLength;
     StartExonPhase    = startExonPhase;
     IsCanonical       = isCanonical;
     TranscriptRegions = transcriptRegions;
     NumExons          = numExons;
     MicroRnas         = microRnas;
     SiftIndex         = siftIndex;
     PolyPhenIndex     = polyPhenIndex;
     Source            = source;
     CdsStartNotFound  = cdsStartNotFound;
     CdsEndNotFound    = cdsEndNotFound;
     Selenocysteines   = selenocysteines;
     RnaEdits          = rnaEdits;
 }
Пример #2
0
    /// <summary>
    /// 魚のリソースを読み込んでいます。
    /// このコードは処理が重いため、改修予定です。
    /// </summary>
    /// <param name="Type">魚の種類を指定します。</param>
    /// <param name="fish_name">魚の名前です。</param>
    /// <returns>読み込まれたリソースを返します。</returns>
    private GameObject LoadRecource(BioType type, string fish_name)
    {
        string[] folderName = { "Fish", "Leaf", "Accessory", "Terrain" };

        var str = "Prefub/" + folderName[(int)type] + "/" + fish_name;

        Debug.Log("Load : " + str);

        return(Resources.Load(str) as GameObject);
    }
Пример #3
0
        public static EncodedTranscriptData GetEncodedTranscriptData(BioType bioType, bool cdsStartNotFound,
                                                                     bool cdsEndNotFound, Source source, bool isCanonical, bool hasSift, bool hasPolyPhen, bool hasMicroRnas,
                                                                     bool hasRnaEdits, bool hasSelenocysteines, bool hasTranscriptRegions, bool hasTranslation,
                                                                     byte startExonPhase)
        {
            ushort info = (ushort)bioType;

            if (cdsStartNotFound)
            {
                info |= CdsStartNotFoundMask;
            }
            if (cdsEndNotFound)
            {
                info |= CdsEndNotFoundMask;
            }
            if (isCanonical)
            {
                info |= CanonicalMask;
            }
            if (hasRnaEdits)
            {
                info |= RnaEditsMask;
            }
            if (hasSelenocysteines)
            {
                info |= SelenocysteinesMask;
            }
            info |= (ushort)((ushort)source << TranscriptSourceShift);

            byte contents = startExonPhase;

            if (hasSift)
            {
                contents |= SiftMask;
            }
            if (hasPolyPhen)
            {
                contents |= PolyPhenMask;
            }
            if (hasMicroRnas)
            {
                contents |= MirnasMask;
            }
            if (hasTranscriptRegions)
            {
                contents |= TranscriptRegionsMask;
            }
            if (hasTranslation)
            {
                contents |= TranslationMask;
            }

            return(new EncodedTranscriptData(info, contents));
        }
Пример #4
0
 private static DataStructures.VEP.Transcript GetTranscript(BioType bioType, DataStructures.VEP.Transcript prev, DataStructures.VEP.Transcript curr)
 {
     if (prev.BioType == bioType)
     {
         return(prev);
     }
     if (curr.BioType == bioType)
     {
         return(curr);
     }
     return(null);
 }
        public void EncodedTranscriptData_EndToEnd()
        {
            const BioType expectedBiotype           = BioType.Y_RNA;
            const bool    expectedCdsStartNotFound  = true;
            const bool    expectedCdsEndNotFound    = true;
            const Source  expectedSource            = Source.BothRefSeqAndEnsembl;
            const bool    expectedCanonical         = true;
            const bool    expectedSift              = true;
            const bool    expectedPolyPhen          = true;
            const bool    expectedMirnas            = true;
            const bool    expectedRnaEdits          = true;
            const bool    expectedSelenocysteines   = true;
            const bool    expectedTranscriptRegions = true;
            const bool    expectedTranslation       = true;
            const byte    expectedStartExonPhase    = 3;

            // ReSharper disable ConditionIsAlwaysTrueOrFalse
            var encodedData = EncodedTranscriptData.GetEncodedTranscriptData(expectedBiotype, expectedCdsStartNotFound,
                                                                             expectedCdsEndNotFound, expectedSource, expectedCanonical, expectedSift, expectedPolyPhen,
                                                                             expectedMirnas, expectedRnaEdits, expectedSelenocysteines, expectedTranscriptRegions,
                                                                             expectedTranslation, expectedStartExonPhase);
            // ReSharper restore ConditionIsAlwaysTrueOrFalse

            EncodedTranscriptData observedEncodedTranscriptData;

            using (var ms = new MemoryStream())
            {
                using (var writer = new ExtendedBinaryWriter(ms, Encoding.UTF8, true))
                {
                    encodedData.Write(writer);
                }

                ms.Position = 0;

                using (var reader = new BufferedBinaryReader(ms))
                {
                    observedEncodedTranscriptData = EncodedTranscriptData.Read(reader);
                }
            }

            Assert.NotNull(observedEncodedTranscriptData);
            Assert.Equal(expectedBiotype, observedEncodedTranscriptData.BioType);
            Assert.Equal(expectedSource, observedEncodedTranscriptData.TranscriptSource);
            Assert.Equal(expectedCanonical, observedEncodedTranscriptData.IsCanonical);
            Assert.Equal(expectedSift, observedEncodedTranscriptData.HasSift);
            Assert.Equal(expectedPolyPhen, observedEncodedTranscriptData.HasPolyPhen);
            Assert.Equal(expectedMirnas, observedEncodedTranscriptData.HasMirnas);
            Assert.Equal(expectedTranscriptRegions, observedEncodedTranscriptData.HasTranscriptRegions);
            Assert.Equal(expectedTranslation, observedEncodedTranscriptData.HasTranslation);
            Assert.Equal(expectedStartExonPhase, observedEncodedTranscriptData.StartExonPhase);
        }
Пример #6
0
    /// <summary>
    /// 配列の値を初期化する
    /// </summary>
    /// <param name="fish">データを追加したい配列</param>
    /// <param name="type">設定する生体型</param>
    /// <param name="en">設定する英語名</param>
    /// <param name="jp">設定する日本語名</param>
    private void ArrayInit(ArrayList fish, BioType type, string[] en, string[] jp)
    {
        for (int i = 0; i < en.Length; i++)
        {
            BioData data = new BioData()
                           .SetType(type)
                           .SetNameEn(en[i])
                           .SetNameJp(jp[i]);
            fish.Add(data);
        }

        BioData blank    = new BioData().SetType(type);
        int     pageData = 8;
        int     fillSize = pageData - (en.Length % pageData);

        ArrayListUtil <BioData> .Fill(fish, blank, fillSize);
    }
Пример #7
0
    /// <summary>
    /// 魚のインスタンスを増やす関数です。
    /// </summary>
    /// <param name="type">魚の種類です</param>
    /// <param name="fish_name">魚の名前です</param>
    public void FishCreate(BioType type, string fish_name)
    {
        var frame1 = new System.Diagnostics.StackFrame(1);
        var frame0 = new System.Diagnostics.StackFrame(0);

        Debug.LogFormat(" {0} <= {1} : {2} ", frame0.GetMethod().Name, frame1.GetType().Name, frame1.GetMethod().Name);
        DictionaryFix(fish_name);
        Vector3    waterScale  = _water.transform.localScale;
        GameObject objResource = LoadRecource(type, fish_name);

        GameObject obj = GameObject.Instantiate(objResource);

        obj.transform.position = FirstPosition(waterScale);
        obj.transform.rotation = _firstDirection;

        obj.name = fish_name;
        _fishDictionary[fish_name].Push(obj);
    }
        /// <summary>
        /// 获取某多模态生物最大数量
        /// </summary>
        /// <param name="BioType">多模态生物类型</param>
        /// <returns></returns>
        public int GetMaxBioPhotoCount(BioType BioType)
        {
            int count = 0;

            if (string.IsNullOrEmpty(MaxMultiBioPhotoCount))
            {
                return(count);
            }

            string[] arr = MaxMultiBioPhotoCount.Split(':');
            if (arr.Length != 10 || (int)BioType >= arr.Length)
            {
                return(count);
            }

            count = Tools.TryConvertToInt32(arr[(int)BioType]);

            return(count);
        }
        /// <summary>
        /// 获取支持某多模态生物版本
        /// </summary>
        /// <param name="BioType">多模态生物类型</param>
        /// <returns></returns>
        public string GetBioVersion(BioType BioType)
        {
            string version = "";

            if (string.IsNullOrEmpty(MultiBioVersion))
            {
                return(version);
            }

            string[] arr = MultiBioVersion.Split(':');
            if (arr.Length != 10 || (int)BioType >= arr.Length)
            {
                return(version);
            }

            version = arr[(int)BioType];

            return(version);
        }
        /// <summary>
        /// 是否支持某多模态生物图片
        /// </summary>
        /// <param name="BioType">多模态生物类型</param>
        /// <returns></returns>
        public bool IsBioPhotoSupport(BioType BioType)
        {
            if (string.IsNullOrEmpty(MultiBioPhotoSupport))
            {
                return(false);
            }

            string[] arr = MultiBioDataSupport.Split(':');
            if (arr.Length != 10 || (int)BioType >= arr.Length)
            {
                return(false);
            }

            if (arr[(int)BioType] == "0" || arr[(int)BioType] == "")
            {
                return(false);
            }

            return(true);
        }
Пример #11
0
        public Transcript(BioType biotype, Exon[] transExons, Gene gene, Translation translation, VariantEffectFeatureCache cache, Slice slice,
            bool onReverseStrand, bool isCanonical, int cdnaCodingStart, int cdnaCodingEnd, ushort referenceIndex, int start, int end, 
            string ccdsId, string databaseId, string proteinId, string refSeqId, string geneStableId, string stableId, string geneSymbol, 
            GeneSymbolSource geneSymbolSource, int hgncId, byte version, SimpleInterval[] microRnas)
            : base(referenceIndex, start, end)
        {
            BioType            = biotype;
            CcdsId             = ccdsId;
            CompDnaCodingEnd   = cdnaCodingEnd;
            CompDnaCodingStart = cdnaCodingStart;
            DatabaseId         = databaseId;
            Gene               = gene;
            GeneStableId       = geneStableId;
            GeneSymbol         = geneSymbol;
            GeneSymbolSource   = geneSymbolSource;
            HgncId             = hgncId;
            IsCanonical        = isCanonical;
            MicroRnas          = microRnas;
            OnReverseStrand    = onReverseStrand;
            ProteinId          = proteinId;
            RefSeqId           = refSeqId;
            Slice              = slice;
            StableId           = stableId;
            TransExons         = transExons;
            Translation        = translation;
            VariantEffectCache = cache;
            Version            = version;

            var entrezId = ImportDataStore.TranscriptSource == TranscriptDataSource.Ensembl
                ? CompactId.Empty
                : CompactId.Convert(geneStableId);

            var ensemblId = ImportDataStore.TranscriptSource == TranscriptDataSource.Ensembl
                ? CompactId.Convert(geneStableId)
                : CompactId.Empty;

            FinalGene = new VariantAnnotation.DataStructures.Gene(referenceIndex, start, end, onReverseStrand,
                geneSymbol, hgncId, entrezId, ensemblId, -1);

            GenerateHashCode();
        }
Пример #12
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);
 }
Пример #13
0
        /// <summary>
        /// constructor
        /// </summary>
        public EncodedTranscriptData(BioType bioType, byte version, TranscriptDataSource transcriptSource,
                                     bool isCanonical, bool hasSift, bool hasPolyPhen, bool hasMicroRnas, bool hasIntrons, bool hasCdnaMaps,
                                     bool hasTranslation, byte startExonPhase)
        {
            _info  = (ushort)bioType;
            _info |= (ushort)(version << VersionShift);
            _info |= (ushort)((ushort)transcriptSource << TranscriptSourceShift);
            if (isCanonical)
            {
                _info |= CanonicalMask;
            }

            _contents = (byte)(startExonPhase << StartExonShift);
            if (hasSift)
            {
                _contents |= SiftMask;
            }
            if (hasPolyPhen)
            {
                _contents |= PolyPhenMask;
            }
            if (hasMicroRnas)
            {
                _contents |= MirnasMask;
            }
            if (hasIntrons)
            {
                _contents |= IntronsMask;
            }
            if (hasCdnaMaps)
            {
                _contents |= CdnaMapsMask;
            }
            if (hasTranslation)
            {
                _contents |= TranslationMask;
            }
        }
Пример #14
0
 public MutableTranscript(IChromosome chromosome, int start, int end, string id, byte version, string ccdsId,
                          string refSeqId, BioType bioType, bool isCanonical, ICodingRegion codingRegion, string proteinId,
                          byte proteinVersion, string peptideSequence, Source source, MutableGene gene, MutableExon[] exons,
                          int startExonPhase, int totalExonLength, IInterval[] introns, MutableTranscriptRegion[] cdnaMaps,
                          string siftData, string polyphenData, string translateableSequence, IInterval[] microRnas,
                          bool cdsStartNotFound, bool cdsEndNotFound, int[] selenocysteinePositions, IRnaEdit[] rnaEdits,
                          string bamEditStatus)
 {
     Chromosome              = chromosome;
     Start                   = start;
     End                     = end;
     Id                      = id;
     Version                 = version;
     CcdsId                  = ccdsId;
     RefSeqId                = refSeqId;
     BioType                 = bioType;
     IsCanonical             = isCanonical;
     CodingRegion            = codingRegion;
     ProteinId               = proteinId;
     ProteinVersion          = proteinVersion;
     PeptideSequence         = peptideSequence;
     Source                  = source;
     Gene                    = gene;
     Exons                   = exons;
     StartExonPhase          = startExonPhase;
     TotalExonLength         = totalExonLength;
     Introns                 = introns;
     CdnaMaps                = cdnaMaps;
     SiftData                = siftData;
     PolyphenData            = polyphenData;
     TranslateableSequence   = translateableSequence;
     MicroRnas               = microRnas;
     CdsStartNotFound        = cdsStartNotFound;
     CdsEndNotFound          = cdsEndNotFound;
     SelenocysteinePositions = selenocysteinePositions;
     RnaEdits                = rnaEdits;
     BamEditStatus           = bamEditStatus;
 }
Пример #15
0
 private void radioButton3_CheckedChanged(object sender, EventArgs e)
 {
     _bioType = BioType.ZK;
     toolStripStatusLabel1.Text = @"Source: ZKTech Bio-device";
 }
Пример #16
0
 public static string GetBioType(BioType bioType) => bioType == BioType.three_prime_overlapping_ncRNA
     ? "3prime_overlapping_ncRNA"
     : bioType.ToString();
Пример #17
0
        public static string GetBiotypeDescription(BioType biotype)
        {
            string description;

            return(!BioTypeToString.TryGetValue(biotype, out description) ? null : description);
        }
Пример #18
0
 private void radioButton4_CheckedChanged(object sender, EventArgs e)
 {
     _bioType = BioType.Realand;
     toolStripStatusLabel1.Text = @"Source: Realand Bio-device";
 }
Пример #19
0
 /// <summary>
 /// adds the biotype to both dictionaries
 /// </summary>
 private static void AddBioType(string s, BioType bioType)
 {
     StringToBioType[s]       = bioType;
     BioTypeToString[bioType] = s;
 }
Пример #20
0
 private void radioButton3_CheckedChanged(object sender, EventArgs e)
 {
     _bioType = BioType.ZK;
 }
Пример #21
0
        public void Transcript_EndToEnd()
        {
            IChromosome   expectedChromosome       = new Chromosome("chrBob", "Bob", 1);
            const int     expectedStart            = int.MaxValue;
            const int     expectedEnd              = int.MinValue;
            const string  expectedId               = "ENST00000540021";
            const byte    expectedVersion          = 7;
            const BioType expectedBioType          = BioType.IG_J_pseudogene;
            const bool    expectedCanonical        = true;
            const Source  expectedSource           = Source.BothRefSeqAndEnsembl;
            const bool    expectedCdsStartNotFound = true;
            const bool    expectedCdsEndNotFound   = true;

            var expectedIdAndVersion = expectedId + "." + expectedVersion;

            ICodingRegion expectedCodingRegion = new CodingRegion(10001, 10200, 1, 200, 200);

            ITranscriptRegion[] expectedTranscriptRegions = GetTranscriptRegions();
            const byte          expectedNumExons          = 3;

            const int  expectedTotalExonLength = 300;
            const byte expectedStartExonPhase  = 3;
            const int  expectedSiftIndex       = 11;
            const int  expectedPolyPhenIndex   = 13;

            IInterval[] expectedMicroRnas = GetMicroRnas();

            ITranslation expectedTranslation = new Translation(expectedCodingRegion, CompactId.Convert("ENSP00000446475", 17), "VEIDSD");

            IGene expectedGene = new Gene(expectedChromosome, 100, 200, true, "TP53", 300, CompactId.Convert("7157"),
                                          CompactId.Convert("ENSG00000141510"));

            var genes = new IGene[1];

            genes[0] = expectedGene;

            var peptideSeqs = new string[1];

            peptideSeqs[0] = expectedTranslation.PeptideSeq;

            var geneIndices             = CreateIndices(genes);
            var transcriptRegionIndices = CreateIndices(expectedTranscriptRegions);
            var microRnaIndices         = CreateIndices(expectedMicroRnas);
            var peptideIndices          = CreateIndices(peptideSeqs);

            var indexToChromosome = new Dictionary <ushort, IChromosome>
            {
                [expectedChromosome.Index] = expectedChromosome
            };

            // ReSharper disable ConditionIsAlwaysTrueOrFalse
            var transcript = new Transcript(expectedChromosome, expectedStart, expectedEnd,
                                            CompactId.Convert(expectedId, expectedVersion), expectedTranslation, expectedBioType, expectedGene,
                                            expectedTotalExonLength, expectedStartExonPhase, expectedCanonical, expectedTranscriptRegions,
                                            expectedNumExons, expectedMicroRnas, expectedSiftIndex, expectedPolyPhenIndex,
                                            expectedSource, expectedCdsStartNotFound, expectedCdsEndNotFound, null, null);
            // ReSharper restore ConditionIsAlwaysTrueOrFalse

            ITranscript observedTranscript;

            using (var ms = new MemoryStream())
            {
                using (var writer = new ExtendedBinaryWriter(ms, Encoding.UTF8, true))
                {
                    transcript.Write(writer, geneIndices, transcriptRegionIndices, microRnaIndices, peptideIndices);
                }

                ms.Position = 0;

                using (var reader = new ExtendedBinaryReader(ms))
                {
                    observedTranscript = Transcript.Read(reader, indexToChromosome, genes, expectedTranscriptRegions, expectedMicroRnas, peptideSeqs);
                }
            }

            Assert.NotNull(observedTranscript);
            Assert.Equal(expectedStart, observedTranscript.Start);
            Assert.Equal(expectedEnd, observedTranscript.End);
            Assert.Equal(expectedIdAndVersion, observedTranscript.Id.WithVersion);
            Assert.Equal(expectedBioType, observedTranscript.BioType);
            Assert.Equal(expectedCanonical, observedTranscript.IsCanonical);
            Assert.Equal(expectedSource, observedTranscript.Source);
            Assert.Equal(expectedTotalExonLength, observedTranscript.TotalExonLength);
            Assert.Equal(expectedStartExonPhase, observedTranscript.StartExonPhase);
            Assert.Equal(expectedSiftIndex, observedTranscript.SiftIndex);
            Assert.Equal(expectedPolyPhenIndex, observedTranscript.PolyPhenIndex);

            Assert.Equal(expectedChromosome.Index, observedTranscript.Chromosome.Index);
            Assert.Equal(expectedGene.Symbol, observedTranscript.Gene.Symbol);
            Assert.Equal(expectedTranslation.PeptideSeq, observedTranscript.Translation.PeptideSeq);
            Assert.Equal(expectedTranscriptRegions.Length, observedTranscript.TranscriptRegions.Length);
            Assert.Equal(expectedMicroRnas.Length, observedTranscript.MicroRnas.Length);
        }
Пример #22
0
 /// <summary>
 /// 生体型を設定する関数
 /// </summary>
 /// <param name="type">設定するs生体型</param>
 /// <returns>自分のインスタンスを返す</returns>
 public BioData SetType(BioType type)
 {
     _type = type; return(this);
 }
Пример #23
0
 private void radioButton4_CheckedChanged(object sender, EventArgs e)
 {
     _bioType = BioType.Realand;
 }