예제 #1
0
    def make_html_map(state: DatasetExportState, base_path: Path) -> dict:
        html_map = {
            "css_style":
            Util.get_css_content(DatasetExportHTMLBuilder.CSS_PATH),
            "name":
            state.name,
            'immuneML_version':
            MLUtil.get_immuneML_version(),
            "full_specs":
            Util.get_full_specs_path(base_path),
            "datasets": [{
                "dataset_name":
                dataset.name,
                "dataset_type":
                StringHelper.camel_case_to_word_string(type(dataset).__name__),
                "dataset_size":
                f"{dataset.get_example_count()} {type(dataset).__name__.replace('Dataset', 's').lower()}",
                "labels": [{
                    "label_name": label
                } for label in dataset.get_label_names()],
                "formats": [{
                    "format_name":
                    format_name,
                    "dataset_download_link":
                    os.path.relpath(path=Util.make_downloadable_zip(
                        state.result_path,
                        state.paths[dataset.name][format_name]),
                                    start=base_path)
                } for format_name in state.formats]
            } for dataset in state.datasets]
        }

        return html_map
예제 #2
0
    def make_html_map(state: DatasetExportState, base_path: Path) -> dict:
        html_map = {
            "css_style": Util.get_css_content(DatasetExportHTMLBuilder.CSS_PATH),
            "name": state.name,
            'immuneML_version': MLUtil.get_immuneML_version(),
            "full_specs": Util.get_full_specs_path(base_path),
            "datasets": [
                {
                    "dataset_name": dataset.name,
                    "dataset_type": StringHelper.camel_case_to_word_string(type(dataset).__name__),
                    "dataset_size": f"{dataset.get_example_count()} {type(dataset).__name__.replace('Dataset', 's').lower()}",
                    "labels": [{"label_name": label} for label in dataset.get_label_names()],
                    "preprocessing_sequence": [
                        {
                            "preprocessing_name": preprocessing.__class__.__name__,
                            "preprocessing_params": ", ".join([f"{key}: {value}" for key, value in vars(preprocessing).items()])
                        } for preprocessing in state.preprocessing_sequence
                    ] if state.preprocessing_sequence is not None else [],
                    "show_preprocessing": state.preprocessing_sequence is not None and len(state.preprocessing_sequence) > 0,
                    "formats": [
                        {
                            "format_name": format_name,
                            "dataset_download_link": os.path.relpath(path=Util.make_downloadable_zip(state.result_path, state.paths[dataset.name][format_name]),
                                                                     start=base_path)
                        } for format_name in state.formats
                    ]
                } for dataset in state.datasets
            ]
        }

        return html_map
예제 #3
0
    def make_html_map(state: SimulationState, base_path: Path) -> dict:

        html_map = {
            "css_style":
            Util.get_css_content(SimulationHTMLBuilder.CSS_PATH),
            "name":
            state.name,
            'immuneML_version':
            MLUtil.get_immuneML_version(),
            "full_specs":
            Util.get_full_specs_path(base_path),
            "dataset_name":
            state.resulting_dataset.name if state.resulting_dataset.name
            is not None else state.resulting_dataset.identifier,
            "dataset_type":
            StringHelper.camel_case_to_word_string(
                type(state.resulting_dataset).__name__),
            "example_count":
            state.resulting_dataset.get_example_count(),
            "dataset_size":
            f"{state.resulting_dataset.get_example_count()} {type(state.resulting_dataset).__name__.replace('Dataset', 's').lower()}",
            "labels": [{
                "label_name": label
            } for label in state.resulting_dataset.get_label_names()],
            "formats": [{
                "format_name":
                format_name,
                "dataset_download_link":
                os.path.relpath(path=Util.make_downloadable_zip(
                    state.result_path,
                    state.paths[state.resulting_dataset.name][format_name]),
                                start=base_path)
            } for format_name in state.formats],
            "implantings": [
                Util.to_dict_recursive(implanting, base_path)
                for implanting in state.simulation.implantings
            ]
        }

        return html_map