Skip to content

Commit

Permalink
fix extra tab in VCF, clarify description of per-sample read depth (DP)
Browse files Browse the repository at this point in the history
  • Loading branch information
vibansal committed Jun 8, 2021
1 parent e6f296d commit bc0c233
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crisp/crisp_header_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void print_crispheader(struct OPTIONS* options)
fprintf(vfile,"##FILTER=<ID=LowMQ20,Description=\" >20 percent of reads have mapping quality score less than 20\">\n");
fprintf(vfile,"##FILTER=<ID=LowMQ10,Description=\" >10 percent of reads have mapping quality score less than 20\">\n");
fprintf(vfile,"##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">\n");
fprintf(vfile,"##FORMAT=<ID=DP,Number=1,Type=Integer,Description=\"Read Depth\">\n");
fprintf(vfile,"##FORMAT=<ID=DP,Number=1,Type=Integer,Description=\"Read Depth for each pool/sample (includes all reads)\">\n");
fprintf(vfile,"##FORMAT=<ID=GQ,Number=1,Type=Integer,Description=\"Genotype Quality\">\n");
//fprintf(vfile,"##FORMAT=<ID=PP,Number=.,Type=Float,Description=\"Probability that the pool contains the variant allele(s), one value for each variant allele listed in column 5\">\n");
fprintf(vfile,"##FORMAT=<ID=AC,Number=.,Type=Integer,Description=\"Maximum likelihood estimate for the allele counts for the ALT allele(s), in the same order as listed in column 5\">\n");
Expand Down
13 changes: 6 additions & 7 deletions crisp/newcrispprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ void print_VCF_genotypes_diploid(struct VARIANT* variant, FILE* vfile)

if (variant->counts[variant->refbase+2*maxalleles] + variant->counts[variant->alleles[0]+2*maxalleles] >= 2) bidir = 1;
//if (bidir == 1)
fprintf(vfile,"\tGT:GQ:DP:ADf:ADr:ADb\t");
fprintf(vfile,"\tGT:GQ:DP:ADf:ADr:ADb");
//else fprintf(vfile,"\tGT:GQ:DP:ADf:ADr\t");


for (i=0;i<variant->samples;i++)
{
fprintf(vfile,"\t");
if ((double)variant->readdepths[i]/variant->ploidy[i] <= 1) fprintf(vfile,"./.:.");
else if (variant->varalleles ==1) // print genotypes for bi-allelic variants
{
Expand Down Expand Up @@ -176,7 +176,6 @@ void print_VCF_genotypes_diploid(struct VARIANT* variant, FILE* vfile)
for (j=0;j<variant->varalleles;j++) fprintf(vfile,",%d",variant->indcounts[i][variant->alleles[j]+2*maxalleles]);
}
else { fprintf(vfile,":0"); for (j=0;j<variant->varalleles;j++) fprintf(vfile,",0"); }
fprintf(vfile,"\t");
}
fprintf(vfile,"\n");

Expand All @@ -188,7 +187,7 @@ void print_VCF_genotypes_pooled_full(struct VARIANT* variant,FILE* vfile)
int i=0,j=0,k=0,coverage=0,bidir=0;
if (variant->counts[variant->refbase+2*maxalleles] + variant->counts[variant->alleles[0]+2*maxalleles] >= 2) bidir = 1;
//if (bidir == 1) fprintf(vfile,"\tGT:GQ:AC:DP:ADf:ADr:ADb\t"); else fprintf(vfile,"\tGT:GQ:AC:DP:ADf:ADr\t");
fprintf(vfile,"\tGT:GQ:AC:DP:ADf:ADr:ADb\t");
fprintf(vfile,"\tGT:GQ:AC:DP:ADf:ADr:ADb");

int AC1 = 0, AC2 = 0; int printflag = 0;
for (i=0;i<variant->samples;i++)
Expand All @@ -200,6 +199,7 @@ void print_VCF_genotypes_pooled_full(struct VARIANT* variant,FILE* vfile)

for (i=0;i<variant->samples;i++)
{
fprintf(vfile,"\t");
if ((double)variant->readdepths[i]/variant->ploidy[i] <= 1)
{
for (j=0;j<variant->ploidy[i];j++) fprintf(vfile,"./"); fprintf(vfile,".:0:.");
Expand Down Expand Up @@ -240,7 +240,6 @@ void print_VCF_genotypes_pooled_full(struct VARIANT* variant,FILE* vfile)
}
else { fprintf(vfile,":0"); for (j=0;j<variant->varalleles;j++) fprintf(vfile,",0"); }
//if (variant->crispvar[0].AC[i] > 0) fprintf(vfile,":="); else fprintf(vfile,":.");
fprintf(vfile,"\t");
}
fprintf(vfile,"\n");
}
Expand All @@ -250,9 +249,10 @@ void print_VCF_genotypes_pooled(struct VARIANT* variant,FILE* vfile)
{
int i=0,j=0,k=0,coverage=0,bidir=0;
if (variant->counts[variant->refbase+2*maxalleles] + variant->counts[variant->alleles[0]+2*maxalleles] >= 2) bidir = 1;
fprintf(vfile,"\tAC:GQ:DP:ADf:ADr:ADb\t"); //else fprintf(vfile,"\tMLAC:GQ:DP:ADf:ADr\t");
fprintf(vfile,"\tAC:GQ:DP:ADf:ADr:ADb"); //else fprintf(vfile,"\tMLAC:GQ:DP:ADf:ADr\t");
for (i=0;i<variant->samples;i++)
{
fprintf(vfile,"\t");
if ((double)variant->readdepths[i]/variant->ploidy[i] <= 1) fprintf(vfile,".");
else if (variant->ploidy[0] > 2 && variant->varpoolsize > 0) // print reference allele count as well.
{
Expand Down Expand Up @@ -294,7 +294,6 @@ void print_VCF_genotypes_pooled(struct VARIANT* variant,FILE* vfile)
}
else { fprintf(vfile,":0"); for (j=0;j<variant->varalleles;j++) fprintf(vfile,",0"); }
//if (variant->crispvar[0].AC[i] > 0) fprintf(vfile,":="); else fprintf(vfile,":.");
fprintf(vfile,"\t");
}
fprintf(vfile,"\n");
}
Expand Down

0 comments on commit bc0c233

Please sign in to comment.