Commit 50e61b2a by Frédéric Boyer

BUG count obiuniq with merged

parent 23d7c218
...@@ -58,6 +58,7 @@ def uniqSequence(seqIterator,taxonomy=None,mergedKey=None,mergeIds=False,categor ...@@ -58,6 +58,7 @@ def uniqSequence(seqIterator,taxonomy=None,mergedKey=None,mergeIds=False,categor
s['count']+=seq['count'] s['count']+=seq['count']
else: else:
s['count']+=1 s['count']+=1
seq['count']=1
# if taxonomy is not None and 'taxid' in seq: # if taxonomy is not None and 'taxid' in seq:
# s['merged_taxid'][seq['taxid']]= # s['merged_taxid'][seq['taxid']]=
for key in mergedKey: for key in mergedKey:
...@@ -70,7 +71,7 @@ def uniqSequence(seqIterator,taxonomy=None,mergedKey=None,mergeIds=False,categor ...@@ -70,7 +71,7 @@ def uniqSequence(seqIterator,taxonomy=None,mergedKey=None,mergeIds=False,categor
mkey = "merged_%s" % key mkey = "merged_%s" % key
#cas ou on met a jour les merged_keys mais il n'y a pas de merged_keys dans la sequence qui arrive #cas ou on met a jour les merged_keys mais il n'y a pas de merged_keys dans la sequence qui arrive
if key in seq: if key in seq:
s[mkey][seq[key]]=s[mkey].get(seq[key],0)+1 s[mkey][seq[key]]=s[mkey].get(seq[key],0)+seq['count']
#cas ou merged_keys existe deja #cas ou merged_keys existe deja
else: else:
if mkey in seq: if mkey in seq:
...@@ -98,7 +99,7 @@ def uniqSequence(seqIterator,taxonomy=None,mergedKey=None,mergeIds=False,categor ...@@ -98,7 +99,7 @@ def uniqSequence(seqIterator,taxonomy=None,mergedKey=None,mergeIds=False,categor
if mkey not in seq: if mkey not in seq:
seq[mkey]={} seq[mkey]={}
if key in seq: if key in seq:
seq[mkey][seq[key]]=seq[mkey].get(seq[key],0)+1 seq[mkey][seq[key]]=seq[mkey].get(seq[key],0)+seq['count']
del(seq[key]) del(seq[key])
if 'count' not in seq: if 'count' not in seq:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment