Trying to filter loom file in R.

I have done analysis with seurat and trying to add another layer with velocity analysis scvelo (python). I could probably also do it in python with loompy library.
From what I saw, the velocity analysis start from the 10x directory but I have already filtered seurat object and save it in an rds file. I have a list of ids in a csv files. I want only use these cells for the analysis of velocity.

I'm using ReadVelocity to read the loom file and then convert to seurat but then I'm trying to subset the object .

I'm trying to keep only the cells I previously kept after cleaning by mito and ribo thresholds in seurat saving into rds and exported in csv file...

But loom file come into the game and it's not fun. 

Any help would be welcome. Thanks.


    ldat <- ReadVelocity(file = "data.loom")
    bm <- as.Seurat(x = ldat)
    
    ids <- read.csv(file = 'daata_cellID_obs.csv', header = TRUE)
    
    bm[["RNA"]] <- bm[["spliced"]]
    dim(ids)
    colnames(ids) <- "cells" 
    dim(bm)
    bm <- subset(object = bm, cells = ids$cells)
    


It  says "argument x is missing with no default value."
> [1] 11178     1 [1] 33694 12011 Error in UpdateSlots(object = x) :   
> l'argument "x" est manquant, avec aucune valeur par défaut Calls:
> subset ... subset.Seurat -> UpdateSlots -> sapply -> lapply ->
> slotNames -> is Exécution arrêtée


Finally end up with the python way.

    import numpy as np
    import pandas as pd
    
    from anndata import AnnData
    from scanpy import read
    
    import scvelo as scv
    
    import loompy
    
    # export HDF5_USE_FILE_LOCKING='FALSE'
    # ssh -X
    
    print("sample_obs")
    sample_obs    = pd.read_csv("/data/villemin/data/toulouse/scRNA-ALL/CellRanger/clusters/4006_rouge.4006_verte.CTL_Rouges.CTL_Vertes_cellID_obs.csv")
    sample_obs.rename(columns={'Cells(seurat.Object)':'CellID'}, inplace=True )
    
    sample_obs['CellID'] = sample_obs['CellID'].str[::-1]
    sample_obs['CellID'] = sample_obs['CellID'].str.replace('_',':',1)
    sample_obs['CellID'] = sample_obs['CellID'].str[::-1]
    sample_obs['CellID'] = sample_obs['CellID'].str.replace('-1','x')
    
    print(sample_obs.head())
    
    
    filename = "/data/villemin/code/singleCell/python/4006_CTL_OSI.loom"
    outputname = "/data/villemin/code/singleCell/python/4006_CTL_OSI.filtered.loom"
    
    with loompy.connect(filename) as ds:
        view = ds.view[:, np.isin(ds.ca.CellID, sample_obs['CellID'])]
        
    loompy.create(outputname, view.layers, view.ra, view.ca)