def setUp(self): com1 = Command( 'Summarize Taxa', 'summarize_taxa_through_plots.py', '{"--otu_table_fp":null}', '{}', '{"--mapping_category":null, "--mapping_fp":null,' '"--sort":null}', '{"--output_dir":null}') com2 = Command( 'Beta Diversity', 'beta_diversity_through_plots.py', '{"--otu_table_fp":null,"--mapping_fp":null}', '{}', '{"--tree_fp":null,"--color_by_all_fields":null,' '"--seqs_per_sample":null}', '{"--output_dir":null}') com3 = Command( 'Alpha Rarefaction', 'alpha_rarefaction.py', '{"--otu_table_fp":null,"--mapping_fp":null}', '{}', '{"--tree_fp":null,"--num_steps":null,' '"--min_rare_depth"' ':null,"--max_rare_depth":null,' '"--retain_intermediate_files":false}', '{"--output_dir":null}') self.all_comms = { "16S": [com1, com2, com3], "18S": [com1, com2, com3], "ITS": [com2, com3], "Proteomic": [com2, com3], "Metabolomic": [com2, com3], "Metagenomic": [com2, com3], }
def post(self): analysis = Analysis(int(self.get_argument('analysis-id'))) # set to third step since this page is third step in workflow analysis.step = SELECT_COMMANDS data_types = analysis.data_types commands = Command.get_commands_by_datatype() self.render('select_commands.html', commands=commands, data_types=data_types, aid=analysis.id)
def test_get_commands(self): exp = [ Command('Summarize Taxa', 'summarize_taxa_through_plots.py', '{"--otu_table_fp":null}', '{}', '{"--mapping_category":null, "--mapping_fp":null,' '"--sort":null}', '{"--output_dir":null}'), Command('Beta Diversity', 'beta_diversity_through_plots.py', '{"--otu_table_fp":null,"--mapping_fp":null}', '{}', '{"--tree_fp":null,"--color_by_all_fields":null,' '"--seqs_per_sample":null}', '{"--output_dir":null}'), Command('Alpha Rarefaction', 'alpha_rarefaction.py', '{"--otu_table_fp":null,"--mapping_fp":null}', '{}', '{"--tree_fp":null,"--num_steps":null,''"--min_rare_depth"' ':null,"--max_rare_depth":null,' '"--retain_intermediate_files":false}', '{"--output_dir":null}') ] self.assertEqual(Job.get_commands(), exp)
def get(self): analysis_id = int(self.get_argument('aid')) analysis = Analysis(analysis_id) check_analysis_access(self.current_user, analysis) data_types = analysis.data_types commands = Command.get_commands_by_datatype() self.render('select_commands.html', commands=commands, data_types=data_types, aid=analysis.id)
def post(self): name = self.get_argument('name') desc = self.get_argument('description') analysis = Analysis.create(self.current_user, name, desc, from_default=True) # set to third step since this page is third step in workflow analysis.step = SELECT_COMMANDS data_types = analysis.data_types commands = Command.get_commands_by_datatype() self.render('select_commands.html', commands=commands, data_types=data_types, aid=analysis.id)
def test_not_equal(self): commands = Command.create_list() self.assertFalse(commands[1] != commands[1]) self.assertTrue(commands[1] != commands[2]) self.assertTrue(commands[1] != Job(1))
def test_get_commands_by_datatype(self): obs = Command.get_commands_by_datatype() self.assertEqual(obs, self.all_comms) obs = Command.get_commands_by_datatype(["16S", "Metabolomic"]) exp = {k: self.all_comms[k] for k in ('16S', 'Metabolomic')} self.assertEqual(obs, exp)