Entering edit mode
6 months ago
Chris
▴
340
Hi Biostars,
I follow this tutorial to perform GSVA: https://alexslemonade.github.io/refinebio-examples/02-microarray/pathway-analysis_microarray_03_gsva.html
They can create a matrix name filtered_mapped_matrix with row names are only number. I convert my column EntrezID to row name and got X before EntrezID, so I would like to remove it. However, this code didn't work.
rownames(your_data) <- gsub("^X", "", rownames(your_data))
Would you please have a suggestion? I can't upload a screenshot here to illustrate as I got this error from Biostar: Exceeded the maximum amount of images you can upload. Thank you so much.
You don't need to upload the screenshot, you can simply copy-paste the content. Also "code didn't work" is not a sufficient description - was any error message displayed? How did you deduce that the code did not work?
Also, did you check online if rownames can be numeric?
There is no error message and nothing changes with the variable your_data. I can't copy and paste a matrix from Rstudio to here that keep the information in the right format. I read that rownames can't start with number but don't know why the tutorial has rownames are only number.
Yes, you can. Ensure you're only copy-pasting a limited number of rows and columns (10, say):
Can you point to where this happens in the tutorial, please? Are you speaking about the
tibble::column_to_rownames("entrez_id")
in section 4.3? If so, they don't seem to care what happens to the Entrez IDs, so why do you care?Yes, section 4.3. Variable: filtered_mapped_matrix. Seem they format Entrez_ID as character with allowing number as rowname. The matrix has thousand of columns so I can't use mouse to select first few rows and columns. It will automatically select all column.
What are you trying to do with the mouse? All you gotta do is run
your_data[1:10,1:10]
on the Console.I don't see them doing that, but you could. Try:
Thank you for the suggestion! It turns out that if I use
View(your_data)
, it will show X at the beginning of each rowname butyour_data[1:4,1:4]
is not. ButView(filtered_mapped_matrix)
, it doesn't show X. Maybe they formatEntrez_id
as character. Do I need to delete some old images in previous posts to able to upload new images?I don't know, Maybe Istvan Albert can answer. In any case, you should not be uploading screenshots of plain text content. Read my post on this topic: How to Use Biostars Part-3: Formatting Text and Using GitHub Gists (skip the part on the strikethrough, the rest should help you)
Try to get rowname as chracter but still didn't work
The rowname in the tutorial is right align, so it is still number. Anyway the row name doesn't have X, it is only how
View()
work.That makes no sense.
rownames(your_data)
is already a character vector. Are you sure you know what you're doing?Just trying possible solutions. Seem I trying to remove something doesn't exist. But when using
View()
, it will show in my case but not in the tutorial.You've isolated the problem to
View
on Rstudio. Running any R code on the data.frame is not going to help. I ran the following code on Rstudio and it worked without any prefix so you might actually have a different problem:It showed the matrix with no X prefixes. In my experience, the prefixes are added only on import (which can be avoided using
check.names=FALSE
), so there is some problem at the file or the file-reader level.