Beispiel #1
0
        /// <summary>
        /// Associates bam file with intervals to use.  If no intervals applied, bam file will have no entry in the lookup.
        /// </summary>
        private void UpdateBamIntervals()
        {
            if (_options.IntervalPaths != null)
            {
                for (var i = 0; i < _options.BAMPaths.Length; i++)
                {
                    var intervalFilePath = _options.IntervalPaths.Length == 1
                        ? _options.IntervalPaths[0]
                        : _options.IntervalPaths[i];

                    try
                    {
                        var regionsByChr = new Dictionary <string, List <Region> >();

                        IntervalFileToRegion.ParseIntervalFile(intervalFilePath, regionsByChr);

                        // sort regions

                        /* now included in the parsing step
                         * foreach (var chrRegions in regionsByChr.Values)
                         *  chrRegions.Sort((r1, r2) => r1.StartPosition.CompareTo(r2.StartPosition));
                         */

                        _bamIntervalLookup[_options.BAMPaths[i]] = regionsByChr;
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteToLog(
                            "Unable to load interval file '{0}'.  No intervals will be applied to bam '{1}': {2}",
                            intervalFilePath, _options.BAMPaths[i], ex.Message);
                    }
                }
            }
        }
Beispiel #2
0
 public GeometricFilter(GeometricFilterParameters parameters)
 {
     IntervalFileToRegion.ParseIntervalFile(parameters.RegionOfInterestPath, _regionsByChr);
     _mode = parameters.InclusionStrategy;
 }