Question: How to extract fold change data for a list of specified genes using R?
0
gravatar for cs308
2.3 years ago by
cs3080
cs3080 wrote:

I am a newbie to R and I am analyzing expression data from an Illumina array. I have imported the excel file to R which includes in my column titles GENE SYMBOL and FOLD CHANGE. In this file there is fold change data for almost every gene in the genome. I want to know how to extract the fold change values for a list of specified gene names which will be under the gene symbol column.

ADD COMMENTlink modified 2.3 years ago by ATpoint30k • written 2.3 years ago by cs3080

vlookup in excel does the same trick.

ADD REPLYlink written 2.3 years ago by cpad011212k
1
gravatar for ATpoint
2.3 years ago by
ATpoint30k
Germany
ATpoint30k wrote:
# Make or load a list of genes that you want to check:
query.genes <- c("gene1", "gene2")

# Subset the data frame for these genes
tmp.subset <- your.df[your.df$genes == query.genes,]

# and get the column with the FCs
tmp.subset$FC

Adjust the names after $ according to your column names.

EDIT: Also, if your column name is really GENE SYMBOL, try to get used to avoid whitespaces and rather use GENE_SYMBOL or similar delimiters (and of course never use Excel :-D )

ADD COMMENTlink modified 2.3 years ago • written 2.3 years ago by ATpoint30k

Hi. Thanks so much. I am completely new to R. My colum title is actually just SYMBOL. When I try the second part: tmp.subset <- your.df[your.df$genes == query.genes,] It tells me : longer object length is not a multiple of shorter object length. What does this mean? Also I assume I replace "your.df" with the name of my file.

ADD REPLYlink written 2.3 years ago by cs3080
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1083 users visited in the last hour