[BioC] HOW TO FIND THE SIMILAR GENES FROM BETWEEN TWO FILES

Ting-Yuan Liu (FHCRC) tliu at fhcrc.org
Thu Jul 28 10:37:10 CEST 2005


If you can read these two files into R by read.table or read.csv, you can 
then find out the intersect between the two Genebank-accession-numbers 
columns.

For example, if the two files are read into two objects called file.1 and 
file.2, and suppose that the first column is the GeneBankID.  Then try 
this:

commonGeneID <- intersect(file.1[,1], file.2[,1])
file.1.common <- file.1[sapply(commonGeneID, function(x) 
which(x==file.1[,1])),]
file.2.common <- file.2[sapply(commonGeneID, function(x) 
which(x==file.2[,1])),]

then file.1.common and file.2.common is the intersect of file.1 and 
file.2.  Write them out.

Is this what you want?

HTH,
Ting-Yuan

On Wed, 27 Jul 2005, weinong han wrote:

> Dear All,
>  
> I am confronted with another problems and need your help again.
> I have two .txt files including Genebank accession numbers, respectively. I want to find the genes with the same GB Acession numbers from between two .txt files. Excel cannot open the bigger file, so I cannot run the match using Excel.
>  
> Anybody have the experience? any suggestions and advice will be much appreciated.
>  
> My OS is Windows XP.
>  
> thanks in advance.
> 
> 
> Best Regards
>  
> Han Weinong  
> hanweinong at yahoo.com
> 
> __________________________________________________
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
>



More information about the Bioconductor mailing list