Ejemplo n.º 1
0
 def run(self, user_request):
     table = OTUTable(user_request.user_id, user_request.pid)
     base, headers, sample_labels = table.get_table_after_filtering_and_aggregation(
         user_request)
     metadata_vals = table.get_sample_metadata(
     ).get_metadata_column_table_order(sample_labels, user_request.catvar)
     phylogenetic_tree = table.get_phylogenetic_tree()
     return self.analyse(user_request, base, headers, sample_labels,
                         metadata_vals, phylogenetic_tree)
    def run(self, user_request):
        table = OTUTable(user_request.user_id, user_request.pid)

        # No OTUs should be excluded for diversity analysis
        otu_table, headers, sample_labels = table.get_table_after_filtering_and_aggregation(user_request)

        metadata_values = table.get_sample_metadata().get_metadata_column_table_order(sample_labels, user_request.catvar)
        if user_request.get_custom_attr("colorvar") != "None":
            color_metadata_values = table.get_sample_metadata().get_metadata_column_table_order(sample_labels, user_request.get_custom_attr("colorvar"))
        else:
            color_metadata_values = []

        strata_values = None
        if user_request.get_custom_attr("strata").lower() != "none":
            strata_values = table.get_sample_metadata().get_metadata_column_table_order(sample_labels, user_request.get_custom_attr("strata"))

        sample_ids_to_metadata_map = table.get_sample_metadata().get_sample_id_to_metadata_map(user_request.catvar)

        phylogenetic_tree = table.get_phylogenetic_tree()

        if user_request.get_custom_attr("api").lower() == "beta":
            return self.analyse(user_request, otu_table, headers, sample_labels, metadata_values, color_metadata_values, sample_ids_to_metadata_map, phylogenetic_tree)
        else:
            return self.analyse_permanova(user_request, otu_table, headers, sample_labels, metadata_values, strata_values, sample_ids_to_metadata_map)