Ejemplo n.º 1
0
        public bool TryTurnInsideOut(out Region toAssign)
        {
            toAssign = null;
            bool        found   = false;
            MiscElement largest = null;

            foreach (KeyValuePair <string, List <MiscElement> > kvp in RegElements)
            {
                foreach (MiscElement e in kvp.Value)
                {
                    if (e.Length > this.Length)
                    {
                        largest = e;
                        found   = true;
                    }
                }
            }

            if (found)
            {
                toAssign = new Region(RegionName, largest.Component, largest.Start, largest.End, this.Sense);
                MiscElement rtoe = new MiscElement(this.RegionTypeName, Start, End, Sense);
                toAssign.AddMiscEle(rtoe);

                RegElements [largest.Component].Remove(largest);

                foreach (KeyValuePair <string, List <MiscElement> > kvp in RegElements)
                {
                    foreach (MiscElement e in kvp.Value)
                    {
                        toAssign.AddMiscEle(e);
                    }
                }
            }
            return(found);
        }
Ejemplo n.º 2
0
        public override void AddFileElement(string ele_name, int start, int end)
        {
            if (end - start > 0)
            {
                GeneElement ele;
                int         cnt = 0;
                switch (ele_name)
                {
                case "five_prime_UTR":
                    ele = new UTR5(start, end, this.Sense);
                    if (!Elements.ContainsKey("five_prime_UTR"))
                    {
                        Elements.Add("five_prime_UTR", new List <GeneElement> ());
                    }
                    Elements ["five_prime_UTR"].Add(ele);
                    break;

                case "three_prime_UTR":
                    ele = new UTR3(start, end, this.Sense);
                    if (!Elements.ContainsKey("three_prime_UTR"))
                    {
                        Elements.Add("three_prime_UTR", new List <GeneElement> ());
                    }
                    Elements ["three_prime_UTR"].Add(ele);
                    break;

                case "exon":
                    if (!Elements.ContainsKey("exon"))
                    {
                        Elements.Add("exon", new List <GeneElement> ());
                    }
                    cnt = Elements ["exon"].Count + 1;
                    ele = new Exon(cnt, start, end, this.Sense);
                    Elements ["exon"].Add(ele);
                    break;

                case "CDS":
                    if (!Elements.ContainsKey("CDS"))
                    {
                        Elements.Add("CDS", new List <GeneElement> ());
                    }
                    cnt = Elements ["CDS"].Count + 1;
                    ele = new CDS(cnt, start, end, this.Sense);
                    Elements ["CDS"].Add(ele);
                    break;

                default:
                    if (ele_name.Contains("promoter"))
                    {
                        ele = new Promoter(ele_name, start, end, this.Sense);
                        if (!Elements.ContainsKey(ele_name))
                        {
                            Elements.Add(ele_name, new List <GeneElement> ());
                        }
                        Elements [ele_name].Add(ele);
                    }
                    else
                    {
                        if (!Elements.ContainsKey(ele_name))
                        {
                            Elements.Add(ele_name, new List <GeneElement> ());
                        }
                        ele = new MiscElement(ele_name, start, end, this.Sense);
                        Elements [ele_name].Add(ele);
                    }
                    break;
                }
            }
        }