From ca1786a8132d12a5e3ef2eef7a2b3195931f7f52 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Fri, 19 Feb 2021 00:35:28 +0100 Subject: [PATCH 01/44] Temporarily work around #99 --- CHANGELOG.md | 4 ++++ pileup.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2cb819..769c379 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +Version 0.5.2: + + * Temporary work around for issue #99. Long-term pileup.c needs to be reworked. + Version 0.5.1: * Fixed an issue in `MethylDackel mbias` due to an uninitialized value (issue #93). diff --git a/pileup.c b/pileup.c index 95ec767..230e500 100644 --- a/pileup.c +++ b/pileup.c @@ -53,6 +53,9 @@ struct __bam_plp_t { struct __bam_mplp_t { int n; +#if HTS_VERSION >= 101000 + int32_t min_tid, *tid; +#endif uint64_t min, *pos; bam_plp_t *iter; int *n_plp; From 6a907761c856537c4029a66d577bb3e48bbfeaa8 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Fri, 19 Feb 2021 00:38:11 +0100 Subject: [PATCH 02/44] Bump to 0.5.2 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8d884a8..c3231d9 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ CFLAGS ?= -Wall -g -O3 -pthread all: MethylDackel OBJS = common.o bed.o svg.o pileup.o extract.o MBias.o mergeContext.o perRead.o -VERSION = 0.5.1 +VERSION = 0.5.2 version.h: echo '#define VERSION "$(VERSION)"' > $@ From 33819ff1fd92999549ba71a3d485eafb06bd4dd3 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Fri, 19 Feb 2021 00:41:54 +0100 Subject: [PATCH 03/44] Limit htslib to 1.10 since we need a proper fix for 1.11 --- azure-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipeline.yml b/azure-pipeline.yml index d7a7f5e..41e6731 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -15,7 +15,7 @@ jobs: steps: - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" displayName: Add conda to PATH - - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig + - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=1.10 python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml From 60e353fd50231ee44805bcd53926f9f22f7b3052 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Fri, 19 Feb 2021 00:45:41 +0100 Subject: [PATCH 04/44] debug --- tests/test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test.py b/tests/test.py index 6898cc6..4205110 100644 --- a/tests/test.py +++ b/tests/test.py @@ -22,6 +22,8 @@ def rm(f): rm('test2_CpG.bedGraph') check_call('../MethylDackel extract cg100.fa cg_aln.bam -q 2 -o test2', shell=True) assert op.exists('test2_CpG.bedGraph') +for line in open('test2_CpG.bedGraph'): + print(line) lines = sum(1 for _ in open('test2_CpG.bedGraph')) assert lines > 1 rm('test2_CpG.bedGraph') From 031d6c22df886368705d90ef02e021d8250bbfbe Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Fri, 19 Feb 2021 00:52:36 +0100 Subject: [PATCH 05/44] ok --- azure-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipeline.yml b/azure-pipeline.yml index 41e6731..7da1504 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -15,7 +15,7 @@ jobs: steps: - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" displayName: Add conda to PATH - - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=1.10 python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig + - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=1.9 python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml From eb835016f5d298fa1b7e9be88b02909fde27ff8c Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sun, 21 Feb 2021 09:59:55 +0100 Subject: [PATCH 06/44] Reimplement with constructors, test with 3 htslib versions --- Makefile | 3 +- MethylDackel.h | 5 + azure-pipeline.yml | 10 +- extract.c | 13 +- overlaps.c | 134 ++++++++++++++++++++ perRead.c | 4 +- pileup.c | 309 --------------------------------------------- test_CpG.bedGraph | 1 - 8 files changed, 158 insertions(+), 321 deletions(-) create mode 100644 overlaps.c delete mode 100644 pileup.c delete mode 100644 test_CpG.bedGraph diff --git a/Makefile b/Makefile index c3231d9..84c7449 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,8 @@ CFLAGS ?= -Wall -g -O3 -pthread all: MethylDackel -OBJS = common.o bed.o svg.o pileup.o extract.o MBias.o mergeContext.o perRead.o +#OBJS = common.o bed.o svg.o pileup.o extract.o MBias.o mergeContext.o perRead.o +OBJS = common.o bed.o svg.o overlaps.o extract.o MBias.o mergeContext.o perRead.o VERSION = 0.5.2 version.h: diff --git a/MethylDackel.h b/MethylDackel.h index a95f8c9..6ea097c 100644 --- a/MethylDackel.h +++ b/MethylDackel.h @@ -224,3 +224,8 @@ void parseBounds(char *s2, int *vals, int mult); //Used internally to not split CpGs/CHGs between threads void adjustBounds(Config *config, bam_hdr_t *hdr, faidx_t *fai, uint32_t *localTid, uint32_t *localPos, uint32_t *localEnd); + +int custom_overlap_constructor(void *data, const bam1_t *b, bam_pileup_cd *cd); +int custom_overlap_destructor(void *data, const bam1_t *b, bam_pileup_cd *cd); +void initOlapHash(); +void destroyOlapHash(); diff --git a/azure-pipeline.yml b/azure-pipeline.yml index 7da1504..2272e03 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -8,14 +8,18 @@ jobs: vmImage: 'ubuntu-16.04' strategy: matrix: - Python37: - python.version: '3.7' + htslib109: + htslib_version: '1.9' + htslib110: + htslib_version: '1.10' + htslib111: + htslib_version: '1.11' maxParallel: 1 steps: - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" displayName: Add conda to PATH - - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=1.9 python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig + - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$htslib_version python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml diff --git a/extract.c b/extract.c index b6a5487..6646de3 100644 --- a/extract.c +++ b/extract.c @@ -28,7 +28,6 @@ struct lastCall{ uint32_t nmethyl, nunmethyl; }; -const char *quux[2] = {"foo", "bar"}; const char *TriNucleotideContexts[25] = {"CAA", "CAC", "CAG", "CAT", "CAN", \ "CCA", "CCC", "CCG", "CCT", "CCN", \ "CGA", "CGC", "CGG", "CGT", "CGN", \ @@ -247,7 +246,8 @@ void *extractCalls(void *foo) { Config *config = (Config*) foo; bam_hdr_t *hdr; bam_mplp_t iter; - int ret, tid, pos, i, seqlen, type, rv, o = 0; + int ret, tid, i, seqlen, type, rv, o = 0; + hts_pos_t pos; int32_t bedIdx = 0; int n_plp; //This will need to be modified for multiple input files int strand, direction; @@ -314,7 +314,7 @@ void *extractCalls(void *foo) { data->fp = fp; data->bedIdx = bedIdx; - plp = calloc(1, sizeof(bam_pileup1_t *)); //This will have to be modified for multiple input files + plp = calloc(1, sizeof(bam_pileup1_t *)); if(plp == NULL) { fprintf(stderr, "Couldn't allocate space for the plp structure in extractCalls()!\n"); return NULL; @@ -386,9 +386,11 @@ void *extractCalls(void *foo) { //Start the pileup iter = bam_mplp_init(1, filter_func, (void **) &data); - bam_mplp_init_overlaps(iter); bam_mplp_set_maxcnt(iter, INT_MAX); - while((ret = cust_mplp_auto(iter, &tid, &pos, &n_plp, plp)) > 0) { + bam_mplp_constructor(iter, custom_overlap_constructor); + initOlapHash(); + + while((ret = bam_mplp64_auto(iter, &tid, &pos, &n_plp, plp)) > 0) { if(pos < localPos || pos >= localEnd) continue; // out of the region requested if(config->bed) { //Handle -l @@ -525,6 +527,7 @@ void *extractCalls(void *foo) { pthread_mutex_unlock(&outputMutex); break; } + destroyOlapHash(); } free(os_CpG->s); free(os_CpG); diff --git a/overlaps.c b/overlaps.c new file mode 100644 index 0000000..84d4c77 --- /dev/null +++ b/overlaps.c @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include "htslib/khash.h" +#include "htslib/sam.h" + +int getStrand(bam1_t *b); + +// Dictionary of overlapping reads +//KHASH_MAP_INIT_STR(olap_hash, lbnode_t *) +KHASH_MAP_INIT_STR(olap_hash, bam1_t *) +typedef khash_t(olap_hash) olap_hash_t; +khash_t(olap_hash) *ohash = NULL; + +void initOlapHash() { + ohash = kh_init(olap_hash); +} + +void destroyOlapHash() { + kh_destroy(olap_hash, ohash); +} + +//This is from bison +int32_t *calculate_positions(bam1_t *read) { + int32_t *positions = malloc(sizeof(int32_t) * (size_t)read->core.l_qseq); + int i, j, offset = 0, op, op_len; + uint32_t *CIGAR = bam_get_cigar(read); + int32_t previous_position = read->core.pos; + + for(i=0; icore.n_cigar; i++) { + op = bam_cigar_op(*(CIGAR+i)); + op_len = bam_cigar_oplen(*(CIGAR+i)); + for(j=0; jcore.l_qseq, nb = b->core.l_qseq; + int32_t *posa = calculate_positions(a); + int32_t *posb = calculate_positions(b); + uint8_t *a_qual = bam_get_qual(a), *b_qual = bam_get_qual(b); + uint8_t *a_seq = bam_get_seq(a), *b_seq = bam_get_seq(b); + + //If alignments are on opposite strands then exit + int sa = getStrand(a); + int sb = getStrand(b); + if(((sa-sb)&1) == 1) goto quit; + + //Go to the first mapped position + while(iab_qual[ib] && bam_seqi(a_seq,ia) != 15) { + a_qual[ia] -= b_qual[ib]; + b_qual[ib] = 0; + } else if(b_qual[ib]>a_qual[ia] && bam_seqi(b_seq,ib) != 15) { + b_qual[ib] -= a_qual[ia]; + a_qual[ia] = 0; + } else { + a_qual[ia] = 0; + b_qual[ib] = 0; + } + } else { + if(a_qual[ia]>b_qual[ib]) { + a_qual[ia] += 0.2*a_qual[ia]; + b_qual[ib] = 0; + } else { + b_qual[ib] += 0.2*b_qual[ib]; + a_qual[ia] = 0; + } + } + a_qual[ia] = (a_qual[ia]<=255) ? a_qual[ia] : 255; + b_qual[ib] = (b_qual[ib]<=255) ? b_qual[ib] : 255; + ia++; + ib++; + } + +quit : + free(posa); + free(posb); +} + +int custom_overlap_constructor(void *data, const bam1_t *b, bam_pileup_cd *cd) { + int ret; + khiter_t k = kh_get(olap_hash, ohash, bam_get_qname(b)); + bam1_t *a; + if (k==kh_end(ohash)) { + k = kh_put(olap_hash, ohash, bam_get_qname(b), &ret); + kh_value(ohash, k) = b; + return 0; + } else { + a = kh_value(ohash, k); + cust_tweak_overlap_quality(a, b); + kh_del(olap_hash, ohash, k); + } + return 0; + +} diff --git a/perRead.c b/perRead.c index 1cc3177..66c9711 100644 --- a/perRead.c +++ b/perRead.c @@ -17,14 +17,14 @@ void addRead(kstring_t *os, bam1_t *b, bam_hdr_t *hdr, uint32_t nmethyl, uint32_ char str[10000]; // I don't really like hardcoding it, but given the probability that it ever won't suffice... if(nmethyl + nunmethyl > 0) { - snprintf(str, 10000, "%s\t%s\t%i\t%f\t%"PRIu32"\n", + snprintf(str, 10000, "%s\t%s\t%"PRId64"\t%f\t%"PRIu32"\n", bam_get_qname(b), hdr->target_name[b->core.tid], b->core.pos, 100. * ((double) nmethyl)/(nmethyl+nunmethyl), nmethyl + nunmethyl); } else { - snprintf(str, 10000, "%s\t%s\t%i\t0.0\t%"PRIu32"\n", + snprintf(str, 10000, "%s\t%s\t%"PRId64"\t0.0\t%"PRIu32"\n", bam_get_qname(b), hdr->target_name[b->core.tid], b->core.pos, diff --git a/pileup.c b/pileup.c deleted file mode 100644 index 230e500..0000000 --- a/pileup.c +++ /dev/null @@ -1,309 +0,0 @@ -#include -#include -#include -#include -#include "htslib/khash.h" -#include "htslib/sam.h" - -int getStrand(bam1_t *b); - -/********************************************** -* Everything below here needs to track htslib! -* Compatible with htslib 1.4->1.9 currently -**********************************************/ -typedef struct { - int k, x, y, end; -} cstate_t; - -static cstate_t g_cstate_null = { -1, 0, 0, 0 }; - -typedef struct __linkbuf_t { - bam1_t b; - int32_t beg, end; - cstate_t s; - struct __linkbuf_t *next; - bam_pileup_cd cd; -} lbnode_t; - -typedef struct { - int cnt, n, max; - lbnode_t **buf; -} mempool_t; - -// Dictionary of overlapping reads -KHASH_MAP_INIT_STR(olap_hash, lbnode_t *) -typedef khash_t(olap_hash) olap_hash_t; - -struct __bam_plp_t { - mempool_t *mp; - lbnode_t *head, *tail; - int32_t tid, pos, max_tid, max_pos; - int is_eof, max_plp, error, maxcnt; - uint64_t id; - bam_pileup1_t *plp; - // for the "auto" interface only - bam1_t *b; - bam_plp_auto_f func; - void *data; - olap_hash_t *overlaps; - - int (*plp_construct)(void *data, const bam1_t *b, bam_pileup_cd *cd); - int (*plp_destruct )(void *data, const bam1_t *b, bam_pileup_cd *cd); -}; - -struct __bam_mplp_t { - int n; -#if HTS_VERSION >= 101000 - int32_t min_tid, *tid; -#endif - uint64_t min, *pos; - bam_plp_t *iter; - int *n_plp; - const bam_pileup1_t **plp; -}; - -static inline lbnode_t *mp_alloc(mempool_t *mp) -{ - ++mp->cnt; - if (mp->n == 0) return (lbnode_t*)calloc(1, sizeof(lbnode_t)); - else return mp->buf[--mp->n]; -} - -/********************************************** -* Done reinventing the wheel -**********************************************/ -//This is from bison -int32_t *calculate_positions(bam1_t *read) { - int32_t *positions = malloc(sizeof(int32_t) * (size_t)read->core.l_qseq); - int i, j, offset = 0, op, op_len; - uint32_t *CIGAR = bam_get_cigar(read); - int32_t previous_position = read->core.pos; - - for(i=0; icore.n_cigar; i++) { - op = bam_cigar_op(*(CIGAR+i)); - op_len = bam_cigar_oplen(*(CIGAR+i)); - for(j=0; jcore.l_qseq, nb = b->core.l_qseq; - int32_t *posa = calculate_positions(a); - int32_t *posb = calculate_positions(b); - uint8_t *a_qual = bam_get_qual(a), *b_qual = bam_get_qual(b); - uint8_t *a_seq = bam_get_seq(a), *b_seq = bam_get_seq(b); - - //If alignments are on opposite strands then exit - int sa = getStrand(a); - int sb = getStrand(b); - if(((sa-sb)&1) == 1) goto quit; - - //Go to the first mapped position - while(iab_qual[ib] && bam_seqi(a_seq,ia) != 15) { - a_qual[ia] -= b_qual[ib]; - b_qual[ib] = 0; - } else if(b_qual[ib]>a_qual[ia] && bam_seqi(b_seq,ib) != 15) { - b_qual[ib] -= a_qual[ia]; - a_qual[ia] = 0; - } else { - a_qual[ia] = 0; - b_qual[ib] = 0; - } - } else { - if(a_qual[ia]>b_qual[ib]) { - a_qual[ia] += 0.2*a_qual[ia]; - b_qual[ib] = 0; - } else { - b_qual[ib] += 0.2*b_qual[ib]; - a_qual[ia] = 0; - } - } - a_qual[ia] = (a_qual[ia]<=255) ? a_qual[ia] : 255; - b_qual[ib] = (b_qual[ib]<=255) ? b_qual[ib] : 255; - ia++; - ib++; - } - -quit : - free(posa); - free(posb); -} - -//This is a modified version of overlap_push() -static void cust_overlap_push(bam_plp_t iter, lbnode_t *node) -{ - if ( !iter->overlaps ) return; - - // mapped mates only - if ( node->b.core.flag&BAM_FMUNMAP ) return; - - //Same chromosomes only - if((&node->b)->core.tid != (&node->b)->core.mtid) return; - - //Overlap impossible - if((&node->b)->core.pos < (&node->b)->core.mpos) { - if(bam_endpos(&node->b) < (&node->b)->core.mpos) return; - } - - khiter_t kitr = kh_get(olap_hash, iter->overlaps, bam_get_qname(&node->b)); - if ( kitr==kh_end(iter->overlaps) ) - { - if((&node->b)->core.pos > (&node->b)->core.mpos) return; //The mate should be here, but isn't - int ret; - kitr = kh_put(olap_hash, iter->overlaps, bam_get_qname(&node->b), &ret); - kh_value(iter->overlaps, kitr) = node; - } - else - { - lbnode_t *a = kh_value(iter->overlaps, kitr); - cust_tweak_overlap_quality(&a->b, &node->b); - kh_del(olap_hash, iter->overlaps, kitr); - assert(a->end-1 == a->s.end); - a->end = a->b.core.pos + bam_cigar2rlen(a->b.core.n_cigar, bam_get_cigar(&a->b)); - a->s.end = a->end - 1; - } -} - -//Essentially overlap_remove() -static void cust_overlap_remove(bam_plp_t iter, const bam1_t *b) { - if(!iter->overlaps) return; - - khiter_t kitr; - if(b) { - kitr = kh_get(olap_hash, iter->overlaps, bam_get_qname(b)); - if ( kitr!=kh_end(iter->overlaps) ) - kh_del(olap_hash, iter->overlaps, kitr); - } else { - // remove all - for (kitr = kh_begin(iter->overlaps); kitroverlaps); kitr++) - if ( kh_exist(iter->overlaps, kitr) ) kh_del(olap_hash, iter->overlaps, kitr); - } -} - - -//This is essentially just bam_plp_push() -int cust_plp_push(bam_plp_t iter, const bam1_t *b) -{ - if (iter->error) return -1; - if (b) { - if (b->core.tid < 0) { cust_overlap_remove(iter, b); return 0; } - // Skip only unmapped reads here, any additional filtering must be done in iter->func - if (b->core.flag & BAM_FUNMAP) { cust_overlap_remove(iter, b); return 0; } - if (iter->tid == b->core.tid && iter->pos == b->core.pos && iter->mp->cnt > iter->maxcnt) - { - cust_overlap_remove(iter, b); - return 0; - } - bam_copy1(&iter->tail->b, b); - cust_overlap_push(iter, iter->tail); - iter->tail->beg = b->core.pos; - iter->tail->end = b->core.pos + bam_cigar2rlen(b->core.n_cigar, bam_get_cigar(b)); - iter->tail->s = g_cstate_null; iter->tail->s.end = iter->tail->end - 1; // initialize cstate_t - if (b->core.tid < iter->max_tid) { - fprintf(stderr, "[cust_plp_push] the input is not sorted (chromosomes out of order)\n"); - iter->error = 1; - return -1; - } - if ((b->core.tid == iter->max_tid) && (iter->tail->beg < iter->max_pos)) { - fprintf(stderr, "[cust_plp_push] the input is not sorted (reads out of order)\n"); - iter->error = 1; - return -1; - } - iter->max_tid = b->core.tid; iter->max_pos = iter->tail->beg; - if (iter->tail->end > iter->pos || iter->tail->b.core.tid > iter->tid) { - iter->tail->next = mp_alloc(iter->mp); - iter->tail = iter->tail->next; - } - } else iter->is_eof = 1; - return 0; -} - -//This is essentially just bam_plp_auto -const bam_pileup1_t *cust_plp_auto(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp) -{ - const bam_pileup1_t *plp; - if (iter->func == 0 || iter->error) { *_n_plp = -1; return 0; } - if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp; - else { // no pileup line can be obtained; read alignments - *_n_plp = 0; - if (iter->is_eof) return 0; - int ret; - while ( (ret=iter->func(iter->data, iter->b)) >= 0) { - if (cust_plp_push(iter, iter->b) < 0) { - *_n_plp = -1; - return 0; - } - if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp; - // otherwise no pileup line can be returned; read the next alignment. - } - if ( ret < -1 ) { iter->error = ret; *_n_plp = -1; return 0; } - bam_plp_push(iter, 0); - if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp; - return 0; - } -} - - -//This is essentially just bam_mplp_auto from htslib -int cust_mplp_auto(bam_mplp_t iter, int *_tid, int *_pos, int *n_plp, const bam_pileup1_t **plp) -{ - int i, ret = 0; - uint64_t new_min = (uint64_t)-1; - for (i = 0; i < iter->n; ++i) { - if (iter->pos[i] == iter->min) { - int tid, pos; - iter->plp[i] = cust_plp_auto(iter->iter[i], &tid, &pos, &iter->n_plp[i]); - if ( iter->iter[i]->error ) return -1; - iter->pos[i] = iter->plp[i] ? (uint64_t)tid<<32 | pos : 0; - } - if (iter->plp[i] && iter->pos[i] < new_min) new_min = iter->pos[i]; - } - iter->min = new_min; - if (new_min == (uint64_t)-1) return 0; - *_tid = new_min>>32; *_pos = (uint32_t)new_min; - for (i = 0; i < iter->n; ++i) { - if (iter->pos[i] == iter->min) { // FIXME: valgrind reports "uninitialised value(s) at this line" - n_plp[i] = iter->n_plp[i], plp[i] = iter->plp[i]; - ++ret; - } else n_plp[i] = 0, plp[i] = 0; - } - return ret; -} diff --git a/test_CpG.bedGraph b/test_CpG.bedGraph deleted file mode 100644 index 9be11ed..0000000 --- a/test_CpG.bedGraph +++ /dev/null @@ -1 +0,0 @@ -track type="bedGraph" description="test CpG methylation levels" From be0dd49d45d3fe04ebeccdc0afd67cc374dbb339 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Mon, 22 Feb 2021 21:32:42 +0100 Subject: [PATCH 07/44] Valgrind passes and two medium-sized test files produce correct results. --- MethylDackel.h | 1 + extract.c | 1 + overlaps.c | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/MethylDackel.h b/MethylDackel.h index 6ea097c..cf6e21e 100644 --- a/MethylDackel.h +++ b/MethylDackel.h @@ -225,6 +225,7 @@ void parseBounds(char *s2, int *vals, int mult); //Used internally to not split CpGs/CHGs between threads void adjustBounds(Config *config, bam_hdr_t *hdr, faidx_t *fai, uint32_t *localTid, uint32_t *localPos, uint32_t *localEnd); +// Read-pair overlap handling functions int custom_overlap_constructor(void *data, const bam1_t *b, bam_pileup_cd *cd); int custom_overlap_destructor(void *data, const bam1_t *b, bam_pileup_cd *cd); void initOlapHash(); diff --git a/extract.c b/extract.c index 6646de3..377827d 100644 --- a/extract.c +++ b/extract.c @@ -388,6 +388,7 @@ void *extractCalls(void *foo) { iter = bam_mplp_init(1, filter_func, (void **) &data); bam_mplp_set_maxcnt(iter, INT_MAX); bam_mplp_constructor(iter, custom_overlap_constructor); + bam_mplp_destructor(iter, custom_overlap_destructor); initOlapHash(); while((ret = bam_mplp64_auto(iter, &tid, &pos, &n_plp, plp)) > 0) { diff --git a/overlaps.c b/overlaps.c index 84d4c77..a954e89 100644 --- a/overlaps.c +++ b/overlaps.c @@ -120,15 +120,23 @@ int custom_overlap_constructor(void *data, const bam1_t *b, bam_pileup_cd *cd) { int ret; khiter_t k = kh_get(olap_hash, ohash, bam_get_qname(b)); bam1_t *a; + // Skip unpaired reads + if(!(b->core.flag & BAM_FPAIRED) || ((b->core.flag & 12) > 0)) return 0; if (k==kh_end(ohash)) { k = kh_put(olap_hash, ohash, bam_get_qname(b), &ret); kh_value(ohash, k) = b; - return 0; } else { a = kh_value(ohash, k); + if(a == b) return 0; // For some reason, the same read is occasionally processed multiple times cust_tweak_overlap_quality(a, b); kh_del(olap_hash, ohash, k); } return 0; } + +int custom_overlap_destructor(void *data, const bam1_t *b, bam_pileup_cd *cd) { + khiter_t k = kh_get(olap_hash, ohash, bam_get_qname(b)); + if (k!=kh_end(ohash)) kh_del(olap_hash, ohash, k); + return 0; +} From eaf684603c96ae0968470fd9134b63291cbf2697 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 17:33:14 +0100 Subject: [PATCH 08/44] Update overlap handling, test compilation failure against earlier htslib versions. --- CHANGELOG.md | 2 +- Makefile | 2 +- MethylDackel.h | 11 +++++++++-- README.md | 2 +- azure-pipeline.yml | 46 ++++++++++++++++++++++------------------------ extract.c | 6 +++--- overlaps.c | 17 +++++++++++------ 7 files changed, 48 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 769c379..381d5aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ Version 0.5.2: - * Temporary work around for issue #99. Long-term pileup.c needs to be reworked. + * Rewrote how read-pair overlap handling is performed. It now uses the constructor/destructor mechanism from htslib instead of using internal htslib structures and functions. This allows supporting newer htslib versions. Currently 1.11 is the only tested and working version, due to changes in the pileup constructor interface in it. (issue #99) Version 0.5.1: diff --git a/Makefile b/Makefile index 84c7449..421858d 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ version.h: echo '#define VERSION "$(VERSION)"' > $@ .c.o: - $(CC) -c $(CFLAGS) $(LIBS) -IlibBigWig $< -o $@ + $(CC) -c $(CFLAGS) -g $(LIBS) -IlibBigWig $< -o $@ libMethylDackel.a: version.h $(OBJS) -@rm -f $@ diff --git a/MethylDackel.h b/MethylDackel.h index cf6e21e..8a2dc40 100644 --- a/MethylDackel.h +++ b/MethylDackel.h @@ -5,6 +5,11 @@ #include "htslib/faidx.h" #include "bigWig.h" +#if HTS_VERSION < 101100 +#error "The minimum supported version of htslib is 1.11!" +#endif + + //These are needed to handle multiple threads pthread_mutex_t positionMutex; pthread_mutex_t bwMutex; @@ -121,6 +126,7 @@ typedef struct { @field config: The Config* structure containing the settings @field hdr: The input header @field iter: The alignment iterator that should be traversed. + @field ohash: A pointer to the hash table needed for overlap detection @field bedIdx: The last index into the BED file */ typedef struct { @@ -128,6 +134,7 @@ typedef struct { htsFile *fp; bam_hdr_t *hdr; hts_itr_t *iter; + void *ohash; int32_t bedIdx; } mplp_data; @@ -228,5 +235,5 @@ void adjustBounds(Config *config, bam_hdr_t *hdr, faidx_t *fai, uint32_t *localT // Read-pair overlap handling functions int custom_overlap_constructor(void *data, const bam1_t *b, bam_pileup_cd *cd); int custom_overlap_destructor(void *data, const bam1_t *b, bam_pileup_cd *cd); -void initOlapHash(); -void destroyOlapHash(); +void *initOlapHash(); +void destroyOlapHash(void *ohash); diff --git a/README.md b/README.md index aa4b2ed..9716381 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Prerequisites ============= -A C compiler, such as gcc, htslib (versions 1.4 through 1.9 are known to be compatible) and libBigWig are required. For libBigWig, the static library is used. +A C compiler, such as gcc, htslib (at least versions 1.11, earlier versions are not compatible) and libBigWig are required. For libBigWig, the static library is used. Compilation =========== diff --git a/azure-pipeline.yml b/azure-pipeline.yml index 2272e03..02e52d9 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -8,8 +8,6 @@ jobs: vmImage: 'ubuntu-16.04' strategy: matrix: - htslib109: - htslib_version: '1.9' htslib110: htslib_version: '1.10' htslib111: @@ -24,25 +22,25 @@ jobs: - template: .azure-pipelines/test-template.yml #This tries to link against 32-bit libraries for some reason -#- job: 'OSX' -# pool: -# vmImage: 'macOS-10.13' -# strategy: -# matrix: -# Python37: -# python.version: '3.7' -# maxParallel: 1 -# -# steps: -# - script: | -# echo "Removing homebrew from Azure to avoid conflicts." -# curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall > ~/uninstall_homebrew -# chmod +x ~/uninstall_homebrew -# ~/uninstall_homebrew -fq -# rm ~/uninstall_homebrew -# displayName: Remove homebrew -# - bash: echo "##vso[task.prependpath]$CONDA/bin" -# displayName: Add conda to PATH -# - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib python clang clang_osx-64 clangxx cctools compiler-rt ld64 -# displayName: Installing dependencies -# - template: .azure-pipelines/test-template.yml +- job: 'OSX' + pool: + vmImage: 'macOS-10.13' + strategy: + matrix: + htslib111: + htslib_version: '1.11' + maxParallel: 1 + + steps: + - script: | + echo "Removing homebrew from Azure to avoid conflicts." + curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall > ~/uninstall_homebrew + chmod +x ~/uninstall_homebrew + ~/uninstall_homebrew -fq + rm ~/uninstall_homebrew + displayName: Remove homebrew + - bash: echo "##vso[task.prependpath]$CONDA/bin" + displayName: Add conda to PATH + - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$htslib_version python clang clang_osx-64 clangxx cctools compiler-rt ld64 libbigwig + displayName: Installing dependencies + - template: .azure-pipelines/test-template.yml diff --git a/extract.c b/extract.c index 377827d..a92ca71 100644 --- a/extract.c +++ b/extract.c @@ -385,11 +385,11 @@ void *extractCalls(void *foo) { } //Start the pileup + data->ohash = initOlapHash(); iter = bam_mplp_init(1, filter_func, (void **) &data); bam_mplp_set_maxcnt(iter, INT_MAX); bam_mplp_constructor(iter, custom_overlap_constructor); bam_mplp_destructor(iter, custom_overlap_destructor); - initOlapHash(); while((ret = bam_mplp64_auto(iter, &tid, &pos, &n_plp, plp)) > 0) { if(pos < localPos || pos >= localEnd) continue; // out of the region requested @@ -528,7 +528,7 @@ void *extractCalls(void *foo) { pthread_mutex_unlock(&outputMutex); break; } - destroyOlapHash(); + destroyOlapHash(data->ohash); } free(os_CpG->s); free(os_CpG); @@ -571,7 +571,7 @@ void extract_usage() { " -q INT Minimum MAPQ threshold to include an alignment (default 10)\n" " -p INT Minimum Phred threshold to include a base (default 5). This\n" " must be >0.\n" -" -D INT Maximum per-base depth (default 2000)\n" +" -D INT Ignored, kept only for backward compatibility.\n" " -d INT Minimum per-base depth for reporting output. If you use\n" " --mergeContext, this then applies to the merged CpG/CHG.\n" " (default 1)\n" diff --git a/overlaps.c b/overlaps.c index a954e89..78c0b68 100644 --- a/overlaps.c +++ b/overlaps.c @@ -4,21 +4,23 @@ #include #include "htslib/khash.h" #include "htslib/sam.h" +#include "MethylDackel.h" int getStrand(bam1_t *b); // Dictionary of overlapping reads -//KHASH_MAP_INIT_STR(olap_hash, lbnode_t *) KHASH_MAP_INIT_STR(olap_hash, bam1_t *) typedef khash_t(olap_hash) olap_hash_t; khash_t(olap_hash) *ohash = NULL; -void initOlapHash() { - ohash = kh_init(olap_hash); + +void * initOlapHash() { + return (void*) kh_init(olap_hash); } -void destroyOlapHash() { - kh_destroy(olap_hash, ohash); +void destroyOlapHash(void *ohash) { + khash_t(olap_hash) * oh = ( khash_t(olap_hash) *) ohash; + kh_destroy(olap_hash, oh); } //This is from bison @@ -118,6 +120,8 @@ quit : int custom_overlap_constructor(void *data, const bam1_t *b, bam_pileup_cd *cd) { int ret; + mplp_data *foo = (mplp_data*) data; + khash_t(olap_hash) * ohash = ( khash_t(olap_hash) *)foo->ohash; khiter_t k = kh_get(olap_hash, ohash, bam_get_qname(b)); bam1_t *a; // Skip unpaired reads @@ -127,7 +131,6 @@ int custom_overlap_constructor(void *data, const bam1_t *b, bam_pileup_cd *cd) { kh_value(ohash, k) = b; } else { a = kh_value(ohash, k); - if(a == b) return 0; // For some reason, the same read is occasionally processed multiple times cust_tweak_overlap_quality(a, b); kh_del(olap_hash, ohash, k); } @@ -136,6 +139,8 @@ int custom_overlap_constructor(void *data, const bam1_t *b, bam_pileup_cd *cd) { } int custom_overlap_destructor(void *data, const bam1_t *b, bam_pileup_cd *cd) { + mplp_data *foo = (mplp_data*) data; + khash_t(olap_hash) * ohash = ( khash_t(olap_hash) *)foo->ohash; khiter_t k = kh_get(olap_hash, ohash, bam_get_qname(b)); if (k!=kh_end(ohash)) kh_del(olap_hash, ohash, k); return 0; From 40a2341f2b4fffd823d741f2676a5c1bbb86aa8a Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 17:38:28 +0100 Subject: [PATCH 09/44] Try the latest OSX, tweak the sysroot --- .azure-pipelines/test-template.yml | 1 + azure-pipeline.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index fff3dcf..365b5d1 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -1,6 +1,7 @@ steps: - bash: | source activate foo + export CONDA_BUILD_SYSROOT='' make install CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" prefix=$CONDA_PREFIX/bin displayName: Installing methylDackel - bash: | diff --git a/azure-pipeline.yml b/azure-pipeline.yml index 02e52d9..aae15c5 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -24,7 +24,7 @@ jobs: #This tries to link against 32-bit libraries for some reason - job: 'OSX' pool: - vmImage: 'macOS-10.13' + vmImage: 'macOS-latest' strategy: matrix: htslib111: From ff1cc4dd704dc4341121891e9abeee380fbeafed Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 17:42:26 +0100 Subject: [PATCH 10/44] azure debug --- azure-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipeline.yml b/azure-pipeline.yml index aae15c5..c8204b6 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -17,7 +17,7 @@ jobs: steps: - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" displayName: Add conda to PATH - - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$htslib_version python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig + - bash: env && conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$htslib_version python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml From e545235a8c81a1e9beb577cd7578e9f6c63fada7 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 17:44:59 +0100 Subject: [PATCH 11/44] azure debug --- azure-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipeline.yml b/azure-pipeline.yml index c8204b6..a3298d4 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -17,7 +17,7 @@ jobs: steps: - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" displayName: Add conda to PATH - - bash: env && conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$htslib_version python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig + - bash: env && conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$(htslib_version) python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml From 2abf0493ce18e8a48ab6122a2b70197a93433662 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 17:51:54 +0100 Subject: [PATCH 12/44] azure osx permissions --- azure-pipeline.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/azure-pipeline.yml b/azure-pipeline.yml index a3298d4..a9af715 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -8,8 +8,6 @@ jobs: vmImage: 'ubuntu-16.04' strategy: matrix: - htslib110: - htslib_version: '1.10' htslib111: htslib_version: '1.11' maxParallel: 1 @@ -17,7 +15,7 @@ jobs: steps: - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" displayName: Add conda to PATH - - bash: env && conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$(htslib_version) python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig + - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml @@ -39,8 +37,8 @@ jobs: ~/uninstall_homebrew -fq rm ~/uninstall_homebrew displayName: Remove homebrew - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: Add conda to PATH - - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$htslib_version python clang clang_osx-64 clangxx cctools compiler-rt ld64 libbigwig + #- bash: echo "##vso[task.prependpath]$CONDA/bin" + # displayName: Add conda to PATH + - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python clang clang_osx-64 clangxx cctools compiler-rt ld64 libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml From 74dedfeb0dd93505afcfacd00a91f3b07586d8e7 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 17:54:47 +0100 Subject: [PATCH 13/44] Try changing env name --- .azure-pipelines/test-template.yml | 4 ++-- azure-pipeline.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 365b5d1..c9fc216 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -1,11 +1,11 @@ steps: - bash: | - source activate foo + source activate MethylDackel export CONDA_BUILD_SYSROOT='' make install CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" prefix=$CONDA_PREFIX/bin displayName: Installing methylDackel - bash: | - source activate foo + source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib make test CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" displayName: Test methylDackel diff --git a/azure-pipeline.yml b/azure-pipeline.yml index a9af715..8323b8f 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -15,7 +15,7 @@ jobs: steps: - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" displayName: Add conda to PATH - - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig + - bash: conda create -n MethylDackel -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml @@ -39,6 +39,6 @@ jobs: displayName: Remove homebrew #- bash: echo "##vso[task.prependpath]$CONDA/bin" # displayName: Add conda to PATH - - bash: conda create -n foo -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python clang clang_osx-64 clangxx cctools compiler-rt ld64 libbigwig + - bash: conda create -n MethylDackel -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python clang clang_osx-64 clangxx cctools compiler-rt ld64 libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml From f49db3745308ce6796803489e6e3b06bbbcaf3d1 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 17:57:22 +0100 Subject: [PATCH 14/44] Fix permissions --- azure-pipeline.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipeline.yml b/azure-pipeline.yml index 8323b8f..cbec886 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -39,6 +39,8 @@ jobs: displayName: Remove homebrew #- bash: echo "##vso[task.prependpath]$CONDA/bin" # displayName: Add conda to PATH + - bash: sudo chown 501:20 /usr/local/miniconda/pkgs/cache/ + displayName: Fix permissions - bash: conda create -n MethylDackel -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python clang clang_osx-64 clangxx cctools compiler-rt ld64 libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml From 89203104a3683e6ce4abd112e0fdd65c941678fe Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 17:59:34 +0100 Subject: [PATCH 15/44] More permissions fixes on OSX --- azure-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipeline.yml b/azure-pipeline.yml index cbec886..f38bfd7 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -39,7 +39,7 @@ jobs: displayName: Remove homebrew #- bash: echo "##vso[task.prependpath]$CONDA/bin" # displayName: Add conda to PATH - - bash: sudo chown 501:20 /usr/local/miniconda/pkgs/cache/ + - bash: sudo chown -r 501:20 /usr/local/miniconda/pkgs displayName: Fix permissions - bash: conda create -n MethylDackel -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python clang clang_osx-64 clangxx cctools compiler-rt ld64 libbigwig displayName: Installing dependencies From b7259d3fb67eb9f70eae12246f1e641b63692b3d Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 19:08:09 +0100 Subject: [PATCH 16/44] typo --- azure-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipeline.yml b/azure-pipeline.yml index f38bfd7..d1dd1a1 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -39,7 +39,7 @@ jobs: displayName: Remove homebrew #- bash: echo "##vso[task.prependpath]$CONDA/bin" # displayName: Add conda to PATH - - bash: sudo chown -r 501:20 /usr/local/miniconda/pkgs + - bash: sudo chown -R 501:20 /usr/local/miniconda/pkgs displayName: Fix permissions - bash: conda create -n MethylDackel -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python clang clang_osx-64 clangxx cctools compiler-rt ld64 libbigwig displayName: Installing dependencies From 3e71fe2f150f7d0b434e98338a7a062d84ed74ef Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 19:11:20 +0100 Subject: [PATCH 17/44] azure tweaks --- .azure-pipelines/test-template.yml | 4 ++-- azure-pipeline.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index c9fc216..f5bd078 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -1,11 +1,11 @@ steps: - bash: | - source activate MethylDackel + conda activate MethylDackel export CONDA_BUILD_SYSROOT='' make install CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" prefix=$CONDA_PREFIX/bin displayName: Installing methylDackel - bash: | - source activate MethylDackel + conda activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib make test CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" displayName: Test methylDackel diff --git a/azure-pipeline.yml b/azure-pipeline.yml index d1dd1a1..467345e 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -13,8 +13,8 @@ jobs: maxParallel: 1 steps: - - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" - displayName: Add conda to PATH + #- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" + # displayName: Add conda to PATH - bash: conda create -n MethylDackel -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml From 62427f900750eb23619172ed34a63de33c7bd4e0 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 19:15:48 +0100 Subject: [PATCH 18/44] azure tweaks --- .azure-pipelines/test-template.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index f5bd078..c9fc216 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -1,11 +1,11 @@ steps: - bash: | - conda activate MethylDackel + source activate MethylDackel export CONDA_BUILD_SYSROOT='' make install CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" prefix=$CONDA_PREFIX/bin displayName: Installing methylDackel - bash: | - conda activate MethylDackel + source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib make test CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" displayName: Test methylDackel From 4d07b0e280cf2789b67c71a6e87e0ccf1268f9ac Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 19:18:50 +0100 Subject: [PATCH 19/44] azure tweaks --- azure-pipeline.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipeline.yml b/azure-pipeline.yml index 467345e..0b9c091 100644 --- a/azure-pipeline.yml +++ b/azure-pipeline.yml @@ -13,8 +13,8 @@ jobs: maxParallel: 1 steps: - #- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" - # displayName: Add conda to PATH + - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" + displayName: Add conda to PATH - bash: conda create -n MethylDackel -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python gcc_impl_linux-64 binutils_impl_linux-64 binutils_linux-64 gcc_linux-64 libgcc-ng libbigwig displayName: Installing dependencies - template: .azure-pipelines/test-template.yml @@ -37,8 +37,8 @@ jobs: ~/uninstall_homebrew -fq rm ~/uninstall_homebrew displayName: Remove homebrew - #- bash: echo "##vso[task.prependpath]$CONDA/bin" - # displayName: Add conda to PATH + - bash: echo "##vso[task.prependpath]$CONDA/bin" + displayName: Add conda to PATH - bash: sudo chown -R 501:20 /usr/local/miniconda/pkgs displayName: Fix permissions - bash: conda create -n MethylDackel -q --yes -c conda-forge -c bioconda htslib=$(HTSLIB_VERSION) python clang clang_osx-64 clangxx cctools compiler-rt ld64 libbigwig From a53bc2266f92553d51b1bf02282284b27531725d Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 19:32:22 +0100 Subject: [PATCH 20/44] extern --- MethylDackel.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MethylDackel.h b/MethylDackel.h index 8a2dc40..1661f14 100644 --- a/MethylDackel.h +++ b/MethylDackel.h @@ -11,15 +11,15 @@ //These are needed to handle multiple threads -pthread_mutex_t positionMutex; -pthread_mutex_t bwMutex; -pthread_mutex_t outputMutex; -uint32_t globalTid; -uint32_t globalPos; -uint32_t globalEnd; -uint32_t bin; -uint32_t outputBin; -uint64_t globalnVariantPositions; +extern pthread_mutex_t positionMutex; +extern pthread_mutex_t bwMutex; +extern pthread_mutex_t outputMutex; +extern uint32_t globalTid; +extern uint32_t globalPos; +extern uint32_t globalEnd; +extern uint32_t bin; +extern uint32_t outputBin; +extern uint64_t globalnVariantPositions; /*! @typedef @abstract Structure to hold one region defined in a BED file From 16a558c856e82a08f18ea3624e22f35f7cf3d51f Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 19:57:19 +0100 Subject: [PATCH 21/44] extern --- main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.c b/main.c index 880d15d..3aecc1d 100644 --- a/main.c +++ b/main.c @@ -3,6 +3,16 @@ #include "htslib/hts.h" #include "version.h" //This has the VERSION define +pthread_mutex_t positionMutex; +pthread_mutex_t bwMutex; +pthread_mutex_t outputMutex; +uint32_t globalTid = 0; +uint32_t globalPos = 0; +uint32_t globalEnd = 0; +uint32_t bin = 0; +uint32_t outputBin = 0; +uint64_t globalnVariantPositions = 0; + int mbias_main(int argc, char *argv[]); int extract_main(int argc, char *argv[]); int mergeContext_main(int argc, char *argv[]); From 5d0d362edd6711926ac385eeed3aab95a8b9cf0e Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 20:00:36 +0100 Subject: [PATCH 22/44] debug --- .azure-pipelines/test-template.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index c9fc216..cd03905 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -7,5 +7,6 @@ steps: - bash: | source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib + ls -l $CONDA_PREFIX/lib/libhts* make test CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" displayName: Test methylDackel From f96ef6a905406d00619ed004adf0b80be7fad025 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 20:05:19 +0100 Subject: [PATCH 23/44] osx --- .azure-pipelines/test-template.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index cd03905..954de9a 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -8,5 +8,6 @@ steps: source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib ls -l $CONDA_PREFIX/lib/libhts* + otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib make test CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" displayName: Test methylDackel From df75ab299ec3af25dd44527ee3ef6f9fa2918666 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 20:05:39 +0100 Subject: [PATCH 24/44] osx --- .azure-pipelines/test-template.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 954de9a..9ae60e8 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -8,6 +8,7 @@ steps: source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib ls -l $CONDA_PREFIX/lib/libhts* + otool -L MethylDackel otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib make test CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" displayName: Test methylDackel From edaef8796c915a7f72bdedd26d380a0f808cd419 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 20:34:37 +0100 Subject: [PATCH 25/44] debug --- .azure-pipelines/test-template.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 9ae60e8..c2ebf37 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -7,6 +7,7 @@ steps: - bash: | source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib + export LC_RPATH=$LD_LIBRARY_PATH ls -l $CONDA_PREFIX/lib/libhts* otool -L MethylDackel otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib From 783623c7c4de12707ae468df661a87915bc06974 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 20:41:28 +0100 Subject: [PATCH 26/44] debug --- .azure-pipelines/test-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index c2ebf37..4990a96 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -8,7 +8,7 @@ steps: source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib export LC_RPATH=$LD_LIBRARY_PATH - ls -l $CONDA_PREFIX/lib/libhts* + ls -l otool -L MethylDackel otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib make test CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" From 1ed7619f478a3e2dd94b6408c979975e2fe8b5d0 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 21:31:30 +0100 Subject: [PATCH 27/44] hmm --- .azure-pipelines/test-template.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 4990a96..ac8dd49 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -11,5 +11,6 @@ steps: ls -l otool -L MethylDackel otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib - make test CC=$CC CFLAGS="-O3 -Wall -I$CONDA_PREFIX/include" LIBS="-L$CONDA_PREFIX/lib" LIBBIGWIG="$CONDA_PREFIX/lib/libBigWig.a" + install_name_tools -add_rpath @$CONDA_PREFIX/lib + python test/tests.py displayName: Test methylDackel From 434386fbeec0f8e5cb7f0c872b713e435266b4f8 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 21:39:49 +0100 Subject: [PATCH 28/44] typo --- .azure-pipelines/test-template.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index ac8dd49..335ece2 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -11,6 +11,6 @@ steps: ls -l otool -L MethylDackel otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib - install_name_tools -add_rpath @$CONDA_PREFIX/lib - python test/tests.py + install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel + python tests/test.py displayName: Test methylDackel From 7e6ba10d39da9957dfae63d347cc9314b9279999 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 21:46:52 +0100 Subject: [PATCH 29/44] more debug --- .azure-pipelines/test-template.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 335ece2..896a1d9 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -12,5 +12,6 @@ steps: otool -L MethylDackel otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel + DYLD_PRINT_LIBRARIES=1 ./MethylDackel --version python tests/test.py displayName: Test methylDackel From da1abec100049a0de5c9059d631a817b4be31b3b Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 21:51:30 +0100 Subject: [PATCH 30/44] maybe the path is the issue --- .azure-pipelines/test-template.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 896a1d9..60620ef 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -9,9 +9,10 @@ steps: export LD_LIBRARY_PATH=$CONDA_PREFIX/lib export LC_RPATH=$LD_LIBRARY_PATH ls -l + install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel otool -L MethylDackel otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib - install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel DYLD_PRINT_LIBRARIES=1 ./MethylDackel --version + DYLD_PRINT_LIBRARIES=1 ./MethylDackel extract ct100.fa ct_aln.bam -q 2 -o test1 python tests/test.py displayName: Test methylDackel From 9de964e3fc7eb289e1737b852356684dc3379920 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:01:39 +0100 Subject: [PATCH 31/44] foo --- .azure-pipelines/test-template.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 60620ef..0ac9177 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -13,6 +13,7 @@ steps: otool -L MethylDackel otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib DYLD_PRINT_LIBRARIES=1 ./MethylDackel --version - DYLD_PRINT_LIBRARIES=1 ./MethylDackel extract ct100.fa ct_aln.bam -q 2 -o test1 + DYLD_PRINT_LIBRARIES=1 ./MethylDackel extract tests/ct100.fa tests/ct_aln.bam -q 2 -o test1 + echo $? python tests/test.py displayName: Test methylDackel From f801aff8d99e7727a7e3d0af68bbdde280d518c0 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:16:54 +0100 Subject: [PATCH 32/44] OK, the rpath thing maybe --- Makefile | 2 +- tests/test.py => test.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) rename tests/test.py => test.py (70%) diff --git a/Makefile b/Makefile index 421858d..1d0f8b2 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ MethylDackel: libMethylDackel.a version.h $(OBJS) $(CC) $(CFLAGS) $(LIBS) -o MethylDackel $(OBJS) main.c libMethylDackel.a $(LIBBIGWIG) -lm -lz -lpthread -lhts -lcurl test: MethylDackel - python tests/test.py + python test.py clean: rm -f *.o MethylDackel libMethylDackel.a diff --git a/tests/test.py b/test.py similarity index 70% rename from tests/test.py rename to test.py index 4205110..5e58bcb 100644 --- a/tests/test.py +++ b/test.py @@ -11,16 +11,17 @@ def rm(f): pass assert op.exists('../MethylDackel') +MPath = os.path.abspath('../MethylDackel') rm('test1_CpG.bedGraph') -check_call('../MethylDackel extract ct100.fa ct_aln.bam -q 2 -o test1', shell=True) +check_call(MPath + ' extract tests/ct100.fa tests/ct_aln.bam -q 2 -o test1', shell=True) assert op.exists('test1_CpG.bedGraph') lines = sum(1 for _ in open('test1_CpG.bedGraph')) assert lines == 1 rm('test1_CpG.bedGraph') rm('test2_CpG.bedGraph') -check_call('../MethylDackel extract cg100.fa cg_aln.bam -q 2 -o test2', shell=True) +check_call(MPath + ' extract tests/cg100.fa tests/cg_aln.bam -q 2 -o test2', shell=True) assert op.exists('test2_CpG.bedGraph') for line in open('test2_CpG.bedGraph'): print(line) @@ -30,7 +31,7 @@ def rm(f): # should be none with q > 10 rm('test3_CpG.bedGraph') -check_call('../MethylDackel extract cg100.fa cg_aln.bam -q 10 -o test3', shell=True) +check_call(MPath + ' extract tests/cg100.fa tests/cg_aln.bam -q 10 -o test3', shell=True) assert op.exists('test3_CpG.bedGraph') lines = sum(1 for _ in open('test3_CpG.bedGraph')) assert lines == 1 @@ -40,7 +41,7 @@ def rm(f): rm('test4_CpG.methylKit') rm('test4_CHG.methylKit') rm('test4_CHH.methylKit') -check_call('../MethylDackel extract --methylKit --CHH --CHG cg100.fa cg_aln.bam -q 2 -o test4', shell=True) +check_call(MPath + ' extract --methylKit --CHH --CHG tests/cg100.fa tests/cg_aln.bam -q 2 -o test4', shell=True) assert op.exists('test4_CpG.methylKit') lines = sum(1 for _ in open('test4_CpG.methylKit')) assert lines > 1 @@ -55,7 +56,7 @@ def rm(f): # Check that --minDepth is working, which means there should be no called sites rm('test5_CpG.bedGraph') -check_call('../MethylDackel extract --minDepth 2 cg100.fa cg_aln.bam -q 2 -o test5', shell=True) +check_call(MPath + ' extract --minDepth 2 tests/cg100.fa tests/cg_aln.bam -q 2 -o test5', shell=True) assert op.exists('test5_CpG.bedGraph') lines = sum(1 for _ in open('test5_CpG.bedGraph')) assert lines == 1 @@ -63,7 +64,7 @@ def rm(f): # Check that --ignoreFlags is working, which means that there are now called sites rm('test6_CpG.bedGraph') -check_call('../MethylDackel extract --ignoreFlags 0xD00 cg100.fa cg_aln.bam -q 2 -o test6', shell=True) +check_call(MPath + ' extract --ignoreFlags 0xD00 tests/cg100.fa tests/cg_aln.bam -q 2 -o test6', shell=True) assert op.exists('test6_CpG.bedGraph') lines = sum(1 for _ in open('test6_CpG.bedGraph')) assert lines == 49 @@ -71,7 +72,7 @@ def rm(f): # Check that --requireFlags is working rm('test7_CpG.bedGraph') -check_call('../MethylDackel extract --requireFlags 0xD00 cg100.fa cg_aln.bam -q 2 -o test7', shell=True) +check_call(MPath + ' extract --requireFlags 0xD00 tests/cg100.fa tests/cg_aln.bam -q 2 -o test7', shell=True) assert op.exists('test7_CpG.bedGraph') lines = sum(1 for _ in open('test7_CpG.bedGraph')) assert lines == 49 @@ -79,7 +80,7 @@ def rm(f): # Check absolute trimming bounds rm('test8_CpG.bedGraph') -check_call('../MethylDackel extract --nOT 50,50,40,40 cg100.fa cg_aln.bam -q 2 -o test8', shell=True) +check_call(MPath + ' extract --nOT 50,50,40,40 tests/cg100.fa tests/cg_aln.bam -q 2 -o test8', shell=True) assert op.exists('test8_CpG.bedGraph') lines = sum(1 for _ in open('test8_CpG.bedGraph')) assert lines == 12 @@ -87,7 +88,7 @@ def rm(f): # Check variant filtering (there are 49 lines otherwise) rm('test9_CpG.bedGraph') -check_call('../MethylDackel extract -p 1 -q 0 -o test9 --minOppositeDepth 3 --maxVariantFrac 0.25 cg100.fa cg_with_variants.bam', shell=True) +check_call(MPath + ' extract -p 1 -q 0 -o test9 --minOppositeDepth 3 --maxVariantFrac 0.25 tests/cg100.fa tests/cg_with_variants.bam', shell=True) assert op.exists('test9_CpG.bedGraph') lines = sum(1 for _ in open('test9_CpG.bedGraph')) assert lines == 48 From f05471d0c7df1ae7979a2f5465632809cfd353ee Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:24:25 +0100 Subject: [PATCH 33/44] ok --- .azure-pipelines/test-template.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 0ac9177..e9c9640 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -6,14 +6,13 @@ steps: displayName: Installing methylDackel - bash: | source activate MethylDackel - export LD_LIBRARY_PATH=$CONDA_PREFIX/lib - export LC_RPATH=$LD_LIBRARY_PATH - ls -l - install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel - otool -L MethylDackel - otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib - DYLD_PRINT_LIBRARIES=1 ./MethylDackel --version - DYLD_PRINT_LIBRARIES=1 ./MethylDackel extract tests/ct100.fa tests/ct_aln.bam -q 2 -o test1 - echo $? - python tests/test.py + #export LD_LIBRARY_PATH=$CONDA_PREFIX/lib + #export LC_RPATH=$LD_LIBRARY_PATH + #ls -l + #install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel + #otool -L MethylDackel + #otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib + ./MethylDackel --version + #DYLD_PRINT_LIBRARIES=1 ./MethylDackel extract tests/ct100.fa tests/ct_aln.bam -q 2 -o test1 + python test.py displayName: Test methylDackel From 6f9398a89d3128c0dc5f1e33c4d192b3d43f24fb Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:28:12 +0100 Subject: [PATCH 34/44] foo --- .azure-pipelines/test-template.yml | 4 ++-- test.py => tests/test.py | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename test.py => tests/test.py (100%) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index e9c9640..8833478 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -9,10 +9,10 @@ steps: #export LD_LIBRARY_PATH=$CONDA_PREFIX/lib #export LC_RPATH=$LD_LIBRARY_PATH #ls -l - #install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel + install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel #otool -L MethylDackel #otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib ./MethylDackel --version #DYLD_PRINT_LIBRARIES=1 ./MethylDackel extract tests/ct100.fa tests/ct_aln.bam -q 2 -o test1 - python test.py + python tests/test.py displayName: Test methylDackel diff --git a/test.py b/tests/test.py similarity index 100% rename from test.py rename to tests/test.py From 16d2ffe60cd11fc949d057cf9d09dbc2aac8186f Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:31:55 +0100 Subject: [PATCH 35/44] foo --- .azure-pipelines/test-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 8833478..8c2f9d3 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -7,7 +7,7 @@ steps: - bash: | source activate MethylDackel #export LD_LIBRARY_PATH=$CONDA_PREFIX/lib - #export LC_RPATH=$LD_LIBRARY_PATH + export LC_RPATH=$LD_LIBRARY_PATH #ls -l install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel #otool -L MethylDackel From c216db64fbbd18fcb1b521700244a0ee94c430f1 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:34:58 +0100 Subject: [PATCH 36/44] foo --- .azure-pipelines/test-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 8c2f9d3..e659363 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -6,7 +6,7 @@ steps: displayName: Installing methylDackel - bash: | source activate MethylDackel - #export LD_LIBRARY_PATH=$CONDA_PREFIX/lib + export LD_LIBRARY_PATH=$CONDA_PREFIX/lib export LC_RPATH=$LD_LIBRARY_PATH #ls -l install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel From b455cdca84f86dde5ea222a1984445410fde70e4 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:36:34 +0100 Subject: [PATCH 37/44] fix test file path --- tests/test.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test.py b/tests/test.py index 5e58bcb..eb616e5 100644 --- a/tests/test.py +++ b/tests/test.py @@ -14,14 +14,14 @@ def rm(f): MPath = os.path.abspath('../MethylDackel') rm('test1_CpG.bedGraph') -check_call(MPath + ' extract tests/ct100.fa tests/ct_aln.bam -q 2 -o test1', shell=True) +check_call(MPath + ' extract gct100.fa gct_aln.bam -q 2 -o test1', shell=True) assert op.exists('test1_CpG.bedGraph') lines = sum(1 for _ in open('test1_CpG.bedGraph')) assert lines == 1 rm('test1_CpG.bedGraph') rm('test2_CpG.bedGraph') -check_call(MPath + ' extract tests/cg100.fa tests/cg_aln.bam -q 2 -o test2', shell=True) +check_call(MPath + ' extract gcg100.fa gcg_aln.bam -q 2 -o test2', shell=True) assert op.exists('test2_CpG.bedGraph') for line in open('test2_CpG.bedGraph'): print(line) @@ -31,7 +31,7 @@ def rm(f): # should be none with q > 10 rm('test3_CpG.bedGraph') -check_call(MPath + ' extract tests/cg100.fa tests/cg_aln.bam -q 10 -o test3', shell=True) +check_call(MPath + ' extract gcg100.fa gcg_aln.bam -q 10 -o test3', shell=True) assert op.exists('test3_CpG.bedGraph') lines = sum(1 for _ in open('test3_CpG.bedGraph')) assert lines == 1 @@ -41,7 +41,7 @@ def rm(f): rm('test4_CpG.methylKit') rm('test4_CHG.methylKit') rm('test4_CHH.methylKit') -check_call(MPath + ' extract --methylKit --CHH --CHG tests/cg100.fa tests/cg_aln.bam -q 2 -o test4', shell=True) +check_call(MPath + ' extract --methylKit --CHH --CHG gcg100.fa gcg_aln.bam -q 2 -o test4', shell=True) assert op.exists('test4_CpG.methylKit') lines = sum(1 for _ in open('test4_CpG.methylKit')) assert lines > 1 @@ -56,7 +56,7 @@ def rm(f): # Check that --minDepth is working, which means there should be no called sites rm('test5_CpG.bedGraph') -check_call(MPath + ' extract --minDepth 2 tests/cg100.fa tests/cg_aln.bam -q 2 -o test5', shell=True) +check_call(MPath + ' extract --minDepth 2 gcg100.fa gcg_aln.bam -q 2 -o test5', shell=True) assert op.exists('test5_CpG.bedGraph') lines = sum(1 for _ in open('test5_CpG.bedGraph')) assert lines == 1 @@ -64,7 +64,7 @@ def rm(f): # Check that --ignoreFlags is working, which means that there are now called sites rm('test6_CpG.bedGraph') -check_call(MPath + ' extract --ignoreFlags 0xD00 tests/cg100.fa tests/cg_aln.bam -q 2 -o test6', shell=True) +check_call(MPath + ' extract --ignoreFlags 0xD00 gcg100.fa gcg_aln.bam -q 2 -o test6', shell=True) assert op.exists('test6_CpG.bedGraph') lines = sum(1 for _ in open('test6_CpG.bedGraph')) assert lines == 49 @@ -72,7 +72,7 @@ def rm(f): # Check that --requireFlags is working rm('test7_CpG.bedGraph') -check_call(MPath + ' extract --requireFlags 0xD00 tests/cg100.fa tests/cg_aln.bam -q 2 -o test7', shell=True) +check_call(MPath + ' extract --requireFlags 0xD00 gcg100.fa gcg_aln.bam -q 2 -o test7', shell=True) assert op.exists('test7_CpG.bedGraph') lines = sum(1 for _ in open('test7_CpG.bedGraph')) assert lines == 49 @@ -80,7 +80,7 @@ def rm(f): # Check absolute trimming bounds rm('test8_CpG.bedGraph') -check_call(MPath + ' extract --nOT 50,50,40,40 tests/cg100.fa tests/cg_aln.bam -q 2 -o test8', shell=True) +check_call(MPath + ' extract --nOT 50,50,40,40 gcg100.fa gcg_aln.bam -q 2 -o test8', shell=True) assert op.exists('test8_CpG.bedGraph') lines = sum(1 for _ in open('test8_CpG.bedGraph')) assert lines == 12 @@ -88,7 +88,7 @@ def rm(f): # Check variant filtering (there are 49 lines otherwise) rm('test9_CpG.bedGraph') -check_call(MPath + ' extract -p 1 -q 0 -o test9 --minOppositeDepth 3 --maxVariantFrac 0.25 tests/cg100.fa tests/cg_with_variants.bam', shell=True) +check_call(MPath + ' extract -p 1 -q 0 -o test9 --minOppositeDepth 3 --maxVariantFrac 0.25 gcg100.fa gcg_with_variants.bam', shell=True) assert op.exists('test9_CpG.bedGraph') lines = sum(1 for _ in open('test9_CpG.bedGraph')) assert lines == 48 From d4998e56ccdc54f6414a568039ac27422d2373fd Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:37:28 +0100 Subject: [PATCH 38/44] cleanup --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1d0f8b2..69cd46e 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,8 @@ lib: libMethylDackel.a MethylDackel: libMethylDackel.a version.h $(OBJS) $(CC) $(CFLAGS) $(LIBS) -o MethylDackel $(OBJS) main.c libMethylDackel.a $(LIBBIGWIG) -lm -lz -lpthread -lhts -lcurl -test: MethylDackel - python test.py +test: + python tests/test.py clean: rm -f *.o MethylDackel libMethylDackel.a From 0f51ea3daf168821d24aa5a39b3138299c5d98b4 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:38:58 +0100 Subject: [PATCH 39/44] more cleanup --- .azure-pipelines/test-template.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index e659363..c4ecaf8 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -7,12 +7,8 @@ steps: - bash: | source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib - export LC_RPATH=$LD_LIBRARY_PATH - #ls -l + #export LC_RPATH=$LD_LIBRARY_PATH install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel - #otool -L MethylDackel - #otool -L $CONDA_PREFIX/lib/libhts.1.11.dylib ./MethylDackel --version - #DYLD_PRINT_LIBRARIES=1 ./MethylDackel extract tests/ct100.fa tests/ct_aln.bam -q 2 -o test1 python tests/test.py displayName: Test methylDackel From 88225480e5e82f3e23d4115476986eed1b750586 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:43:48 +0100 Subject: [PATCH 40/44] foo --- tests/test.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/test.py b/tests/test.py index eb616e5..ab39059 100644 --- a/tests/test.py +++ b/tests/test.py @@ -12,16 +12,17 @@ def rm(f): assert op.exists('../MethylDackel') MPath = os.path.abspath('../MethylDackel') +check_call([MPath, '--version']) rm('test1_CpG.bedGraph') -check_call(MPath + ' extract gct100.fa gct_aln.bam -q 2 -o test1', shell=True) +check_call(MPath + ' extract ct100.fa ct_aln.bam -q 2 -o test1', shell=True) assert op.exists('test1_CpG.bedGraph') lines = sum(1 for _ in open('test1_CpG.bedGraph')) assert lines == 1 rm('test1_CpG.bedGraph') rm('test2_CpG.bedGraph') -check_call(MPath + ' extract gcg100.fa gcg_aln.bam -q 2 -o test2', shell=True) +check_call(MPath + ' extract cg100.fa cg_aln.bam -q 2 -o test2', shell=True) assert op.exists('test2_CpG.bedGraph') for line in open('test2_CpG.bedGraph'): print(line) @@ -31,7 +32,7 @@ def rm(f): # should be none with q > 10 rm('test3_CpG.bedGraph') -check_call(MPath + ' extract gcg100.fa gcg_aln.bam -q 10 -o test3', shell=True) +check_call(MPath + ' extract cg100.fa cg_aln.bam -q 10 -o test3', shell=True) assert op.exists('test3_CpG.bedGraph') lines = sum(1 for _ in open('test3_CpG.bedGraph')) assert lines == 1 @@ -41,7 +42,7 @@ def rm(f): rm('test4_CpG.methylKit') rm('test4_CHG.methylKit') rm('test4_CHH.methylKit') -check_call(MPath + ' extract --methylKit --CHH --CHG gcg100.fa gcg_aln.bam -q 2 -o test4', shell=True) +check_call(MPath + ' extract --methylKit --CHH --CHG cg100.fa cg_aln.bam -q 2 -o test4', shell=True) assert op.exists('test4_CpG.methylKit') lines = sum(1 for _ in open('test4_CpG.methylKit')) assert lines > 1 @@ -56,7 +57,7 @@ def rm(f): # Check that --minDepth is working, which means there should be no called sites rm('test5_CpG.bedGraph') -check_call(MPath + ' extract --minDepth 2 gcg100.fa gcg_aln.bam -q 2 -o test5', shell=True) +check_call(MPath + ' extract --minDepth 2 cg100.fa cg_aln.bam -q 2 -o test5', shell=True) assert op.exists('test5_CpG.bedGraph') lines = sum(1 for _ in open('test5_CpG.bedGraph')) assert lines == 1 @@ -64,7 +65,7 @@ def rm(f): # Check that --ignoreFlags is working, which means that there are now called sites rm('test6_CpG.bedGraph') -check_call(MPath + ' extract --ignoreFlags 0xD00 gcg100.fa gcg_aln.bam -q 2 -o test6', shell=True) +check_call(MPath + ' extract --ignoreFlags 0xD00 cg100.fa cg_aln.bam -q 2 -o test6', shell=True) assert op.exists('test6_CpG.bedGraph') lines = sum(1 for _ in open('test6_CpG.bedGraph')) assert lines == 49 @@ -72,7 +73,7 @@ def rm(f): # Check that --requireFlags is working rm('test7_CpG.bedGraph') -check_call(MPath + ' extract --requireFlags 0xD00 gcg100.fa gcg_aln.bam -q 2 -o test7', shell=True) +check_call(MPath + ' extract --requireFlags 0xD00 cg100.fa cg_aln.bam -q 2 -o test7', shell=True) assert op.exists('test7_CpG.bedGraph') lines = sum(1 for _ in open('test7_CpG.bedGraph')) assert lines == 49 @@ -80,7 +81,7 @@ def rm(f): # Check absolute trimming bounds rm('test8_CpG.bedGraph') -check_call(MPath + ' extract --nOT 50,50,40,40 gcg100.fa gcg_aln.bam -q 2 -o test8', shell=True) +check_call(MPath + ' extract --nOT 50,50,40,40 cg100.fa cg_aln.bam -q 2 -o test8', shell=True) assert op.exists('test8_CpG.bedGraph') lines = sum(1 for _ in open('test8_CpG.bedGraph')) assert lines == 12 @@ -88,7 +89,7 @@ def rm(f): # Check variant filtering (there are 49 lines otherwise) rm('test9_CpG.bedGraph') -check_call(MPath + ' extract -p 1 -q 0 -o test9 --minOppositeDepth 3 --maxVariantFrac 0.25 gcg100.fa gcg_with_variants.bam', shell=True) +check_call(MPath + ' extract -p 1 -q 0 -o test9 --minOppositeDepth 3 --maxVariantFrac 0.25 cg100.fa cg_with_variants.bam', shell=True) assert op.exists('test9_CpG.bedGraph') lines = sum(1 for _ in open('test9_CpG.bedGraph')) assert lines == 48 From 630088dd0ac76022759b7fb79ad3d411895ba8ab Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:51:44 +0100 Subject: [PATCH 41/44] fix tests --- tests/test.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test.py b/tests/test.py index ab39059..3a0a35b 100644 --- a/tests/test.py +++ b/tests/test.py @@ -15,14 +15,14 @@ def rm(f): check_call([MPath, '--version']) rm('test1_CpG.bedGraph') -check_call(MPath + ' extract ct100.fa ct_aln.bam -q 2 -o test1', shell=True) +check_call([MPath, 'extract', 'ct100.fa', 'ct_aln.bam', '-q', '2', '-o', 'test1']) assert op.exists('test1_CpG.bedGraph') lines = sum(1 for _ in open('test1_CpG.bedGraph')) assert lines == 1 rm('test1_CpG.bedGraph') rm('test2_CpG.bedGraph') -check_call(MPath + ' extract cg100.fa cg_aln.bam -q 2 -o test2', shell=True) +check_call([MPath, 'extract', 'cg100.fa', 'cg_aln.bam', '-q', '2', '-o', 'test2']) assert op.exists('test2_CpG.bedGraph') for line in open('test2_CpG.bedGraph'): print(line) @@ -32,7 +32,7 @@ def rm(f): # should be none with q > 10 rm('test3_CpG.bedGraph') -check_call(MPath + ' extract cg100.fa cg_aln.bam -q 10 -o test3', shell=True) +check_call([MPath, 'extract', 'cg100.fa', 'cg_aln.bam', '-q', '10', '-o', 'test3']) assert op.exists('test3_CpG.bedGraph') lines = sum(1 for _ in open('test3_CpG.bedGraph')) assert lines == 1 @@ -42,7 +42,7 @@ def rm(f): rm('test4_CpG.methylKit') rm('test4_CHG.methylKit') rm('test4_CHH.methylKit') -check_call(MPath + ' extract --methylKit --CHH --CHG cg100.fa cg_aln.bam -q 2 -o test4', shell=True) +check_call([MPath, 'extract', '--methylKit', '--CHH', '--CHG', 'cg100.fa', 'cg_aln.bam', '-q', '2', '-o', 'test4']) assert op.exists('test4_CpG.methylKit') lines = sum(1 for _ in open('test4_CpG.methylKit')) assert lines > 1 @@ -57,7 +57,7 @@ def rm(f): # Check that --minDepth is working, which means there should be no called sites rm('test5_CpG.bedGraph') -check_call(MPath + ' extract --minDepth 2 cg100.fa cg_aln.bam -q 2 -o test5', shell=True) +check_call([MPath, 'extract', '--minDepth', '2', 'cg100.fa', 'cg_aln.bam', '-q', '2', '-o', 'test5']) assert op.exists('test5_CpG.bedGraph') lines = sum(1 for _ in open('test5_CpG.bedGraph')) assert lines == 1 @@ -65,7 +65,7 @@ def rm(f): # Check that --ignoreFlags is working, which means that there are now called sites rm('test6_CpG.bedGraph') -check_call(MPath + ' extract --ignoreFlags 0xD00 cg100.fa cg_aln.bam -q 2 -o test6', shell=True) +check_call([MPath, 'extract', '--ignoreFlags', '0xD00', 'cg100.fa', 'cg_aln.bam', '-q', '2', '-o', 'test6']) assert op.exists('test6_CpG.bedGraph') lines = sum(1 for _ in open('test6_CpG.bedGraph')) assert lines == 49 @@ -73,7 +73,7 @@ def rm(f): # Check that --requireFlags is working rm('test7_CpG.bedGraph') -check_call(MPath + ' extract --requireFlags 0xD00 cg100.fa cg_aln.bam -q 2 -o test7', shell=True) +check_call([MPath, 'extract', '--requireFlags', '0xD00', 'cg100.fa', 'cg_aln.bam', '-q', '2', '-o', 'test7']) assert op.exists('test7_CpG.bedGraph') lines = sum(1 for _ in open('test7_CpG.bedGraph')) assert lines == 49 @@ -81,7 +81,7 @@ def rm(f): # Check absolute trimming bounds rm('test8_CpG.bedGraph') -check_call(MPath + ' extract --nOT 50,50,40,40 cg100.fa cg_aln.bam -q 2 -o test8', shell=True) +check_call([MPath, 'extract', '--nOT', '50,50,40,40', 'cg100.fa', 'cg_aln.bam', '-q', '2', '-o', 'test8']) assert op.exists('test8_CpG.bedGraph') lines = sum(1 for _ in open('test8_CpG.bedGraph')) assert lines == 12 @@ -89,7 +89,7 @@ def rm(f): # Check variant filtering (there are 49 lines otherwise) rm('test9_CpG.bedGraph') -check_call(MPath + ' extract -p 1 -q 0 -o test9 --minOppositeDepth 3 --maxVariantFrac 0.25 cg100.fa cg_with_variants.bam', shell=True) +check_call([MPath, 'extract', '-p', '1', '-q', '0', '-o', 'test9', '--minOppositeDepth', '3', '--maxVariantFrac', '0.25', 'cg100.fa', 'cg_with_variants.bam']) assert op.exists('test9_CpG.bedGraph') lines = sum(1 for _ in open('test9_CpG.bedGraph')) assert lines == 48 From 749507ebb53528536dc50b82c27bb0df26e7cd0c Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 22:56:19 +0100 Subject: [PATCH 42/44] try this --- .azure-pipelines/test-template.yml | 4 +--- tests/test.py | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index c4ecaf8..48dd8f5 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -7,8 +7,6 @@ steps: - bash: | source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib - #export LC_RPATH=$LD_LIBRARY_PATH - install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel - ./MethylDackel --version + #install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel python tests/test.py displayName: Test methylDackel diff --git a/tests/test.py b/tests/test.py index 3a0a35b..042e922 100644 --- a/tests/test.py +++ b/tests/test.py @@ -94,3 +94,4 @@ def rm(f): lines = sum(1 for _ in open('test9_CpG.bedGraph')) assert lines == 48 rm('test9_CpG.bedGraph') +print("Finished correctly") From 840d5746ced55885fe2d4fbf35c2d0f0f8363035 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sat, 27 Feb 2021 23:49:35 +0100 Subject: [PATCH 43/44] Fix #99 --- .azure-pipelines/test-template.yml | 1 - Makefile | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/test-template.yml b/.azure-pipelines/test-template.yml index 48dd8f5..78a6dfc 100644 --- a/.azure-pipelines/test-template.yml +++ b/.azure-pipelines/test-template.yml @@ -7,6 +7,5 @@ steps: - bash: | source activate MethylDackel export LD_LIBRARY_PATH=$CONDA_PREFIX/lib - #install_name_tool -add_rpath @$CONDA_PREFIX/lib MethylDackel python tests/test.py displayName: Test methylDackel diff --git a/Makefile b/Makefile index 69cd46e..f126811 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,6 @@ CFLAGS ?= -Wall -g -O3 -pthread all: MethylDackel -#OBJS = common.o bed.o svg.o pileup.o extract.o MBias.o mergeContext.o perRead.o OBJS = common.o bed.o svg.o overlaps.o extract.o MBias.o mergeContext.o perRead.o VERSION = 0.5.2 @@ -18,7 +17,7 @@ version.h: echo '#define VERSION "$(VERSION)"' > $@ .c.o: - $(CC) -c $(CFLAGS) -g $(LIBS) -IlibBigWig $< -o $@ + $(CC) -c $(CFLAGS) $(LIBS) -IlibBigWig $< -o $@ libMethylDackel.a: version.h $(OBJS) -@rm -f $@ @@ -29,7 +28,7 @@ lib: libMethylDackel.a MethylDackel: libMethylDackel.a version.h $(OBJS) $(CC) $(CFLAGS) $(LIBS) -o MethylDackel $(OBJS) main.c libMethylDackel.a $(LIBBIGWIG) -lm -lz -lpthread -lhts -lcurl -test: +test: MethylDackel python tests/test.py clean: From 49e0d129534391b4bc1e1b6aaefddab6abed0a5d Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sun, 28 Feb 2021 09:27:56 +0100 Subject: [PATCH 44/44] One last minor issue --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index 3aecc1d..8583478 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,6 @@ #include #include +#include #include "htslib/hts.h" #include "version.h" //This has the VERSION define