This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Large table reformatting

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 answer

( echo -n  -e "\t" && cat snp.txt | tr "\n" "\t" && echo &&   paste patient.txt table.txt ) > new_table.txt

Log in to answer this question.