jeudi 29 octobre 2015

Perl: merge specific columns from multiple files from a directory

I have a number of files in a directory, say dir:

dir/one.out
dir/two.out
dir/three.out and so on 

Each file looks like this:

Chr Pos     Ref   Depth A   T   G   C   a   t   g   c
10  1156771 C     61    0   0   0   36  0   0   0   25
10  3748402 C     68    13  0   0   26  12  0   0   17
10  7848320 T     57    0   31  0   0   0   26  0   0

I just want to get the Chr, Pos, Ref, Depth from each file and merge it like this:

merged.out

Chr Pos     Ref Depth.one Depth.two Depth.three
10  1156771 C   61        60        65
10  3748402 C   68        70        73

Any suggestions how to do it in perl? Thanks!

Aucun commentaire:

Enregistrer un commentaire