[BioC] Import a text file

Sylvain Brohée sbrohee at ulb.ac.be
Sat Jul 13 09:40:22 CEST 2013


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!
>
>
>



More information about the Bioconductor mailing list