Import a text file
1
0
Entering edit mode
Chirag Gupta ▴ 30
@chirag-gupta-5975
Last seen 10.2 years ago
Hi I have a gene expression matrix of 21746 X 16 in a .txt file This is a subset shown below Locus ID Stage1 Stage2 Stage3 Stage4 AT1G01010 5.249586 4.966158765 5.523153 5.872942491 AT1G01030 4.645518 4.13401959 4.480153 4.278106108 AT1G01040 8.367959 9.004792207 7.045742 7.969386196 AT1G01050 10.05919 9.937913426 9.822789 9.761852365 AT1G01060 9.32046 7.729952133 7.450211 9.509721634 AT1G01070 4.967583 3.901125815 6.429503 6.114024786 AT1G01080 7.176741 6.428628132 8.923322 7.39688902 AT1G01090 10.38129 9.557772838 10.99624 10.11981964 AT1G01100 12.12936 12.43516812 11.67846 10.92524171 I want to read in this text file and calculate pearson correlations between gene pairs across the samples. I tried this >mat=read.table(file="exp_mat.txt", header=T, sep="\t") but when I do rownames(exp.mat), it shows numbers from to the total rows. Which is the correct method to read in such a file so that the rows and columns are preserved and cor() can be run on rows? Thanks! -- *Chirag Gupta* Department of Crop, Soil, and Environmental Sciences, 115 Plant Sciences Building, Fayetteville, Arkansas 72701 [[alternative HTML version deleted]]
• 811 views
ADD COMMENT
0
Entering edit mode
@sylvainbrohee-4860
Last seen 10.2 years ago
Hi, You should maybe try something like mat=read.delim(file="exp_mat.txt", header=T, row.names = 1) Cheers, Sylvain Le 13/07/2013 04:14, Chirag Gupta a ?crit : > Hi > > I have a gene expression matrix of 21746 X 16 in a .txt file > This is a subset shown below > > Locus ID Stage1 Stage2 Stage3 Stage4 AT1G01010 5.249586 4.966158765 > 5.523153 5.872942491 AT1G01030 4.645518 4.13401959 4.480153 4.278106108 > AT1G01040 8.367959 9.004792207 7.045742 7.969386196 AT1G01050 10.05919 > 9.937913426 9.822789 9.761852365 AT1G01060 9.32046 7.729952133 7.450211 > 9.509721634 AT1G01070 4.967583 3.901125815 6.429503 6.114024786 AT1G01080 > 7.176741 6.428628132 8.923322 7.39688902 AT1G01090 10.38129 9.557772838 > 10.99624 10.11981964 AT1G01100 12.12936 12.43516812 11.67846 10.92524171 > I want to read in this text file and calculate pearson correlations between > gene pairs across the samples. > > I tried this > >> mat=read.table(file="exp_mat.txt", header=T, sep="\t") > but when I do rownames(exp.mat), it shows numbers from to the total rows. > > Which is the correct method to read in such a file so that the rows and > columns are preserved and cor() can be run on rows? > > Thanks! > > >
ADD COMMENT
0
Entering edit mode
Thank you. That worked fine for me. On Sat, Jul 13, 2013 at 2:40 AM, Sylvain Brohée <sbrohee@ulb.ac.be> wrote: > Hi, > > You should maybe try something like > > mat=read.delim(file="exp_mat.**txt", header=T, row.names = 1) > > Cheers, > > Sylvain > > Le 13/07/2013 04:14, Chirag Gupta a écrit : > > Hi >> >> I have a gene expression matrix of 21746 X 16 in a .txt file >> This is a subset shown below >> >> Locus ID Stage1 Stage2 Stage3 Stage4 AT1G01010 5.249586 4.966158765 >> 5.523153 5.872942491 AT1G01030 4.645518 4.13401959 4.480153 4.278106108 >> AT1G01040 8.367959 9.004792207 7.045742 7.969386196 AT1G01050 10.05919 >> 9.937913426 9.822789 9.761852365 AT1G01060 9.32046 7.729952133 7.450211 >> 9.509721634 AT1G01070 4.967583 3.901125815 6.429503 6.114024786 >> AT1G01080 >> 7.176741 6.428628132 8.923322 7.39688902 AT1G01090 10.38129 9.557772838 >> 10.99624 10.11981964 AT1G01100 12.12936 12.43516812 11.67846 10.92524171 >> I want to read in this text file and calculate pearson correlations >> between >> gene pairs across the samples. >> >> I tried this >> >> mat=read.table(file="exp_mat.**txt", header=T, sep="\t") >>> >> but when I do rownames(exp.mat), it shows numbers from to the total rows. >> >> Which is the correct method to read in such a file so that the rows and >> columns are preserved and cor() can be run on rows? >> >> Thanks! >> >> >> >> > ______________________________**_________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.et="" hz.ch="" mailman="" listinfo="" bioconductor=""> > Search the archives: http://news.gmane.org/gmane.** > science.biology.informatics.**conductor<http: news.gmane.org="" gmane.="" science.biology.informatics.conductor=""> > -- *Chirag Gupta* Department of Crop, Soil, and Environmental Sciences, 115 Plant Sciences Building, Fayetteville, Arkansas 72701 [[alternative HTML version deleted]]
ADD REPLY

Login before adding your answer.

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