Exemple #1
0
        public static void CheckDirectoryIntegrity(string ciDir, List <DataSourceVersion> mainDataSourceVersions)
        {
            DataSourceVersion version = null;

            if (string.IsNullOrEmpty(ciDir))
            {
                return;
            }

            foreach (var ciPath in Directory.GetFiles(ciDir, "*.nci"))
            {
                using (var reader = new CustomIntervalReader(ciPath))
                {
                    if (version == null)
                    {
                        version = reader.DataVersion;
                    }
                    else
                    {
                        var newVersion = reader.DataVersion;
                        if (newVersion != version)
                        {
                            throw new UserErrorException($"Found more than one custom interval data version represented in the following directory: {ciDir}");
                        }
                    }
                }
            }

            if (version != null)
            {
                mainDataSourceVersions.Add(version);
            }
        }
        private static void AddIntervals(string ciDir, string ucscReferenceName, List <ICustomInterval> intervals)
        {
            if (string.IsNullOrEmpty(ciDir))
            {
                return;
            }

            var ciPath = Path.Combine(ciDir, ucscReferenceName + ".nci");

            if (!File.Exists(ciPath))
            {
                return;
            }

            using (var reader = new CustomIntervalReader(ciPath))
            {
                while (true)
                {
                    var interval = reader.GetNextCustomInterval();
                    if (interval == null)
                    {
                        break;
                    }
                    intervals.Add(interval);
                }
            }
        }