This is a test version of Biostars. For the public version, visit https://www.biostars.org.
excluding a list of genes from an expression profile

Sorry friends,

I have a microarray dataset, genes in row and samples in column. I have a list of genes that I need only this list among the dataset and I want to exclude another genes. In other work I just need the expression of genes in my list not all genes in the row. how I can exclude the rest of genes? First I thought about venn diagram to see the intersection and cut and past the intersect manually in excel but I think this would last long time

Thank you

gene r

Couldn't you take an introductory R course or something? You could learn how to index a matrix or properly, using e.g. match. No offense, but it looks like you are getting stuck all the time because you don't know basic stuff in R.

thank you Michael,

i am in max planck institute, colloides and interfaces, Berlin...since my arrival i searched a lot for R, bioinformatics, so on courses but nothing...i asked help from many people in bioinformatics department but they are too busy and rejected me by few words.. in biostar i always could solve my problem even after some arguments!

thank you, hope to learn R..

Consider this example

Your microarray dataset matrix => X

Genes   Sample-1       Sample-2    Sample-3
    A        0.2            0.3         0.4             
    B        0.9            2.0         0.9
    C        1.0            2.3           4
    D          2            2.8         3.2
    E        2.2            1.7         0.1

The list of genes you want to extract => Y

Genes
    C
    E
    A
XS1 <- match(Y[,1],X1[,1],nomatch=NA_integer_,incomparables=NULL)
your_genes <- X[XS1,]
write.table(your_genes, file = "final_list.xls", sep = "\t", col.names = TRUE, row.names = FALSE)

If you are working with R, I would suggest you to get perfect with R basics. Good luck.

sorry, I did like below but in column I don have the sample name anymore

> setwd("E:/Affy data Col-0 priming")
> RMA <- read.delim("E:/Affy data Col-0 priming/RMA.txt", header=FALSE)
>   View(RMA)
> mycounts <- read.table("RMA.txt", sep="\t", header=TRUE)
> excluding <- read.table("E:/Affy data Col-0 priming/excluding.txt", quote="\"", comment.char="")
>   View(excluding)
> S <- read.table("excluding.txt", sep="", header=F)
> XS1 <- match(excluding[,1],RMA1[,1],nomatch=NA_integer_,incomparables=NULL)
Error in match(excluding[, 1], RMA1[, 1], nomatch = NA_integer_, incomparables = NULL) : 
  object 'RMA1' not found
> XS1 <- match(excluding[,1],RMA[,1],nomatch=NA_integer_,incomparables=NULL)
> mycounts <- RMA[XS1,]
> write.table(mycounts, file = "final_list.txt", sep = "\t", col.names = TRUE, row.names = FALSE)
> write.table(mycounts, file = "final_list.txt", sep = "\t", col.names = TRUE, row.names = T)
> header(mycounts)
Error: could not find function "header"
> head(mycounts)
             V1               V2               V3               V4               V5
3425  AT1G53540 4.33805912088666 4.56717597785314 4.31699157444953 6.63733250254801
13839 AT4G10250 5.54088498858581 5.06260528716105 5.58895459608889 5.09960147344372
17241 AT5G12020 4.85075472868197 5.97981091681778 4.61311961971554 6.70084032086995
15287 AT4G27670 4.94783908331899 4.53323839927969 4.64028276820974  4.3887886168914
20530 AT5G59720 6.16724160637511 5.88516161089836 6.24121644210157 5.93223068617705
1497  AT1G18970 5.18955605652289 4.93183017186116 5.25335960179554 5.29563912307846

It's because you have mentioned the header in RMA as FALSE. Check out this.

setwd("E:/Affy data Col-0 priming")
RMA <- read.delim("E:/Affy data Col-0 priming/RMA.txt", header=TRUE)
excluding <- read.table("E:/Affy data Col-0 priming/excluding.txt", quote="\"", comment.char="")

XS1 <- match(excluding[,1],RMA[,1],nomatch=NA_integer_,incomparables=NULL)
mycounts <- RMA[XS1,]
write.table(mycounts, file = "final_list.xls", sep = "\t", col.names = TRUE, row.names = FALSE)

I really suggest you to take an R course before proceeding with the analysis.

thank you,

your code worked

0 answers

No answers yet.

Log in to answer this question.