theislab / single-cell-best-practices

https://www.sc-best-practices.org
https://www.sc-best-practices.org
Other
768 stars 181 forks source link

OSError: File "neurips_processed_output.loom" not found #217

Closed ngvananh2508 closed 1 year ago

ngvananh2508 commented 1 year ago

Hi, I am practicing with gene regulatory networks chapter, when I ran these code lines: lf = lp.connect(loom_path_output, mode = "r+", validate = False) auc_mtx = pd.DataFrame(lf.ca.RegulonsAUC, index = lf.ca.CellID) lf.close()

It raised this error.

In the tutorial, you just assigned this string: "/data/neurips_processed_output.loom" to this variable: "loom_path_output", but you did not create this file yet.

I tried to replace this variable by "reg.csv", and "pyscenic_ctx_stdout.txt" which are the outputs of this code: if not os.path.exists('reg.csv'): !pyscenic ctx adj.csv \ {db_names} \ --annotations_fname {motif_path} \ --expression_mtx_fname {loom_path} \ --output reg.csv \ --mask_dropouts \ --num_workers {num_workers} > pyscenic_ctx_stdout.txt

but it raised other error: KeyError: "Unable to open object (object 'row_attrs' doesn't exist)".

Thank you very much for assisting me!

ilibarra commented 1 year ago

@ngvananh2508 thanks for your message. I think you are not using the latest version of the rendered notebook. In it, there is a snippet before the one you indicate, that creates the processed loom file by calling auccell.

if not os.path.exists(loom_path_output):
    !pyscenic aucell $loom_path \
        reg.csv \
        --output {loom_path_output} \
        --num_workers {num_workers} > pyscenic_aucell_stdout.txt

After this step, you should be able to run the next snippet.

import json
import zlib
import base64

# collect SCENIC AUCell output
lf = lp.connect(loom_path_output, mode="r+", validate=False)
auc_mtx = pd.DataFrame(lf.ca.RegulonsAUC, index=lf.ca.CellID)
lf.close()

Please indicate whether you cannot run the first snippet (auccell), or if you get another error during its execution. This should solve this problem. Thank you.

ngvananh2508 commented 1 year ago

Thank you for helping me!