How to extract fold change data for a list of specified genes using R?
1
0
Entering edit mode
6.6 years ago
cs308 • 0

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.

genome R expression-array gene • 3.9k views
ADD COMMENT
0
Entering edit mode

vlookup in excel does the same trick.

ADD REPLY
1
Entering edit mode
6.6 years ago
ATpoint 82k
# 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 COMMENT
0
Entering edit mode

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 REPLY

Login before adding your answer.

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