コード例 #1
0
ファイル: Transcript.cs プロジェクト: rmmiller22/Spritz
        /// <summary>
        /// Create UTR regions for this transcript
        /// </summary>
        public List <UTR> CreateUTRs()
        {
            if (CodingDomainSequences.Count == 0)
            {
                return(UTRs);
            }

            List <Interval> missing = Exons.OfType <Interval>().ToList();

            foreach (Interval interval in UTRs.Concat(CodingDomainSequences.OfType <Interval>().ToList()))
            {
                missing = missing.SelectMany(i => i.Minus(interval)).ToList();
            }

            long codingMin = CodingDomainSequences.Select(c => c.OneBasedStart).Min();
            long codingMax = CodingDomainSequences.Select(c => c.OneBasedEnd).Max();

            foreach (Interval interval in missing)
            {
                Exon x = FindExon(interval);
                if (x == null)
                {
                    throw new ArgumentException("Cannot find exon for UTR: " + interval.ToString());
                }

                UTR toAdd = null;
                if (IsStrandPlus())
                {
                    if (interval.OneBasedEnd <= codingMin)
                    {
                        toAdd = new UTR5Prime(x, x.ChromosomeID, x.Source, x.Strand, interval.OneBasedStart, interval.OneBasedEnd);
                    }
                    else if (interval.OneBasedStart >= codingMax)
                    {
                        toAdd = new UTR3Prime(x, x.ChromosomeID, x.Source, x.Strand, interval.OneBasedStart, interval.OneBasedEnd);
                    }
                }
                else
                {
                    if (interval.OneBasedStart >= codingMax)
                    {
                        toAdd = new UTR5Prime(x, x.ChromosomeID, x.Source, x.Strand, interval.OneBasedStart, interval.OneBasedEnd);
                    }
                    else if (interval.OneBasedEnd <= codingMin)
                    {
                        toAdd = new UTR3Prime(x, x.ChromosomeID, x.Source, x.Strand, interval.OneBasedStart, interval.OneBasedEnd);
                    }
                }

                // OK?
                if (toAdd != null)
                {
                    UTRs.Add(toAdd);
                }
            }
            return(UTRs);
        }
コード例 #2
0
ファイル: UTR.cs プロジェクト: smith-chem-wisc/Proteogenomics
 protected UTR(UTR utr)
     : base(utr)
 {
 }