Entering edit mode
6.1 years ago
fufuyou
▴
110
File1
#CHROM POS ID REF_Zv ALT_lm
chr1A 219620 . T A
chr1A 219648 . A G
chr1A 219867 . A G
file2
#CHROM POS ID REF_Zv ALT_RV
chr1A 219457 . C T
chr1A 219670 . A G
chr1A 219867 . A C
File3
#CHROM POS ID REF_Zv ALT_lm ALT_RV
chr1A 219620 . T A NA
chr1A 219648 . A G NA
chr1A 219867 . A G C
chr1A 219457 . C NA T
chr1A 219670 . A NA C
My command is
awk 'FNR==NR{a[$1,$2];next} {if(a[$1,$2]==""){a[$1,$2]=0};print $1,$2,$3,$4,$5, a[$4,$5]} ' file1 file2 > file3
However, I can not get the file3 which I want. Could you help me improve the command? Thanks, Fuyou
Did you try VCF tools ? They have merge option. http://vcftools.sourceforge.net/perl_module.html
But my data has no SNP format. So vcf-merge does not work.
@Kevin has examples of the right tool to do this with in: Merging vcf files (intersection and union)
My SNP vcf files do not have other columns. such as "GT". Thanks, Fuyou
Then those are not vcf files and you make things harder by not using standardised file formats.