Esempio n. 1
0
 CreateSequenceRangeGroupingsForVennDiagram
     (
     SequenceRangeGrouping srgA,
     SequenceRangeGrouping srgB,
     out SequenceRangeGrouping srgOnly_A,
     out SequenceRangeGrouping srgOnly_B,
     out SequenceRangeGrouping srgOnly_AB
     )
 {
     // Create the proper intersected sets from the two original SequenceRangeGroups
     SequenceRangeGrouping srgAB = srgA.MergeOverlaps(srgB); // use set terminology (Union) or boolean logic (Or)
     srgOnly_A = srgAB.Subtract(srgB, 1, SubtractOutputType.NonOverlappingPiecesOfIntervals); // TODO: Subtract and Intersect should use same 'logic' (for bool 3rd arg)
     srgOnly_B = srgAB.Subtract(srgA, 1, SubtractOutputType.NonOverlappingPiecesOfIntervals);
     srgOnly_AB = srgA.Intersect(srgB, 1, IntersectOutputType.OverlappingPiecesOfIntervals);
 }
Esempio n. 2
0
        CreateSequenceRangeGroupingsForVennDiagram
            (
            SequenceRangeGrouping srgA,
            SequenceRangeGrouping srgB,
            SequenceRangeGrouping srgC,
            out SequenceRangeGrouping srgOnly_A,
            out SequenceRangeGrouping srgOnly_B,
            out SequenceRangeGrouping srgOnly_C,
            out SequenceRangeGrouping srgOnly_AB,
            out SequenceRangeGrouping srgOnly_AC,
            out SequenceRangeGrouping srgOnly_BC,
            out SequenceRangeGrouping srgOnly_ABC
            )
        {
            // create the proper sets for a 3 circle Venn Diagram
            SequenceRangeGrouping srgBC = srgB.MergeOverlaps(srgC);
            srgOnly_A = srgA.Subtract(srgBC, 1, SubtractOutputType.NonOverlappingPiecesOfIntervals);

            SequenceRangeGrouping srgAC = srgA.MergeOverlaps(srgC);
            srgOnly_B = srgB.Subtract(srgAC, 1, SubtractOutputType.NonOverlappingPiecesOfIntervals);

            SequenceRangeGrouping srgAB = srgA.MergeOverlaps(srgB);
            srgOnly_C = srgC.Subtract(srgAB, 1, SubtractOutputType.NonOverlappingPiecesOfIntervals);

            srgAB = srgA.Intersect(srgB, 1, IntersectOutputType.OverlappingPiecesOfIntervals);
            srgOnly_AB = srgAB.Subtract(srgC, 1, SubtractOutputType.NonOverlappingPiecesOfIntervals);
            srgAC = srgA.Intersect(srgC, 1, IntersectOutputType.OverlappingPiecesOfIntervals);
            srgOnly_AC = srgAC.Subtract(srgB, 1, SubtractOutputType.NonOverlappingPiecesOfIntervals);
            srgBC = srgB.Intersect(srgC, 1, IntersectOutputType.OverlappingPiecesOfIntervals);
            srgOnly_BC = srgBC.Subtract(srgA, 1, SubtractOutputType.NonOverlappingPiecesOfIntervals);

            srgOnly_ABC = srgAB.Intersect(srgC, 1, IntersectOutputType.OverlappingPiecesOfIntervals);
        }
Esempio n. 3
0
        /// <summary>
        /// Indentify hot spot chromosomes for length anamoly regions.
        /// </summary>
        /// <param name="inputFile"> Input file</param>
        /// <param name="mean">Mean value</param>
        /// <param name="standardDeviation">Standard deviation</param>
        private void IdentifyLentghAnamolies(string filename,
             float mean = -1, float deviation = -1)
        {
            bool calculateMeanNdeviation = false;

            if (mean == -1 || deviation == -1)
            {
                calculateMeanNdeviation = true;
            }

            SequenceAlignmentMap alignmentMapobj = null;

            if (!SAMInput)
            {
                BAMParser bamParser = new BAMParser();
                alignmentMapobj = bamParser.ParseOne<SequenceAlignmentMap>(filename);
            }
            else
            {
                SAMParser samParser = new SAMParser();
                alignmentMapobj = samParser.ParseOne<SequenceAlignmentMap>(filename);
            }

            // get reads from sequence alignment map object.
            IList<PairedRead> pairedReads = null;

            if (calculateMeanNdeviation)
            {
                pairedReads = alignmentMapobj.GetPairedReads();
            }
            else
            {
                pairedReads = alignmentMapobj.GetPairedReads(mean, deviation);
            }

            // Get the orphan regions.
            var orphans = pairedReads.Where(PR => PR.PairedType == PairedReadType.Orphan);


            if (orphans.Count() == 0)
            {
                Console.WriteLine("No Orphans to display");
            }

            List<ISequenceRange> orphanRegions = new List<ISequenceRange>(orphans.Count());
            foreach (PairedRead orphanRead in orphans)
            {
                orphanRegions.Add(GetRegion(orphanRead.Read1));
            }

            // Get sequence range grouping for Orphan regions.
            SequenceRangeGrouping orphanRangegroup = new SequenceRangeGrouping(orphanRegions);

            // Get the Length anomalies regions.
            var lengthAnomalies = pairedReads.Where(PE => PE.PairedType == PairedReadType.LengthAnomaly);

            if (lengthAnomalies.Count() == 0)
            {
                Console.WriteLine("No Anomalies to display");
            }

            List<ISequenceRange> lengthAnomalyRegions = new List<ISequenceRange>(lengthAnomalies.Count());
            foreach (PairedRead laRead in lengthAnomalies)
            {
                SequenceRange range = new SequenceRange();
                range.ID = laRead.Read1.RName;
                range.Start = laRead.Read1.Pos;
                range.End = laRead.Read1.Pos + laRead.InsertLength;
                lengthAnomalyRegions.Add(range);
            }

            // Get sequence range grouping for length anomaly regions.
            SequenceRangeGrouping lengthAnomalyRangegroup =
                                new SequenceRangeGrouping(lengthAnomalyRegions);
            if (lengthAnomalyRangegroup.GroupIDs.Count() == 0)
            {
                Console.Write("\r\nNo Length anomalies reads to display");
            }
            else
            {
                Console.Write("Region of length anomaly:");
                DisplaySequenceRange(lengthAnomalyRangegroup);
            }

            if (orphanRangegroup.GroupIDs.Count() == 0)
            {
                Console.Write("\r\nNo Orphan reads to display");
            }
            else
            {
                Console.Write("\r\nRegion of Orphan reads:");
                DisplaySequenceRange(orphanRangegroup);
            }

            SequenceRangeGrouping intersectedRegions =
                lengthAnomalyRangegroup.Intersect(orphanRangegroup);
            if (intersectedRegions.GroupIDs.Count() == 0)
            {
                Console.Write("\r\nNo Hot spots found");
            }
            else
            {
                Console.Write("\r\nChromosomal Hot spot of length anomaly and Orphan region:");
                DisplaySequenceRange(intersectedRegions);
            }



        }