Skip to content
Snippets Groups Projects
Commit c2e0f1fa authored by Brandi Cantarel's avatar Brandi Cantarel
Browse files

union header bugs -- samples names and missing definitions

parent cd03f58a
No related merge requests found
...@@ -9,13 +9,18 @@ open VCF, "gunzip -c $vcf|" or die $!; ...@@ -9,13 +9,18 @@ open VCF, "gunzip -c $vcf|" or die $!;
while (my $line = <VCF>) { while (my $line = <VCF>) {
chomp($line); chomp($line);
if ($line =~ m/#/) { if ($line =~ m/#/) {
next if ($line =~ m/FORMAT=<ID=AO/ || $line =~ m/FORMAT=<ID=AD/ || $line =~ m/FORMAT=<ID=RO/ || $line =~ m/FORMAT=<ID=DP/);
if ($line =~ m/#CHROM/) { if ($line =~ m/#CHROM/) {
print OUT "##FORMAT=<ID=AO,Number=A,Type=Integer,Description=\"Alternate allele observation count\">\n"; print OUT "##FORMAT=<ID=AO,Number=A,Type=Integer,Description=\"Alternate allele observation count\">\n";
print OUT "##FORMAT=<ID=RO,Number=1,Type=Integer,Description=\"Reference allele observation count\">\n"; print OUT "##FORMAT=<ID=RO,Number=1,Type=Integer,Description=\"Reference allele observation count\">\n";
print OUT "##FORMAT=<ID=AD,Number=R,Type=Integer,Description=\"Allelic depths for the ref and alt alleles in the order listed\">\n"; print OUT "##FORMAT=<ID=AD,Number=R,Type=Integer,Description=\"Allelic depths for the ref and alt alleles in the order listed\">\n";
print OUT "##FORMAT=<ID=DP,Number=1,Type=Integer,Description=\"Approximate read depth (reads with MQ=255 or with bad mates are filtered)\">\n"; print OUT "##FORMAT=<ID=DP,Number=1,Type=Integer,Description=\"Approximate read depth (reads with MQ=255 or with bad mates are filtered)\">\n";
} my ($c, $p,$i,$r,$a,$s,$f,$an,$fo,@snames) = split(/\t/, $line);
unless ($line =~ m/FORMAT=<ID=AO/ || $line =~ m/FORMAT=<ID=AD/ || $line =~ m/FORMAT=<ID=RO/ || $line =~ m/FORMAT=<ID=DP/) { foreach my $j (0..$#snames) {
$snames[$j] =~ s/\[|\]|\.consensus|\.final//g;
}
print OUT join("\t",$c, $p,$i,$r,$a,$s,$f,$an,$fo,@snames),"\n";
} else {
print OUT $line,"\n"; print OUT $line,"\n";
} }
next; next;
......
...@@ -47,6 +47,9 @@ for i in ${dir}/*.vcf.gz; do ...@@ -47,6 +47,9 @@ for i in ${dir}/*.vcf.gz; do
fi fi
done done
perl $baseDir/unionvcf.pl ${index_path}/union.header.vcf $list2 echo "##fileformat=VCFv4.2" > header.vcf
zcat ${dir}/*.vcf.gz |grep "##" |grep -v '#fileformat' |sort -u |grep 'ALT\|FILTER\|FORMAT\|INFO' >> header.vcf
perl $baseDir/unionvcf.pl header.vcf $list2
perl $baseDir/vcfsorter.pl ${index_path}/genome.dict int.vcf |bgzip > ${pair_id}.union.vcf.gz perl $baseDir/vcfsorter.pl ${index_path}/genome.dict int.vcf |bgzip > ${pair_id}.union.vcf.gz
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment