[med-svn] [htslib] 02/05: bcf_remove_alleles: Assume diploid genotypes if the ploidy cannot be determined, better to proceed than crash.
Charles Plessy
plessy at moszumanska.debian.org
Fri Nov 22 05:01:08 UTC 2013
This is an automated email from the git hooks/post-receive script.
plessy pushed a commit to branch debian/unstable
in repository htslib.
commit 715f5db631fa1116a41f484a9567b6c888e04b8f
Author: Petr Danecek <pd3 at sanger.ac.uk>
Date: Wed Nov 20 14:46:33 2013 +0000
bcf_remove_alleles: Assume diploid genotypes if the ploidy cannot be determined, better to proceed than crash.
---
vcfutils.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/vcfutils.c b/vcfutils.c
index d139c1b..cbd53c2 100644
--- a/vcfutils.c
+++ b/vcfutils.c
@@ -252,11 +252,18 @@ void bcf_remove_alleles(const bcf_hdr_t *header, bcf1_t *line, int rm_mask)
int k, nset = 0; \
for (k=0; k<nG_ori; k++) \
if ( is_vector_end ) break; \
- else if ( !(is_missing) ) nset++; \
+ else nset++; \
if ( nset==0 ) set_vector_end; \
- else if ( nset==nG_ori ) \
+ else if ( nset==line->n_allele ) \
+ { \
+ /* haploid */ \
+ int k_ori; k = 0; \
+ for (k_ori=0; k_ori<line->n_allele; k_ori++) \
+ if ( !(rm_mask & 1<<k_ori) ) p[k++] = p[k_ori]; \
+ for (; k<line->n_allele; k++) set_vector_end; \
+ } \
+ else /* In presence of missing values, assume diploid genotype */ \
{ \
- /* diploid */ \
int ia, ib, k_ori = 0, k_new = 0; \
for (ia=0; ia<line->n_allele; ia++) \
{ \
@@ -269,15 +276,6 @@ void bcf_remove_alleles(const bcf_hdr_t *header, bcf1_t *line, int rm_mask)
} \
} \
} \
- else if ( nset==line->n_allele ) \
- { \
- /* haploid */ \
- int k_ori; k = 0; \
- for (k_ori=0; k_ori<line->n_allele; k_ori++) \
- if ( !(rm_mask & 1<<k_ori) ) p[k++] = p[k_ori]; \
- for (; k<line->n_allele; k++) set_vector_end; \
- } \
- else { fprintf(stderr, "[E::%s] todo, missing values: %d %d\n", __func__, nset,nG_ori); exit(1); } \
} \
}
switch (fmt->type) {
--
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/htslib.git
More information about the debian-med-commit
mailing list