Large table reformatting
1
0
Entering edit mode
6.5 years ago

Hi everyone,

I have a very large table of genotypes that I will eventually plug into MatrixEQTL for eQTL analysis. I'm having some formatting issues that hopefully someone can assist me with.

As things stand, my file looks like this

1   0   0   1
0   1   0   0
0   0   1   0

Rows = SNPs (I have several hundred thousand of these)

Columns = Patient IDs (I have about 100 of these)

(I have all the SNP IDs and patient IDs stored in their own file.)

How to I transfer all SNP IDs and Patient IDs into my matrix to create something like this..

           SNP_1 SNP_2 SNP_3 SNP_4
Patient_1   1     0     0      1
Patient_2   0     1     0      0
Patient_3   0     0     1      0 

Thanks!!!!

Chris

vcf linux • 1.1k views
ADD COMMENT
4
Entering edit mode
6.5 years ago
( echo -n  -e "\t" && cat snp.txt | tr "\n" "\t" && echo &&   paste patient.txt table.txt ) > new_table.txt
ADD COMMENT
0
Entering edit mode

that's great, thanks!

ADD REPLY

Login before adding your answer.

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