[med-svn] samtools 24/26: stats: realloc buffers in MPC calculation if necessary, unclipped length can be bigger seq_len

Charles Plessy plessy at moszumanska.debian.org
Tue Dec 10 10:06:27 UTC 2013


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch debian/unstable
in repository samtools.

commit 85f1c53055f30b0ef13c8f71b19d11170f78906f
Author: Petr Danecek <pd3 at sanger.ac.uk>
Date:   Fri Dec 6 10:33:44 2013 +0000

    stats: realloc buffers in MPC calculation if necessary, unclipped length can be bigger seq_len
---
 stats.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/stats.c b/stats.c
index 3c1e78e..c3e64e2 100644
--- a/stats.c
+++ b/stats.c
@@ -150,6 +150,7 @@ stats_t;
 
 void error(const char *format, ...);
 int is_in_regions(bam1_t *bam_line, stats_t *stats);
+void realloc_buffers(stats_t *stats, int seq_len);
 
 
 // Coverage distribution methods
@@ -320,10 +321,11 @@ int unclipped_length(bam1_t *bam_line)
 
 void count_mismatches_per_cycle(stats_t *stats,bam1_t *bam_line) 
 {
+    int read_len = unclipped_length(bam_line); 
+    if ( read_len >= stats->nbases ) realloc_buffers(stats,read_len);
     int is_fwd = IS_REVERSE(bam_line) ? 0 : 1;
     int icig,iread=0,icycle=0;
     int iref = bam_line->core.pos - stats->rseq_pos;
-    int read_len   = unclipped_length(bam_line); 
     uint8_t *read  = bam1_seq(bam_line);
     uint8_t *quals = bam1_qual(bam_line);
     uint64_t *mpc_buf = stats->mpc_buf;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/samtools.git



More information about the debian-med-commit mailing list