Ejemplo n.º 1
0
 def test_stand_alone_sequence_outputs_data_set_sample_input(self):
     print('\n\nTesting: stand_alone_sequence_outputs_data_set_sample_input\n\n')
     data_set_samples_1_2 = DataSet.objects.filter(id__in=[1,2])
     data_set_samples_in_1_2 = DataSetSample.objects.filter(data_submission_from__in=data_set_samples_1_2)
     data_set_sample_uids_str = ','.join([str(dss.id) for dss in data_set_samples_in_1_2][2:-2])
     custom_args_list = ['--print_output_seqs_sample_set', data_set_sample_uids_str, '--num_proc', str(self.num_proc)]
     test_spwfm = main.SymPortalWorkFlowManager(custom_args_list)
     test_spwfm.start_work_flow()
Ejemplo n.º 2
0
 def test_stand_alone_profile_outputs_data_set_sample_input(self):
     print('\n\nTesting: stand_alone_profile_outputs_data_set_sample_input\n\n')
     data_set_sample_1 = DataSet.objects.get(id=1)
     data_set_samples_in_1 = DataSetSample.objects.filter(data_submission_from=data_set_sample_1)
     data_set_sample_uids_str = ','.join([str(dss.id) for dss in data_set_samples_in_1][2:-2])
     custom_args_list = ['--print_output_types_sample_set', data_set_sample_uids_str, '--data_analysis_id', '1', '--num_proc', str(self.num_proc)]
     test_spwfm = main.SymPortalWorkFlowManager(custom_args_list)
     test_spwfm.start_work_flow()
Ejemplo n.º 3
0
 def _test_data_loading_work_flow(self):
     custom_args_list = [
         '--load', self.test_data_dir_path, '--name', self.name,
         '--num_proc',
         str(self.num_proc), '--data_sheet', self.data_sheet_file_path
     ]
     self.work_flow_manager = main.SymPortalWorkFlowManager(
         custom_args_list)
     self.work_flow_manager.start_work_flow()
Ejemplo n.º 4
0
 def test_stand_alone_unifrac_type_distances_data_set_sample_uid_input(self):
     # create a string for dss input that is all but the last 4 dss objects of the DataSet 1
     print('\n\nTesting: stand_alone_unifrac_type_distances_data_set_sample_uid_input\n\n')
     data_set_1 = DataSet.objects.get(id=1)
     data_set_samples_from_1 = DataSetSample.objects.filter(data_submission_from=data_set_1)
     dss_uids_of_ds_str = ','.join([str(dss.id) for dss in data_set_samples_from_1][:-4])
     custom_args_list = ['--between_type_distances_sample_set', dss_uids_of_ds_str, '--data_analysis_id', '1', '--num_proc', str(self.num_proc), '--distance_method', 'unifrac']
     test_spwfm = main.SymPortalWorkFlowManager(custom_args_list)
     test_spwfm.start_work_flow()
Ejemplo n.º 5
0
 def _test_data_analysis_work_flow(self):
     custom_args_list = [
         '--analyse',
         str(self.work_flow_manager.data_set_object.id), '--name',
         self.name, '--num_proc',
         str(self.num_proc)
     ]
     self.work_flow_manager = main.SymPortalWorkFlowManager(
         custom_args_list)
     self.work_flow_manager.start_work_flow()
Ejemplo n.º 6
0
    def _test_data_loading_work_flow(self):
        custom_args_list = ['--load', self.test_data_dir_path, '--name', self.name, '--num_proc',
                            str(self.num_proc), '--data_sheet', self.data_sheet_file_path, '--debug']
        self.work_flow_manager = main.SymPortalWorkFlowManager(custom_args_list)
        self.work_flow_manager.start_work_flow()
        # Let's see if we can read in some of the outputs and work with them as assertions
        foo = 'ar'
        # here we should develop some real tests
        # Check the md5sum of the output post_med_seq abund only relative and absolute files
        
        # Post-MED objects to check.
        for path in self.work_flow_manager.data_loading_object.output_path_list:
            if 'seqs.absolute.abund_only' in path:
                absolute_abund_path = path
            if 'seqs.relative.abund_only' in path:
                relative_abund_path = path
            if '.seqs.fasta' in path:
                post_med_fasta_path = path
        
        # Pre-MED objects to check.
        pre_med_absolute_count_table_path = self.work_flow_manager.data_loading_object.sequence_count_table_creator.pre_med_absolute_df_path
        pre_med_relative_count_table_path = self.work_flow_manager.data_loading_object.sequence_count_table_creator.pre_med_relative_df_path
        pre_med_fasta_path = self.work_flow_manager.data_loading_object.sequence_count_table_creator.pre_med_fasta_out_path

        # pre_med absolute
        self._compare_abund_dfs_pre_med(
            assertion_df_path=os.path.join(self.assertion_matching_dir, 'pre_med_absolute_abundance_df.csv'), 
            tested_df_path=pre_med_absolute_count_table_path, absolute=True
            )
        # pre_med relative
        self._compare_abund_dfs_pre_med(
            assertion_df_path=os.path.join(self.assertion_matching_dir, 'pre_med_relative_abundance_df.csv'), 
            tested_df_path=pre_med_relative_count_table_path, absolute=False
            )
        
        # Now compare the DataFrames
        # post_med absolute
        self._compare_abund_dfs_post_med(
            assertion_df_path=os.path.join(self.assertion_matching_dir, 'seqs.absolute.abund_only.txt'), 
            tested_df_path=absolute_abund_path, absolute=True
            )
        # post_med relative
        self._compare_abund_dfs_post_med(
            assertion_df_path=os.path.join(self.assertion_matching_dir, 'seqs.relative.abund_only.txt'), 
            tested_df_path=relative_abund_path, absolute=False
            )
Ejemplo n.º 7
0
 def test_stand_alone_unifrac_type_distances_cct_uid_input(self):
     # create a string for cct input that is the first half of the ccts associated with dataset 1 and
     # the first half from dataset 2
     print('\n\nTesting: stand_alone_unifrac_type_distances_cct_uid_input\n\n')
     data_analysis = DataAnalysis.objects.get(id=1)
     cct_one_uid_list = [cct.id for cct in CladeCollectionType.objects.filter(
         clade_collection_found_in__data_set_sample_from__data_submission_from__id=1,
         analysis_type_of__data_analysis_from=data_analysis)]
     cct_two_uid_list = [cct.id for cct in CladeCollectionType.objects.filter(
         clade_collection_found_in__data_set_sample_from__data_submission_from__id=2,
         analysis_type_of__data_analysis_from=data_analysis)]
     one_len = len(cct_one_uid_list)
     two_len = len(cct_two_uid_list)
     cct_uid_list = cct_one_uid_list[:int(-1 * (one_len/2))] + cct_two_uid_list[:int(-1*(two_len/2))]
     print('\n\nTesting: stand_alone_unifrac_type_distances_cct_uid_input\n\n')
     cct_list_str = ','.join([str(_) for _ in cct_uid_list])
     custom_args_list = ['--between_type_distances_cct_set', cct_list_str, '--data_analysis_id', '1',
                         '--num_proc', str(self.num_proc), '--distance_method', 'unifrac']
     test_spwfm = main.SymPortalWorkFlowManager(custom_args_list)
     test_spwfm.start_work_flow()
Ejemplo n.º 8
0
 def test_stand_alone_braycurtis_type_distances_data_set_uid_input(self):
     print('\n\nTesting: stand_alone_unifrac_type_distances_data_set_uid_input\n\n')
     custom_args_list = ['--between_type_distances', '1', '--data_analysis_id', '1', '--num_proc', str(self.num_proc), '--distance_method', 'braycurtis', '--sqrt', '--local']
     test_spwfm = main.SymPortalWorkFlowManager(custom_args_list)
     test_spwfm.start_work_flow()
Ejemplo n.º 9
0
 def test_stand_alone_profile_outputs_data_set_input(self):
     print('\n\nTesting: stand_alone_profile_outputs_data_set_input\n\n')
     custom_args_list = ['--print_output_types', '1', '--data_analysis_id', '1', '--num_proc', str(self.num_proc)]
     test_spwfm = main.SymPortalWorkFlowManager(custom_args_list)
     test_spwfm.start_work_flow()
Ejemplo n.º 10
0
 def test_data_analysis_work_flow(self):
     print('\n\nTesting: data_analysis_work_flow\n\n')
     custom_args_list = ['--analyse', '1', '--name', self.name,
                         '--num_proc', str(self.num_proc)]
     test_spwfm = main.SymPortalWorkFlowManager(custom_args_list)
     test_spwfm.start_work_flow()
Ejemplo n.º 11
0
 def test_data_loading_work_flow(self):
     print('\n\nTesting: data_loading_work_flow\n\n')
     custom_args_list = ['--load', self.test_data_dir_path, '--name', self.name, '--num_proc', str(self.num_proc),
                         '--data_sheet', self.data_sheet_file_path]
     test_spwfm = main.SymPortalWorkFlowManager(custom_args_list)
     test_spwfm.start_work_flow()