Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the infercnvpy output observation.txt file like inferCNV(R)? #141

Open
XinheG opened this issue Aug 1, 2024 · 2 comments
Open

Can the infercnvpy output observation.txt file like inferCNV(R)? #141

XinheG opened this issue Aug 1, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@XinheG
Copy link

XinheG commented Aug 1, 2024

Description of feature

Hello,

I am attempting to reconstruct a function from R to Python that can differentiate between malignant and benign tumor cells recently, and it seems that the infercnvpy does not generate this output file as the R package.

In R, the function that I'm trying to reconstruct utilies a direct output file named infercnv.observations.txt, which is the tumor cell matrix data values. This file is automatically generated by running infercnv_obj <- infercnv::run(infercnv_obj, ...). In the R version of inferCNV, this generation of the file is determined by the parameter write_expr_matrix=T, which appears in the function plot_cnv that is written in the R script inferCNV_heatmap.R.

It could be seen from the code that this file is generated from the infercnv_obj@expr.data , then passed to obs_data in the function plot_cnv:

obs_data <- infercnv_obj@expr.data

and is finally processed by the function heatmap.cnv that begins from line 1,373, before written into the txt file as follow:

if ("matrix" %in% is(obs_data)) {
    if (write_expr_matrix) {
        flog.info(paste("plot_cnv_observations:Writing observation data to", observation_file_base, sep=" "))
        row.names(obs_data) <- orig_row_names
        write.table(as.matrix(t(obs_data[data_observations$rowInd, data_observations$colInd])), file=observation_file_base)
    }
}

As I am new to the python version of inferCNV, I am wondering does the infercnvpy contains the same data as the observations.txt after the analysis process is compelete? If it does exist, how could I extract it?

Thanks a lot for answering this question, it would really help me a lot with my study.

Sincerely yours.

@XinheG XinheG added the enhancement New feature or request label Aug 1, 2024
@grst
Copy link
Member

grst commented Aug 5, 2024

Hi @XinheG,

not sure if I correctly understood the question, but the expression values are usually available from

adata.X

or if you store raw value separately in

adata.raw.X

@XinheG
Copy link
Author

XinheG commented Aug 13, 2024

Hi @XinheG,

not sure if I correctly understood the question, but the expression values are usually available from

adata.X

or if you store raw value separately in

adata.raw.X

Thank you so much for answering. I'll go check. That would really help me a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants