Skip to content

Commit

Permalink
vcfmerge now works with REF-only positions, samtools#284 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
pd3 committed Oct 30, 2015
1 parent 2092cce commit 29565a6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions vcfmerge.c
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,7 @@ int can_merge(args_t *args)
*/
void stage_line(args_t *args)
{
int snp_mask = (VCF_SNP<<1)|(VCF_MNP<<1), indel_mask = VCF_INDEL<<1;
int snp_mask = (VCF_SNP<<1)|(VCF_MNP<<1), indel_mask = VCF_INDEL<<1, ref_mask = 1;
bcf_srs_t *files = args->files;
maux_t *maux = args->maux;

Expand Down Expand Up @@ -2149,16 +2149,17 @@ void stage_line(args_t *args)
for (j=buf->beg; j<buf->end; j++)
{
if ( buf->rec[j].skip ) continue; // done or not compatible
if ( args->collapse&COLLAPSE_ANY ) break;
if ( args->collapse&COLLAPSE_ANY ) break; // anything can be merged
int line_type = bcf_get_variant_types(buf->lines[j]);
if ( maux->var_types&snp_mask && line_type&VCF_SNP && (args->collapse&COLLAPSE_SNPS) ) break;
if ( maux->var_types&indel_mask && line_type&VCF_INDEL && (args->collapse&COLLAPSE_INDELS) ) break;
if ( line_type==VCF_REF )
{
if ( maux->var_types&snp_mask && (args->collapse&COLLAPSE_SNPS) ) break;
if ( maux->var_types&indel_mask && (args->collapse&COLLAPSE_INDELS) ) break;
if ( maux->var_types&ref_mask ) break;
}
else if ( maux->var_types&(VCF_REF<<1) )
else if ( maux->var_types&ref_mask )
{
if ( line_type&snp_mask && (args->collapse&COLLAPSE_SNPS) ) break;
if ( line_type&indel_mask && (args->collapse&COLLAPSE_INDELS) ) break;
Expand Down

0 comments on commit 29565a6

Please sign in to comment.