def test_max_with_no_guess(self): expected_sql = MAX_QUERY_NO_GUESS expected_params = ["hg38", "refgene", "E2F4", "250", "150", "150", "250", "refgene", "E2F4", "250", "150", "150", "250"] query = MaxPredictionQuery( schema="hg38", gene_list="refgene", model_name="E2F4", upstream="150", downstream="250", ) sql, params = query.get_query_and_params() self.assertMultiLineEqual(expected_sql, sql) self.assertEqual(expected_params, params)
def test_max_with_no_guess(self): expected_sql = MAX_QUERY_NO_GUESS expected_params = [ "hg38", "refgene", "E2F4", "150", "250", "250", "150", "refgene", "E2F4", "150", "250", "250", "150" ] query = MaxPredictionQuery( schema="hg38", gene_list="refgene", model_name="E2F4", upstream="150", downstream="250", ) sql, params = query.get_query_and_params() self.assertMultiLineEqual(expected_sql, sql) self.assertEqual(expected_params, params)
def test_max_count(self): expected_sql = COUNT_QUERY expected_params = ["hg38", "refgene", "E2F4", "250", "150", "150", "250", "refgene", "E2F4", "250", "150", "150", "250"] query = MaxPredictionQuery( schema="hg38", gene_list="refgene", model_name="E2F4", upstream="150", downstream="250", count=True, ) self.maxDiff = None sql, params = query.get_query_and_params() self.assertMultiLineEqual(expected_sql, sql) self.assertEqual(expected_params, params)
def test_max_count(self): expected_sql = COUNT_QUERY expected_params = [ "hg38", "refgene", "E2F4", "150", "250", "250", "150", "refgene", "E2F4", "150", "250", "250", "150" ] query = MaxPredictionQuery( schema="hg38", gene_list="refgene", model_name="E2F4", upstream="150", downstream="250", count=True, ) self.maxDiff = None sql, params = query.get_query_and_params() self.assertMultiLineEqual(expected_sql, sql) self.assertEqual(expected_params, params)
def test_max_with_guess_and_limit(self): expected_sql = MAX_QUERY_WITH_GUESS_WITH_LIMIT expected_params = ["hg38", "refgene", "E2F4", "250", "150", "150", "250", "0.4", "100", "200", "refgene", "E2F4", "250", "150", "150", "250"] query = MaxPredictionQuery( schema="hg38", gene_list="refgene", model_name="E2F4", upstream="150", downstream="250", guess="0.4", limit="100", offset="200", ) sql, params = query.get_query_and_params() self.maxDiff = None self.assertMultiLineEqual(expected_sql, sql) self.assertEqual(expected_params, params)
def test_max_with_guess_and_limit(self): expected_sql = MAX_QUERY_WITH_GUESS_WITH_LIMIT expected_params = [ "hg38", "refgene", "E2F4", "150", "250", "250", "150", "0.4", "100", "200", "refgene", "E2F4", "150", "250", "250", "150" ] query = MaxPredictionQuery( schema="hg38", gene_list="refgene", model_name="E2F4", upstream="150", downstream="250", guess="0.4", limit="100", offset="200", ) sql, params = query.get_query_and_params() self.maxDiff = None self.assertMultiLineEqual(expected_sql, sql) self.assertEqual(expected_params, params)
def max_query(self, count): guess = None if self.enable_guess and self.max_sort_guess: guess = self.max_sort_guess limit, offset = self.get_limit_and_offset(count) return MaxPredictionQuery( schema=self.genome, gene_list=self.args.get_gene_list(), model_name=self.args.get_model_name(), upstream=self.args.get_upstream(), downstream=self.args.get_downstream(), guess=guess, limit=limit, offset=offset, count=count, )