Skip to content

Commit

Permalink
no output of SNP if no SNP file is input
Browse files Browse the repository at this point in the history
  • Loading branch information
zwdzwd committed Feb 10, 2016
1 parent 2a303a3 commit d630d6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/epiread.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static void format_epiread(kstring_t *epi, bam1_t *b, refseq_t *rs, uint8_t bsst

/* append SNP info if present */
uint32_t snp_ind = rpos+j-snp_beg;
if (episnp_test(snps, snp_ind)) {
if (snps && episnp_test(snps, snp_ind)) {
kputc(qb, &es);
if (first_snp_loc < 0)
first_snp_loc = rpos+j;
Expand Down Expand Up @@ -201,7 +201,7 @@ static void format_epiread(kstring_t *epi, bam1_t *b, refseq_t *rs, uint8_t bsst
if (first_cpg_loc >= 0) {
if (first_snp_loc >= 0)
ksprintf(epi, "\t%d\t%s", first_snp_loc-1, es.s); /* 0-based */
else
else if (snps)
kputs("\t.\t.", epi);
kputc('\n', epi);
}
Expand Down Expand Up @@ -232,8 +232,9 @@ static void *process_func(void *data) {
uint32_t snp_beg = w.beg>1000?w.beg-1000:1;
uint32_t snp_end = w.end+1000;
/* make snp lookup table */
uint8_t *snps = calloc((snp_end-snp_beg)/8+1, sizeof(uint8_t));
uint8_t *snps = NULL;
if (res->snp) { /* if snp is supplied */
snps = calloc((snp_end-snp_beg)/8+1, sizeof(uint8_t));
episnp_chrom1_t *episnp1 = get_episnp1(res->snp, chrm);
if (episnp1) { /* if chromosome is found in snp file */
for (j=0; j<episnp1->n; ++j) {
Expand Down
1 change: 0 additions & 1 deletion src/pileup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,6 @@ int main_pileup(int argc, char *argv[]) {
char *infn = 0;
char *outfn = 0;
char *statsfn = 0;
char *snp_bed_fn = 0;
conf_t conf;
conf_init(&conf);

Expand Down

0 comments on commit d630d6a

Please sign in to comment.