Skip to content

Commit d5f5b9a

Browse files
Conflicts: reveallib/reveal.c
2 parents 8beaf90 + 6a0d70d commit d5f5b9a

File tree

4 files changed

+41
-12
lines changed

4 files changed

+41
-12
lines changed

reveal/rem.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,24 @@ def graphalign(index,mum):
323323
isize=index.n
324324
mns=[]
325325
topop=[]
326-
logging.debug("Nodes in subgraph:")
327-
for node in nodes:
328-
logging.debug("%s"%str(node))
326+
#logging.debug("Nodes in subgraph:")
327+
#for node in nodes:
328+
# logging.debug("%s"%str(node))
329329

330330
sp=[sp for gid,sp in spd]
331331
matching=set()
332332
for pos in sp:
333333
matching.add((pos,pos+l))
334-
# logging.debug("Lookup node for sp=%d"%pos)
334+
logging.debug("Lookup node for sp=%d"%pos)
335335
old=t[pos].pop()
336+
logging.debug("Node=%s"%str(old))
337+
338+
if old.end-pos<l:
339+
import pickle
340+
open("T.txt",'w').write(index.T)
341+
pickle.dump(index.LCP,open("LCP.pickle",'w'))
342+
pickle.dump(t,open("tree.pickle",'w'))
343+
336344
assert(old.end-old.begin>=l)
337345
mn,other=breaknode(old,pos,l)
338346
mns.append(mn)
@@ -566,7 +574,6 @@ def align_genomes(args):
566574

567575
logging.info("Constructing index...")
568576
idx.construct()
569-
570577
logging.info("Done.")
571578

572579
if len(args.inputfiles)==2 and not graph:

reveal/schemes.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,20 @@ def lookup(mum):
137137
qrpoint=dict()
138138
for pos in sp:
139139
t=ts[pos]
140+
if len(t)!=1:
141+
import pickle
142+
logging.debug("Dumping tree to file...")
143+
pickle.dump(ts, open('tree.pickle','w'))
144+
logging.debug("mum: %s"%str(mum))
145+
print(type(pos))
146+
print(ts[pos+1])
147+
print(ts[pos-1])
148+
logging.debug("l: %s"%str(l))
149+
logging.debug("pos: %s"%str(pos))
150+
logging.debug("sp: %s"%str(sp))
151+
logging.debug("t: %s"%str(t))
152+
#logging.debug("ts: %s"%str(ts))
153+
140154
assert(len(t)==1)
141155
node=iter(t).next()
142156
ndata=G.node[node]
@@ -230,7 +244,7 @@ def graphmumpicker(mums,idx,precomputed=False,minlength=0):
230244
logging.debug("No MUMS that span all input genomes, segment genomes.")
231245
mmums=segment(mums)
232246
logging.debug("Segmented genomes/graphs into %s, now %d MUMS for chaining."%(mmums[0][2],len(mmums)))
233-
247+
234248
if args.trim:
235249
logging.debug("Trimming overlap between mums.")
236250
mmums=trim_overlap(mmums)

reveallib/interface.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,18 @@ static PyObject *construct(RevealIndex *self, PyObject *args, PyObject *keywds)
269269
return NULL;
270270
};
271271
}
272-
273-
//TODO: sanity check!
274-
272+
273+
#ifdef REVEALDEBUG
274+
// int j=0;
275+
// for (i=1; i<self->n; i++){
276+
// for (j=0; i<self->LCP[i]; j++){
277+
// assert(self->T[self->SA[i]+j]!='$'); //Make sure lcp intervals dont span sentinels
278+
// assert(self->T[self->SA[i-1]+j]!='$');
279+
// }
280+
// }
281+
//
282+
// //TODO: sanity check!
283+
#endif
275284
//if caching is specified write sa and lcp to disk
276285
if (self->cache==1){
277286
fprintf(stderr,"Writing LCP and SA to disk...");

reveallib/reveal.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ PyObject * getmultimems(RevealIndex *index, PyObject *args, PyObject *keywds) {
309309
int maxdepth=1000;
310310
int *flag_so=calloc(mainidx->nsamples,sizeof *flag_so);
311311
lcp_t *stack_lcp=malloc(maxdepth * sizeof *stack_lcp);
312-
lcp_t *stack_lb=malloc(maxdepth * sizeof *stack_lb);
313-
lcp_t *stack_ub=malloc(maxdepth * sizeof *stack_ub);
312+
saidx_t *stack_lb=malloc(maxdepth * sizeof *stack_lb);
313+
saidx_t *stack_ub=malloc(maxdepth * sizeof *stack_ub);
314314
lcp_t i_lcp;
315315
int depth=0;
316316
saidx_t i,lb,i_lb,i_ub;
@@ -456,7 +456,6 @@ PyObject * getmultimums(RevealIndex *index, PyObject *args, PyObject *keywds) {
456456
lcp_t *stack_lcp=malloc(maxdepth * sizeof *stack_lcp);
457457
saidx_t *stack_lb=malloc(maxdepth * sizeof *stack_lb);
458458
saidx_t *stack_ub=malloc(maxdepth * sizeof *stack_ub);
459-
460459
lcp_t i_lcp;
461460
int depth=0;
462461
saidx_t i,lb,i_lb,i_ub;

0 commit comments

Comments
 (0)