DESeq2 swap ensembl gene id rownames with gene symbol column
2
0
Entering edit mode
@jasonwilliams-21306
Last seen 3.9 years ago

Is there an easy way to swap the row names in this data frame (in this case ensembl gene ids that were the first column in the gene count table generated from STAR) with gene id?

I would like to keep all the identifiers in the table, but swap - for example, hgnc symbol - with the row names. This will make it much easier for me when I'm manipulating the dataframe later on.

Wald test p-value: Condition Normal vs Extreme 
DataFrame with 16480 rows and 8 columns
                        baseMean     log2FoldChange             lfcSE               stat               pvalue                 padj  hgnc_symbol    entrezid
                       <numeric>          <numeric>         <numeric>          <numeric>            <numeric>            <numeric>  <character> <character>
ENSG00000223972 4.51685289775514   2.15550731621112  1.43343074902207   1.50374011279002    0.132648296504179    0.292089709671559      DDX11L1   100287102
ENSG00000278267 3.52926357135542 0.0672084810098236   1.8687740950403 0.0359639408466726    0.971311111378278    0.984802707352042    MIR6859-1   102466751
ENSG00000230021 34.7527277878475   3.18376204618685 0.577139078176496   5.51645550713033 3.45905009734984e-08 2.68321826693434e-06 LOC101928626   101928626
ENSG00000177757  13.254684151203 -0.355758563780635 0.566844518813169 -0.627612249873219    0.530257981962198    0.706449586670417       FAM87B      400728
ENSG00000228794 339.345230342994  0.440735348198774 0.225273115379179   1.95644894179641   0.0504122915707138    0.153177028381987    LINC01128      643837
...                          ...                ...               ...                ...                  ...                  ...          ...         ...
ENSG00000212907 13316.6212444405  -1.29749484848357 0.734627626363388  -1.76619392181932   0.0773633204369255    0.204515519463446         ND4L        4539
ENSG00000198886 202122.249106362  0.102983861749155 0.633779243148049  0.162491692276988    0.870918669941202    0.931706464999579          ND4        4538
ENSG00000198786 117214.179395624  0.365274513410682 0.651430081099186  0.560727120237277    0.574983576113379    0.741572320729196          ND5        4540
ENSG00000198695 25719.2572032967   0.17861898817241 0.479782318460458  0.372291727518365    0.709675657170189    0.834502165470665          ND6        4541
ENSG00000198727 117114.965672949  0.140668405549489 0.564196791170924  0.249325071944399    0.803109338951998    0.891399787624092         CYTB        4519

Any help would be appreciated,

Best wishes,

Jason

deseq2 dataframe ensembl gene id gene symbol entrezid • 2.4k views
ADD COMMENT
0
Entering edit mode

I would not do this. Ensembl gene IDs are for sure unique. Gene symbols might not be.

ADD REPLY
0
Entering edit mode
@james-w-macdonald-5106
Last seen 12 hours ago
United States

You are in essence asking how to manipulate columns in a DataFrame, which is just basic R stuff. If you need help with basic manipulations, you should read An Intro to R.

If you need help mapping IDs from one thing to another, see the AnnotationDbi vignette.

If you need help with manipulating a DataFrame there is a help page, which you can access by typing ?DataFrame at an R prompt.

ADD COMMENT
0
Entering edit mode

Hi James, I already used the Annotation Dbi vignette to get this table. I managed to figure out the manipulation of the data frame, which is difficult to do simply from R prompt - for me at least.. I post the solution below in case anyone would like to directly swap gene identifiers around.

ADD REPLY
0
Entering edit mode
@jasonwilliams-21306
Last seen 3.9 years ago

If you have a similar table to the one I had after using the Annotation Dbi vignette to map the other identifiers to e.g. Ensemble gene_ids.

One option is to use:

tmp = rownames(df) then rownames(df) <- df$hgnc_symbol) and finally df$hgnc_symbol <- tmp
ADD COMMENT

Login before adding your answer.

Traffic: 589 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