diff --git a/assets/slides.html b/assets/slides.html index ff44f3d..32621e5 100644 --- a/assets/slides.html +++ b/assets/slides.html @@ -1266,9 +1266,6 @@

Polyglot programming for single-cell analysis

-
- -

Introduction

    @@ -1413,7 +1410,7 @@

    Rpy2

  1. rpy2.robjects, the high-level interface
  2. -
    +
    import rpy2
     import rpy2.robjects as robjects
     
    @@ -1440,7 +1437,7 @@ 

    Rpy2

    Rpy2: basics

    -
    +
    str_vector = robjects.StrVector(['abc', 'def', 'ghi'])
     flt_vector = robjects.FloatVector([0.3, 0.8, 0.7])
     int_vector = robjects.IntVector([1, 2, 3])
    @@ -1460,7 +1457,7 @@ 

    Rpy2: basics

    Rpy2: numpy

    -
    +
    import numpy as np
     
     from rpy2.robjects import numpy2ri
    @@ -1472,18 +1469,18 @@ 

    Rpy2: numpy

    mtx = robjects.r.matrix(rd_m, nrow = 5) print(mtx)
    -
    [[0.31332317 0.35364146 0.56282682 0.85862223]
    - [0.62741044 0.572032   0.69183808 0.7092725 ]
    - [0.3976838  0.34202251 0.23438556 0.59881822]
    - [0.78234652 0.99630959 0.18262528 0.83434156]
    - [0.54189244 0.31409299 0.85954986 0.70672631]]
    +
    [[0.92902919 0.24572561 0.13860008 0.62978886]
    + [0.21979936 0.43720737 0.61998573 0.49151776]
    + [0.99598827 0.35626021 0.12943936 0.15135163]
    + [0.8411791  0.3295325  0.76558594 0.32489612]
    + [0.2671875  0.25684477 0.88505818 0.14963159]]

    Rpy2: pandas

    -
    +
    import pandas as pd
     
     from rpy2.robjects import pandas2ri
    @@ -1506,7 +1503,7 @@ 

    Rpy2: pandas

    Rpy2: sparse matrices

    -
    +
    import scipy as sp
     
     from anndata2ri import scipy2ri
    @@ -1519,11 +1516,11 @@ 

    Rpy2: sparse matrices

    5 x 4 sparse Matrix of class "dgCMatrix"
                                                 
    -[1,] 0.3133232 0.3536415 0.5628268 0.8586222
    -[2,] 0.6274104 0.5720320 0.6918381 0.7092725
    -[3,] 0.3976838 0.3420225 0.2343856 0.5988182
    -[4,] 0.7823465 0.9963096 0.1826253 0.8343416
    -[5,] 0.5418924 0.3140930 0.8595499 0.7067263
    +[1,] 0.9290292 0.2457256 0.1386001 0.6297889
    +[2,] 0.2197994 0.4372074 0.6199857 0.4915178
    +[3,] 0.9959883 0.3562602 0.1294394 0.1513516
    +[4,] 0.8411791 0.3295325 0.7655859 0.3248961
    +[5,] 0.2671875 0.2568448 0.8850582 0.1496316
     
    @@ -1641,9 +1638,6 @@

    Reticulate scanpy

    # obsm: 'HTO_clr', 'X_pca', 'X_umap', 'protein_counts' # varm: 'PCs' # obsp: 'connectivities', 'distances'
    -
    -
    -

    Disk-based interoperability

    @@ -1955,16 +1949,18 @@

    Define tasks in Pixi

    Also possible to use containers

    docker pull berombau/polygloty-docker:latest
     docker run -it -v $(pwd)/usecase:/app/usecase -v $(pwd)/book:/app/book berombau/polygloty-docker:latest pixi run pipeline
    -

    Another approach is to use multi-package containers to create custom combinations of packages. - Multi-Package BioContainers - Seqera Containers

    +

Workflows

You can go a long way with a folder of notebooks or scripts and the right tools. But as your project grows more bespoke, it can be worth the effort to use a workflow framework like Viash, Nextflow or Snakemake to manage the pipeline for you.

See https://saeyslab.github.io/polygloty/book/workflow_frameworks/

-
- -
-

Takeaways

-
- -

Introduction

    @@ -1413,7 +1410,7 @@

    Rpy2

  1. rpy2.robjects, the high-level interface
  2. -
    +
    import rpy2
     import rpy2.robjects as robjects
     
    @@ -1440,7 +1437,7 @@ 

    Rpy2

    Rpy2: basics

    -
    +
    str_vector = robjects.StrVector(['abc', 'def', 'ghi'])
     flt_vector = robjects.FloatVector([0.3, 0.8, 0.7])
     int_vector = robjects.IntVector([1, 2, 3])
    @@ -1460,7 +1457,7 @@ 

    Rpy2: basics

    Rpy2: numpy

    -
    +
    import numpy as np
     
     from rpy2.robjects import numpy2ri
    @@ -1472,18 +1469,18 @@ 

    Rpy2: numpy

    mtx = robjects.r.matrix(rd_m, nrow = 5) print(mtx)
    -
    [[0.31332317 0.35364146 0.56282682 0.85862223]
    - [0.62741044 0.572032   0.69183808 0.7092725 ]
    - [0.3976838  0.34202251 0.23438556 0.59881822]
    - [0.78234652 0.99630959 0.18262528 0.83434156]
    - [0.54189244 0.31409299 0.85954986 0.70672631]]
    +
    [[0.92902919 0.24572561 0.13860008 0.62978886]
    + [0.21979936 0.43720737 0.61998573 0.49151776]
    + [0.99598827 0.35626021 0.12943936 0.15135163]
    + [0.8411791  0.3295325  0.76558594 0.32489612]
    + [0.2671875  0.25684477 0.88505818 0.14963159]]

    Rpy2: pandas

    -
    +
    import pandas as pd
     
     from rpy2.robjects import pandas2ri
    @@ -1506,7 +1503,7 @@ 

    Rpy2: pandas

    Rpy2: sparse matrices

    -
    +
    import scipy as sp
     
     from anndata2ri import scipy2ri
    @@ -1519,11 +1516,11 @@ 

    Rpy2: sparse matrices

    5 x 4 sparse Matrix of class "dgCMatrix"
                                                 
    -[1,] 0.3133232 0.3536415 0.5628268 0.8586222
    -[2,] 0.6274104 0.5720320 0.6918381 0.7092725
    -[3,] 0.3976838 0.3420225 0.2343856 0.5988182
    -[4,] 0.7823465 0.9963096 0.1826253 0.8343416
    -[5,] 0.5418924 0.3140930 0.8595499 0.7067263
    +[1,] 0.9290292 0.2457256 0.1386001 0.6297889
    +[2,] 0.2197994 0.4372074 0.6199857 0.4915178
    +[3,] 0.9959883 0.3562602 0.1294394 0.1513516
    +[4,] 0.8411791 0.3295325 0.7655859 0.3248961
    +[5,] 0.2671875 0.2568448 0.8850582 0.1496316
     
    @@ -1641,9 +1638,6 @@

    Reticulate scanpy

    # obsm: 'HTO_clr', 'X_pca', 'X_umap', 'protein_counts' # varm: 'PCs' # obsp: 'connectivities', 'distances'
    -
    -
    -

    Disk-based interoperability

    @@ -1955,16 +1949,18 @@

    Define tasks in Pixi

    Also possible to use containers

    docker pull berombau/polygloty-docker:latest
     docker run -it -v $(pwd)/usecase:/app/usecase -v $(pwd)/book:/app/book berombau/polygloty-docker:latest pixi run pipeline
    -

    Another approach is to use multi-package containers to create custom combinations of packages. - Multi-Package BioContainers - Seqera Containers

    +

Workflows

You can go a long way with a folder of notebooks or scripts and the right tools. But as your project grows more bespoke, it can be worth the effort to use a workflow framework like Viash, Nextflow or Snakemake to manage the pipeline for you.

See https://saeyslab.github.io/polygloty/book/workflow_frameworks/

-
- -
-

Takeaways