From 6e83b04e289dc1f5a1457d2e3125dd7acbf2fbe8 Mon Sep 17 00:00:00 2001 From: Hasindu Gamaarachchi Date: Tue, 5 Mar 2024 18:36:27 +0530 Subject: [PATCH] fix potential bug --- src/genread.c | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/genread.c b/src/genread.c index 8781a04..df204b4 100644 --- a/src/genread.c +++ b/src/genread.c @@ -205,32 +205,34 @@ static inline int get_rlen(core_t *core, int tid){ } static void methylate_dna(core_t *core, int32_t ref_len, int32_t ref_pos, int32_t rlen, char c, char *seq, int seq_i, int tid){ - for(int i=0; iref->ref_seq[seq_i][ref_pos+i] == 'C' && - core->ref->ref_seq[seq_i][ref_pos+i+1] == 'G'){ - int methr = rng(&core->rand_meth[tid]) * 254; - if( methr <= core->ref->ref_meth[seq_i][ref_pos+i]){ - - int p = i; - if(c == '-'){ - //fprintf(stderr,"here\n"); - p = rlen - i - 2; - } - if(!(p>=0 && pref->ref_meth[seq_i]){ + for(int i=0; iref->ref_seq[seq_i][ref_pos+i] == 'C' && + core->ref->ref_seq[seq_i][ref_pos+i+1] == 'G'){ + int methr = rng(&core->rand_meth[tid]) * 254; + if( methr <= core->ref->ref_meth[seq_i][ref_pos+i]){ + + int p = i; + if(c == '-'){ + //fprintf(stderr,"here\n"); + p = rlen - i - 2; + } + if(!(p>=0 && p