This is a test version of Biostars. For the public version, visit https://www.biostars.org.
an alternative "join" option for annotated-vcf handling in trios

Server Linux, Bash 4.2.25

Hi,

I'm using this code to handle annotated-vcf files in trios:

join -t "`echo -e "\t"`" -e ND -a1  FILE1 FILE2 > OUTPUT

example:

FILE1 (space = tab)
chr1_11086439_11086439_C_T aaa,asf
chr1_11086717_11086717_A_G dad,ada
chr1_11087524_11087524_G_A asd,thh

FILE2 (space = tab)
chr1_11086439_11086439_C_T 1:1:1
chr1_11087524_11087524_G_A  2:2:2

OUTPUT (space = tab)
chr1_11086439_11086439_C_T aaa,asf 1:1:1
chr1_11086717_11086717_A_G dad,ada ND
chr1_11087524_11087524_G_A asd,thh 2:2:2

Considering that I have some times "sorting" problems, however my input files are already sorted !!! ...

I'm looking for an another code to do the same job! ... any suggestion?

All the best

trio vcf

what is

"sorting" problems

? how did you sort those files ?

you flagged this post with 'vcf', how about merging the VCF using a standard tool like "gatk combinevariants" ?

I sorted my files according to the first column (chr_start_end_ref_alt)... and some times the script works well and other time no... :-/

Ok, I will try with gatk and I will let you know, thank!

how did you sort those files ? show me the cmd line please.

just using the sort command

sort sample1 > FILE1

join -t "echo -e "\t""

join -t $'\t'

or use Ctrl-V + tab to insert a tab

1 answer

sort sample1 > FILE1

this is just wrong.

sort -t $'\t' -k1,1 sample1 > FILE1

and better:

LC_ALL=C sort -t $'\t' -k1,1 sample1 > FILE1
LC_ALL=C sort -t $'\t' -k1,1 sample2 > FILE2
LC_ALL=C join -t $'\t' -1 1 -2 1 FILE1 FILE2

many thanks! I will try and I let you know ^_*

Log in to answer this question.