Problem with survival analysis with gene symbols containing hyphen
1
0
Entering edit mode
9 months ago

Dear all,

I faced the problem of conducting a survival analysis with the gene symbols having hyphens, such as HLA-DPA1. I get the following error:

esca_HLA-DPA1= esca_matrix_vst %>% as.data.frame() %>% rownames_to_column (var='gene_id') %>% gather (key='case_id', value='counts', -gene_id) %>%
  left_join(. , gene_metadata, by="gene_id") %>%
  filter(gene_name == "HLA-DPA1")
Error in esca_HLA - DPA1 = esca_matrix_vst %>% as.data.frame() %>% rownames_to_column(var = "gene_id") %>%  : 
      object 'esca_HLA' not found

Can you advise me to change this code such that it can recognize the gene symbol?

Regards
Nazanin

R Survival-analysis • 506 views
ADD COMMENT
1
Entering edit mode
9 months ago
Darked89 4.7k

R dies not accept variable names with a dash in it. You should change esca_HLA-DPA1 to i.e esca_HLA_DPA1

See: https://www.w3schools.com/r/r_variables_name.asp

ADD COMMENT
0
Entering edit mode

Thank u so much for your comment. I will try it

ADD REPLY

Login before adding your answer.

Traffic: 2143 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6