-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_helpers.py
32 lines (26 loc) · 898 Bytes
/
_helpers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ----------------------------------------------------------------------------
# Copyright (c) 2024, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
from rpy2.robjects.packages import importr
import importlib.resources
from pathlib import Path
import shutil
ggplot2 = importr('ggplot2')
def _ggplot2_object_to_visualization(
ggplot2_obj: object, output_dir: Path, width: int, height: int
) -> None:
'''
'''
index = importlib.resources.files('q2_qsip2') / 'assets' / 'index.html'
shutil.copy(index, output_dir)
ggplot2.ggsave(
filename=str(output_dir / 'figure.svg'),
plot=ggplot2_obj,
device='svg',
width=width,
height=height,
)