public static void InitializeDatabase(GeneAnnotationDBContext context)
        {
            context.Database.Migrate();
            InitializeConstants.Initialize(context);

            var loadHugo = Environment.GetEnvironmentVariable("GA_DB_LOAD_HUGO");

            if (loadHugo != null)
            {
                var hugoLoader = new HugoDataLoader(context, "hugo.csv.short");
                hugoLoader.LoadData();
            }

            var loadUcsc = Environment.GetEnvironmentVariable("GA_DB_LOAD_UCSC");

            if (loadUcsc != null)
            {
                var ucscLoader = new UcscDataLoader(context, "ucsc.csv.short");
                ucscLoader.LoadData();
            }

            var loadLike = Environment.GetEnvironmentVariable("GA_DB_LOAD_LIKE");

            if (loadLike != null)
            {
                var likeLoader = new LikeDataLoader(context, "like.csv.short");
                likeLoader.LoadData();
            }
        }
Example #2
0
        public void AddLocation()
        {
            var       likeLoader = new LikeDataLoader(Context, "like.csv.short");
            const int start      = 2112;
            const int end        = 4224;

            likeLoader.CurrentRow = new[]
            {
                "stuffz",
                "ch13",
                start.ToString(),
                end.ToString(),
                "priest of syrinx"
            };
            likeLoader.CurrentGene = _insertedGeneWithOutSymbol;
            likeLoader.AddLocation();

            Assert.Equal(
                1,
                likeLoader
                .CurrentGene
                .GeneLocations.Single(gl => gl.HgVersion == 19)
                .GeneCoordinates
                .Count(gc => gc.Start == start && gc.End == end)
                );

            Assert.Equal(
                likeLoader.CurrentRow[LikeDataLoader.ColLocus],
                likeLoader
                .CurrentGene
                .GeneLocations.Single(gl => gl.HgVersion == 19)
                .Locus
                );
        }
Example #3
0
        public void AddKnownFunctionTest()
        {
            var likeLoader = new LikeDataLoader(Context, "like.csv.short");

            likeLoader.CurrentRow = new[]
            {
                "stuffz",
                "ch13",
                "1",
                "2",
                "priest of syrinx",
                "",
                "",
                "",
                "",
                "God Of Balance"
            };
            likeLoader.CurrentGene = _insertedGeneWithOutKnowFunction;
            likeLoader.AddKnownFunction();

            Assert.Equal(
                likeLoader.CurrentRow[LikeDataLoader.ColKnownFunction],
                likeLoader
                .CurrentGene
                .KnownFunction
                );
        }
Example #4
0
        public void LoadFileTest()
        {
            var likeLoader = new LikeDataLoader(Context, "like.csv.short");
            var ex         = Record.Exception(
                () => { likeLoader.LoadFile(); }
                );

            Assert.Null(ex);
        }
Example #5
0
        public void FindOrCreateNewGene()
        {
            var likeLoader = new LikeDataLoader(Context, "like.csv.short");

            likeLoader.CurrentRow = new[]
            {
                "bla",
                "ch1",
                "100",
                "200",
                "Bobs your ungle"
            };
            likeLoader.FindOrCreateGene();

            Assert.True(likeLoader.CurrentGene.Id > 0);
        }
Example #6
0
        public void FindOrCreateExistingGene()
        {
            var likeLoader = new LikeDataLoader(Context, "like.csv.short");

            likeLoader.CurrentRow = new[]
            {
                SymbolTestData.Symbols[0].Name,
                "ch1",
                "100",
                "200",
                "locus",
            };
            likeLoader.FindOrCreateGene();

            Assert.True(
                likeLoader.CurrentGene.Symbol.SingleOrDefault(s => s.Name == SymbolTestData.Symbols[0].Name) != null
                );
        }