def test_generate_param_str(self): params = DefaultParameters(10) obs = generate_param_str(params) exp = ("<b>Reference:</b> Greengenes 13_8<br/>" "<b>similarity:</b> 0.97<br/>" "<b>sortmerna_e_value:</b> 1<br/>" "<b>sortmerna_max_pos:</b> 10000<br/>" "<b>threads:</b> 1<br/>" "<b>sortmerna_coverage:</b> 0.97") self.assertEqual(obs, exp)
def test_generate_param_str(self): params = ProcessedSortmernaParams(1) obs = generate_param_str(params) exp = ("<b>Reference:</b> Greengenes 13_8<br/>" "<b>similarity:</b> 0.97<br/>" "<b>sortmerna_e_value:</b> 1.0<br/>" "<b>sortmerna_max_pos:</b> 10000<br/>" "<b>threads:</b> 1<br/>" "<b>sortmerna_coverage:</b> 0.97") self.assertEqual(obs, exp)
def test_generate_param_str(self): params = DefaultParameters(10) obs = generate_param_str(params) exp = ('<b>Reference:</b> Greengenes 13_8<br/>' '<b>sortmerna_e_value:</b> 1<br/>' '<b>sortmerna_max_pos:</b> 10000<br/>' '<b>similarity:</b> 0.97<br/>' '<b>sortmerna_coverage:</b> 0.97<br/>' '<b>threads:</b> 1') self.assertEqual(obs, exp)
def render(self, study_id, preprocessed_data): user = self.current_user ppd_id = preprocessed_data.id ebi_status = preprocessed_data.submitted_to_insdc_status() ebi_study_accession = preprocessed_data.ebi_study_accession ebi_submission_accession = preprocessed_data.ebi_submission_accession vamps_status = preprocessed_data.submitted_to_vamps_status() filepaths = preprocessed_data.get_filepaths() is_local_request = self._is_local() show_ebi_btn = user.level == "admin" processing_status = preprocessed_data.processing_status processed_data = preprocessed_data.processed_data # Get all the ENA terms for the investigation type ontology = Ontology(convert_to_id('ENA', 'ontology')) # make "Other" show at the bottom of the drop down menu ena_terms = [] for v in sorted(ontology.terms): if v != 'Other': ena_terms.append('<option value="%s">%s</option>' % (v, v)) ena_terms.append('<option value="Other">Other</option>') # New Type is for users to add a new user-defined investigation type user_defined_terms = ontology.user_defined_terms + ['New Type'] if PrepTemplate.exists(preprocessed_data.prep_template): prep_template_id = preprocessed_data.prep_template prep_template = PrepTemplate(prep_template_id) raw_data_id = prep_template.raw_data inv_type = prep_template.investigation_type or "None Selected" else: prep_template_id = None raw_data_id = None inv_type = "None Selected" process_params = {param.id: (generate_param_str(param), param.name) for param in ProcessedSortmernaParams.iter()} # We just need to provide an ID for the default parameters, # so we can initialize the interface default_params = 1 return self.render_string( "study_description_templates/preprocessed_data_info_tab.html", ppd_id=ppd_id, show_ebi_btn=show_ebi_btn, ebi_status=ebi_status, ebi_study_accession=ebi_study_accession, ebi_submission_accession=ebi_submission_accession, filepaths=filepaths, is_local_request=is_local_request, prep_template_id=prep_template_id, raw_data_id=raw_data_id, inv_type=inv_type, ena_terms=ena_terms, vamps_status=vamps_status, user_defined_terms=user_defined_terms, process_params=process_params, default_params=default_params, study_id=preprocessed_data.study, processing_status=processing_status, processed_data=processed_data)
def render(self, study_id, preprocessed_data): user = self.current_user ppd_id = preprocessed_data.id vamps_status = preprocessed_data.is_submitted_to_vamps filepaths = preprocessed_data.filepaths is_local_request = is_localhost(self.request.headers['host']) show_ebi_btn = user.level == "admin" processing_status, processing_status_msg = \ get_artifact_processing_status(preprocessed_data) processed_data = sorted([pd.id for pd in preprocessed_data.children]) # Get all the ENA terms for the investigation type ontology = Ontology(convert_to_id('ENA', 'ontology')) # make "Other" show at the bottom of the drop down menu ena_terms = [] for v in sorted(ontology.terms): if v != 'Other': ena_terms.append('<option value="%s">%s</option>' % (v, v)) ena_terms.append('<option value="Other">Other</option>') # New Type is for users to add a new user-defined investigation type user_defined_terms = ontology.user_defined_terms + ['New Type'] # ppd can only have 1 prep template prep_template = preprocessed_data.prep_templates[0] # this block might seem wrong but is here due to a possible # pathological case that we used to have in the system: preprocessed # data without valid prep_templates prep_templates = preprocessed_data.prep_templates if len(prep_templates) == 1: prep_template_id = prep_template.id raw_data_id = prep_template.artifact.id inv_type = prep_template.investigation_type or "None selected" else: prep_template_id = None raw_data_id = None inv_type = "None Selected" process_params = { param.id: (generate_param_str(param), param.name) for param in Command(3).default_parameter_sets } # We just need to provide an ID for the default parameters, # so we can initialize the interface default_params = min(process_params.keys()) ebi_link = None if preprocessed_data.is_submitted_to_ebi: ebi_link = EBI_LINKIFIER.format( Study(study_id).ebi_study_accession) return self.render_string( "study_description_templates/preprocessed_data_info_tab.html", ppd_id=ppd_id, show_ebi_btn=show_ebi_btn, filepaths=filepaths, is_local_request=is_local_request, prep_template_id=prep_template_id, raw_data_id=raw_data_id, inv_type=inv_type, ena_terms=ena_terms, vamps_status=vamps_status, user_defined_terms=user_defined_terms, process_params=process_params, default_params=default_params, study_id=preprocessed_data.study.id, processing_status=processing_status, processing_status_msg=processing_status_msg, processed_data=processed_data, ebi_link=ebi_link)
def render(self, study_id, preprocessed_data): user = self.current_user ppd_id = preprocessed_data.id vamps_status = preprocessed_data.is_submitted_to_vamps filepaths = preprocessed_data.filepaths is_local_request = is_localhost(self.request.headers['host']) show_ebi_btn = user.level == "admin" processing_status, processing_status_msg = \ get_artifact_processing_status(preprocessed_data) processed_data = sorted([pd.id for pd in preprocessed_data.children]) # Get all the ENA terms for the investigation type ontology = Ontology(convert_to_id('ENA', 'ontology')) # make "Other" show at the bottom of the drop down menu ena_terms = [] for v in sorted(ontology.terms): if v != 'Other': ena_terms.append('<option value="%s">%s</option>' % (v, v)) ena_terms.append('<option value="Other">Other</option>') # New Type is for users to add a new user-defined investigation type user_defined_terms = ontology.user_defined_terms + ['New Type'] # ppd can only have 1 prep template prep_template = preprocessed_data.prep_templates[0] # this block might seem wrong but is here due to a possible # pathological case that we used to have in the system: preprocessed # data without valid prep_templates prep_templates = preprocessed_data.prep_templates if len(prep_templates) == 1: prep_template_id = prep_template.id raw_data_id = prep_template.artifact.id inv_type = prep_template.investigation_type or "None selected" else: prep_template_id = None raw_data_id = None inv_type = "None Selected" process_params = {param.id: (generate_param_str(param), param.name) for param in Command(3).default_parameter_sets} # We just need to provide an ID for the default parameters, # so we can initialize the interface default_params = min(process_params.keys()) ebi_link = None if preprocessed_data.is_submitted_to_ebi: ebi_link = EBI_LINKIFIER.format( Study(study_id).ebi_study_accession) return self.render_string( "study_description_templates/preprocessed_data_info_tab.html", ppd_id=ppd_id, show_ebi_btn=show_ebi_btn, filepaths=filepaths, is_local_request=is_local_request, prep_template_id=prep_template_id, raw_data_id=raw_data_id, inv_type=inv_type, ena_terms=ena_terms, vamps_status=vamps_status, user_defined_terms=user_defined_terms, process_params=process_params, default_params=default_params, study_id=preprocessed_data.study.id, processing_status=processing_status, processing_status_msg=processing_status_msg, processed_data=processed_data, ebi_link=ebi_link)