diff --git a/book/in_memory/rpy2.html b/book/in_memory/rpy2.html index 1b2e3e9..fe06f8c 100644 --- a/book/in_memory/rpy2.html +++ b/book/in_memory/rpy2.html @@ -387,18 +387,18 @@


   0%|          | 0.00/9.82M [00:00<?, ?B/s]
-  0%|          | 8.00k/9.82M [00:00<02:09, 79.5kB/s]
-  0%|          | 32.0k/9.82M [00:00<01:01, 168kB/s] 
-  1%|          | 96.0k/9.82M [00:00<00:27, 369kB/s]
-  2%|2         | 208k/9.82M [00:00<00:15, 644kB/s] 
-  4%|4         | 424k/9.82M [00:00<00:08, 1.15MB/s]
-  9%|8         | 872k/9.82M [00:00<00:04, 2.20MB/s]
- 18%|#7        | 1.72M/9.82M [00:00<00:02, 4.23MB/s]
- 34%|###4      | 3.34M/9.82M [00:00<00:00, 7.32MB/s]
- 53%|#####2    | 5.17M/9.82M [00:00<00:00, 10.6MB/s]
- 65%|######4   | 6.34M/9.82M [00:01<00:00, 10.9MB/s]
- 88%|########7 | 8.62M/9.82M [00:01<00:00, 14.3MB/s]
-100%|##########| 9.82M/9.82M [00:01<00:00, 8.42MB/s]
+ 0%| | 8.00k/9.82M [00:00<03:15, 52.6kB/s] + 0%| | 32.0k/9.82M [00:00<01:31, 112kB/s] + 1%| | 96.0k/9.82M [00:00<00:41, 248kB/s] + 2%|1 | 192k/9.82M [00:00<00:25, 392kB/s] + 4%|3 | 400k/9.82M [00:00<00:13, 728kB/s] + 8%|8 | 816k/9.82M [00:00<00:06, 1.38MB/s] + 17%|#6 | 1.62M/9.82M [00:01<00:03, 2.70MB/s] + 29%|##9 | 2.88M/9.82M [00:01<00:01, 4.26MB/s] + 51%|##### | 4.98M/9.82M [00:01<00:00, 7.40MB/s] + 70%|######9 | 6.83M/9.82M [00:01<00:00, 8.85MB/s] + 91%|######### | 8.90M/9.82M [00:01<00:00, 10.3MB/s] +100%|##########| 9.82M/9.82M [00:01<00:00, 5.73MB/s]

 with anndata2ri.converter.context():
diff --git a/search.json b/search.json
index 4042047..be4fdcc 100644
--- a/search.json
+++ b/search.json
@@ -159,7 +159,7 @@
     "href": "book/in_memory/rpy2.html",
     "title": "4  Rpy2",
     "section": "",
-    "text": "4.1 Rpy2: basic functionality\nRpy2 is a foreign function interface to R. It can be used in the following way:\nimport rpy2\nimport rpy2.robjects as robjects\n\n/home/runner/work/polygloty/polygloty/renv/python/virtualenvs/renv-python-3.12/lib/python3.12/site-packages/rpy2/rinterface_lib/embedded.py:276: UserWarning: R was initialized outside of rpy2 (R_NilValue != NULL). Trying to use it nevertheless.\n  warnings.warn(msg)\nR was initialized outside of rpy2 (R_NilValue != NULL). Trying to use it nevertheless.\n\nvector = robjects.IntVector([1,2,3])\nrsum = robjects.r['sum']\n\nrsum(vector)\n\n\n        IntVector with 1 elements.\n        \n\n\n\n6\nLuckily, we’re not restricted to just calling R functions and creating R objects. The real power of this in-memory interoperability lies in the conversion of Python objects to R objects to call R functions on, and then to the conversion of the results back to Python objects.\nRpy2 requires specific conversion rules for different Python objects. It is straightforward to create R vectors from corresponding Python lists:\nstr_vector = robjects.StrVector(['abc', 'def', 'ghi'])\nflt_vector = robjects.FloatVector([0.3, 0.8, 0.7])\nint_vector = robjects.IntVector([1, 2, 3])\nmtx = robjects.r.matrix(robjects.IntVector(range(10)), nrow=5)\nHowever, for single cell biology, the objects that are most interesting to convert are (count) matrices, arrays and dataframes. In order to do this, you need to import the corresponding rpy2 modules and specify the conversion context.\nimport numpy as np\n\nfrom rpy2.robjects import numpy2ri\nfrom rpy2.robjects import default_converter\n\nrd_m = np.random.random((10, 7))\n\nwith (default_converter + numpy2ri.converter).context():\n    mtx2 = robjects.r.matrix(rd_m, nrow = 10)\nimport pandas as pd\n\nfrom rpy2.robjects import pandas2ri\n\npd_df = pd.DataFrame({'int_values': [1,2,3],\n                      'str_values': ['abc', 'def', 'ghi']})\n\nwith (default_converter + pandas2ri.converter).context():\n    pd_df_r = robjects.DataFrame(pd_df)\nOne big limitation of rpy2 is the inability to convert sparse matrices: there is no built-in conversion module for scipy. The anndata2ri package provides, apart from functionality to convert SingleCellExperiment objects to an anndata objects, functions to convert sparse matrices.\nimport scipy as sp\n\nfrom anndata2ri import scipy2ri\n\nsparse_matrix = sp.sparse.csc_matrix(rd_m)\n\nwith (default_converter + scipy2ri.converter).context():\n    sp_r = scipy2ri.py2rpy(sparse_matrix)\nWe will showcase how to use anndata2ri to convert an anndata object to a SingleCellExperiment object and vice versa as well:\nimport anndata as ad\nimport scanpy.datasets as scd\n\nimport anndata2ri\n\nadata_paul = scd.paul15()\n\n\n  0%|          | 0.00/9.82M [00:00<?, ?B/s]\n  0%|          | 8.00k/9.82M [00:00<02:09, 79.5kB/s]\n  0%|          | 32.0k/9.82M [00:00<01:01, 168kB/s] \n  1%|          | 96.0k/9.82M [00:00<00:27, 369kB/s]\n  2%|2         | 208k/9.82M [00:00<00:15, 644kB/s] \n  4%|4         | 424k/9.82M [00:00<00:08, 1.15MB/s]\n  9%|8         | 872k/9.82M [00:00<00:04, 2.20MB/s]\n 18%|#7        | 1.72M/9.82M [00:00<00:02, 4.23MB/s]\n 34%|###4      | 3.34M/9.82M [00:00<00:00, 7.32MB/s]\n 53%|#####2    | 5.17M/9.82M [00:00<00:00, 10.6MB/s]\n 65%|######4   | 6.34M/9.82M [00:01<00:00, 10.9MB/s]\n 88%|########7 | 8.62M/9.82M [00:01<00:00, 14.3MB/s]\n100%|##########| 9.82M/9.82M [00:01<00:00, 8.42MB/s]\n\n\nwith anndata2ri.converter.context():\n    sce = anndata2ri.py2rpy(adata_paul)\n    ad2 = anndata2ri.rpy2py(sce)",
+    "text": "4.1 Rpy2: basic functionality\nRpy2 is a foreign function interface to R. It can be used in the following way:\nimport rpy2\nimport rpy2.robjects as robjects\n\n/home/runner/work/polygloty/polygloty/renv/python/virtualenvs/renv-python-3.12/lib/python3.12/site-packages/rpy2/rinterface_lib/embedded.py:276: UserWarning: R was initialized outside of rpy2 (R_NilValue != NULL). Trying to use it nevertheless.\n  warnings.warn(msg)\nR was initialized outside of rpy2 (R_NilValue != NULL). Trying to use it nevertheless.\n\nvector = robjects.IntVector([1,2,3])\nrsum = robjects.r['sum']\n\nrsum(vector)\n\n\n        IntVector with 1 elements.\n        \n\n\n\n6\nLuckily, we’re not restricted to just calling R functions and creating R objects. The real power of this in-memory interoperability lies in the conversion of Python objects to R objects to call R functions on, and then to the conversion of the results back to Python objects.\nRpy2 requires specific conversion rules for different Python objects. It is straightforward to create R vectors from corresponding Python lists:\nstr_vector = robjects.StrVector(['abc', 'def', 'ghi'])\nflt_vector = robjects.FloatVector([0.3, 0.8, 0.7])\nint_vector = robjects.IntVector([1, 2, 3])\nmtx = robjects.r.matrix(robjects.IntVector(range(10)), nrow=5)\nHowever, for single cell biology, the objects that are most interesting to convert are (count) matrices, arrays and dataframes. In order to do this, you need to import the corresponding rpy2 modules and specify the conversion context.\nimport numpy as np\n\nfrom rpy2.robjects import numpy2ri\nfrom rpy2.robjects import default_converter\n\nrd_m = np.random.random((10, 7))\n\nwith (default_converter + numpy2ri.converter).context():\n    mtx2 = robjects.r.matrix(rd_m, nrow = 10)\nimport pandas as pd\n\nfrom rpy2.robjects import pandas2ri\n\npd_df = pd.DataFrame({'int_values': [1,2,3],\n                      'str_values': ['abc', 'def', 'ghi']})\n\nwith (default_converter + pandas2ri.converter).context():\n    pd_df_r = robjects.DataFrame(pd_df)\nOne big limitation of rpy2 is the inability to convert sparse matrices: there is no built-in conversion module for scipy. The anndata2ri package provides, apart from functionality to convert SingleCellExperiment objects to an anndata objects, functions to convert sparse matrices.\nimport scipy as sp\n\nfrom anndata2ri import scipy2ri\n\nsparse_matrix = sp.sparse.csc_matrix(rd_m)\n\nwith (default_converter + scipy2ri.converter).context():\n    sp_r = scipy2ri.py2rpy(sparse_matrix)\nWe will showcase how to use anndata2ri to convert an anndata object to a SingleCellExperiment object and vice versa as well:\nimport anndata as ad\nimport scanpy.datasets as scd\n\nimport anndata2ri\n\nadata_paul = scd.paul15()\n\n\n  0%|          | 0.00/9.82M [00:00<?, ?B/s]\n  0%|          | 8.00k/9.82M [00:00<03:15, 52.6kB/s]\n  0%|          | 32.0k/9.82M [00:00<01:31, 112kB/s] \n  1%|          | 96.0k/9.82M [00:00<00:41, 248kB/s]\n  2%|1         | 192k/9.82M [00:00<00:25, 392kB/s] \n  4%|3         | 400k/9.82M [00:00<00:13, 728kB/s]\n  8%|8         | 816k/9.82M [00:00<00:06, 1.38MB/s]\n 17%|#6        | 1.62M/9.82M [00:01<00:03, 2.70MB/s]\n 29%|##9       | 2.88M/9.82M [00:01<00:01, 4.26MB/s]\n 51%|#####     | 4.98M/9.82M [00:01<00:00, 7.40MB/s]\n 70%|######9   | 6.83M/9.82M [00:01<00:00, 8.85MB/s]\n 91%|######### | 8.90M/9.82M [00:01<00:00, 10.3MB/s]\n100%|##########| 9.82M/9.82M [00:01<00:00, 5.73MB/s]\n\n\nwith anndata2ri.converter.context():\n    sce = anndata2ri.py2rpy(adata_paul)\n    ad2 = anndata2ri.rpy2py(sce)",
     "crumbs": [
       "In-memory interoperability",
       "4  Rpy2"
diff --git a/sitemap.xml b/sitemap.xml
index bfb0dfd..48044f7 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -2,74 +2,74 @@
 
   
     https://saeyslab.github.io/polygloty/index.html
-    2024-09-11T19:57:09.780Z
+    2024-09-11T19:56:54.341Z
   
   
     https://saeyslab.github.io/polygloty/book/introduction.html
-    2024-09-11T19:57:09.776Z
+    2024-09-11T19:56:54.333Z
   
   
     https://saeyslab.github.io/polygloty/book/usecase/index.html
-    2024-09-11T19:57:09.776Z
+    2024-09-11T19:56:54.333Z
   
   
     https://saeyslab.github.io/polygloty/book/in_memory/pitfalls.html
-    2024-09-11T19:57:09.776Z
+    2024-09-11T19:56:54.333Z
   
   
     https://saeyslab.github.io/polygloty/book/in_memory/rpy2.html
-    2024-09-11T19:57:09.776Z
+    2024-09-11T19:56:54.333Z
   
   
     https://saeyslab.github.io/polygloty/book/in_memory/reticulate.html
-    2024-09-11T19:57:09.776Z
+    2024-09-11T19:56:54.333Z
   
   
     https://saeyslab.github.io/polygloty/book/disk_based/file_formats.html
-    2024-09-11T19:57:09.772Z
+    2024-09-11T19:56:54.329Z
   
   
     https://saeyslab.github.io/polygloty/book/disk_based/disk_based_pipelines.html
-    2024-09-11T19:57:09.772Z
+    2024-09-11T19:56:54.329Z
   
   
     https://saeyslab.github.io/polygloty/book/workflow_frameworks/review.html
-    2024-09-11T19:57:09.780Z
+    2024-09-11T19:56:54.337Z
   
   
     https://saeyslab.github.io/polygloty/book/workflow_frameworks/qualities.html
-    2024-09-11T19:57:09.780Z
+    2024-09-11T19:56:54.337Z
   
   
     https://saeyslab.github.io/polygloty/book/workflow_frameworks/quality_assessment.html
-    2024-09-11T19:57:09.780Z
+    2024-09-11T19:56:54.337Z
   
   
     https://saeyslab.github.io/polygloty/book/workflow_frameworks/viash_nextflow.html
-    2024-09-11T19:57:09.780Z
+    2024-09-11T19:56:54.337Z
   
   
     https://saeyslab.github.io/polygloty/book/workflow_frameworks/best_practices.html
-    2024-09-11T19:57:09.776Z
+    2024-09-11T19:56:54.333Z
   
   
     https://saeyslab.github.io/polygloty/book/book_slides.html
-    2024-09-11T19:57:09.772Z
+    2024-09-11T19:56:54.329Z
   
   
     https://saeyslab.github.io/polygloty/book/references.html
-    2024-09-11T19:57:09.776Z
+    2024-09-11T19:56:54.333Z
   
   
     https://saeyslab.github.io/polygloty/book/in_memory/index.html
-    2024-09-11T19:57:09.776Z
+    2024-09-11T19:56:54.333Z
   
   
     https://saeyslab.github.io/polygloty/book/disk_based/index.html
-    2024-09-11T19:57:09.772Z
+    2024-09-11T19:56:54.329Z
   
   
     https://saeyslab.github.io/polygloty/book/workflow_frameworks/index.html
-    2024-09-11T19:57:09.780Z
+    2024-09-11T19:56:54.337Z