Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
3db93ee9c4 | |||
4844b20770 | |||
0d98a4f717 | |||
837ff1a1ba | |||
aeed42456a | |||
fb6e27bb5d | |||
6d94cdcc0d | |||
8a1f844645 | |||
791ccfb92e | |||
1c9a906f5b |
@ -24,6 +24,9 @@ from cpython.exc cimport PyErr_CheckSignals
|
|||||||
from io import BufferedWriter
|
from io import BufferedWriter
|
||||||
|
|
||||||
|
|
||||||
|
MAX_PAT_LEN = 31
|
||||||
|
|
||||||
|
|
||||||
__title__="Assign sequence records to the corresponding experiment/sample based on DNA tags and primers"
|
__title__="Assign sequence records to the corresponding experiment/sample based on DNA tags and primers"
|
||||||
|
|
||||||
|
|
||||||
@ -84,6 +87,8 @@ class Primer:
|
|||||||
@type direct:
|
@type direct:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
assert len(sequence) <= MAX_PAT_LEN, "Primer %s is too long, 31 bp max" % sequence
|
||||||
|
|
||||||
assert sequence not in Primer.collection \
|
assert sequence not in Primer.collection \
|
||||||
or Primer.collection[sequence]==taglength, \
|
or Primer.collection[sequence]==taglength, \
|
||||||
"Primer %s must always be used with tags of the same length" % sequence
|
"Primer %s must always be used with tags of the same length" % sequence
|
||||||
|
@ -325,8 +325,9 @@ cdef class Taxonomy(OBIWrapper) :
|
|||||||
cdef Taxon taxon
|
cdef Taxon taxon
|
||||||
try:
|
try:
|
||||||
taxon = self.get_taxon_by_taxid(taxid)
|
taxon = self.get_taxon_by_taxid(taxid)
|
||||||
except:
|
except Exception as e:
|
||||||
raise StopIteration
|
print('\n'+e, file=sys.stderr)
|
||||||
|
return
|
||||||
if taxon is not None:
|
if taxon is not None:
|
||||||
while taxon.taxid != 1:
|
while taxon.taxid != 1:
|
||||||
yield taxon
|
yield taxon
|
||||||
@ -334,7 +335,7 @@ cdef class Taxonomy(OBIWrapper) :
|
|||||||
taxon = taxon.parent
|
taxon = taxon.parent
|
||||||
yield taxon
|
yield taxon
|
||||||
else:
|
else:
|
||||||
raise StopIteration
|
return
|
||||||
|
|
||||||
|
|
||||||
def is_ancestor(self, int ancestor_taxid, int taxid):
|
def is_ancestor(self, int ancestor_taxid, int taxid):
|
||||||
|
@ -23,15 +23,16 @@ cdef class TabFormat:
|
|||||||
@cython.boundscheck(False)
|
@cython.boundscheck(False)
|
||||||
def __call__(self, object data):
|
def __call__(self, object data):
|
||||||
|
|
||||||
cdef set ktags
|
cdef object ktags
|
||||||
cdef list tags = [key for key in data]
|
cdef list tags = [key for key in data]
|
||||||
|
|
||||||
line = []
|
line = []
|
||||||
|
if self.tags != None and self.tags:
|
||||||
if self.tags is not None and self.tags:
|
ktags = list(self.tags)
|
||||||
ktags = self.tags
|
|
||||||
else:
|
else:
|
||||||
ktags = set(tags)
|
ktags = list(set(tags))
|
||||||
|
|
||||||
|
ktags.sort()
|
||||||
|
|
||||||
if self.header and self.first_line:
|
if self.header and self.first_line:
|
||||||
for k in ktags:
|
for k in ktags:
|
||||||
|
@ -103,7 +103,11 @@ def fastqWithQualityIterator(lineiterator,
|
|||||||
yield seq
|
yield seq
|
||||||
|
|
||||||
read+=1
|
read+=1
|
||||||
|
try:
|
||||||
hline = next(i)
|
hline = next(i)
|
||||||
|
except StopIteration:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def fastqWithoutQualityIterator(lineiterator,
|
def fastqWithoutQualityIterator(lineiterator,
|
||||||
@ -174,5 +178,7 @@ def fastqWithoutQualityIterator(lineiterator,
|
|||||||
yield seq
|
yield seq
|
||||||
|
|
||||||
read+=1
|
read+=1
|
||||||
|
try:
|
||||||
hline = next(i)
|
hline = next(i)
|
||||||
|
except StopIteration:
|
||||||
|
return
|
||||||
|
@ -99,7 +99,10 @@ def tabIterator(lineiterator,
|
|||||||
|
|
||||||
read+=1
|
read+=1
|
||||||
|
|
||||||
|
try:
|
||||||
line = next(iterator)
|
line = next(iterator)
|
||||||
|
except StopIteration:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -280,7 +280,7 @@ def open_uri(uri,
|
|||||||
iseq = urib
|
iseq = urib
|
||||||
objclass = bytes
|
objclass = bytes
|
||||||
else: # TODO update uopen to be able to write?
|
else: # TODO update uopen to be able to write?
|
||||||
if config['obi']['outputformat'] == b'metabaR':
|
if 'outputformat' in config['obi'] and config['obi']['outputformat'] == b'metabaR':
|
||||||
if 'metabarprefix' not in config['obi']:
|
if 'metabarprefix' not in config['obi']:
|
||||||
raise Exception("Prefix needed when exporting for metabaR (--metabaR-prefix option)")
|
raise Exception("Prefix needed when exporting for metabaR (--metabaR-prefix option)")
|
||||||
else:
|
else:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
major = 3
|
major = 3
|
||||||
minor = 0
|
minor = 0
|
||||||
serial= '1b22'
|
serial= '1b26'
|
||||||
|
|
||||||
version ="%d.%d.%s" % (major,minor,serial)
|
version ="%d.%d.%s" % (major,minor,serial)
|
||||||
|
@ -365,8 +365,6 @@ static int print_seq(Obiview_p i_view, Obiview_p o_view,
|
|||||||
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
// TODO add check for primer longer than MAX_PAT_LEN (32)
|
|
||||||
|
|
||||||
// Get sequence id
|
// Get sequence id
|
||||||
seq_id = obi_get_str_with_elt_idx_and_col_p_in_view(i_view, i_id_column, i_idx, 0);
|
seq_id = obi_get_str_with_elt_idx_and_col_p_in_view(i_view, i_id_column, i_idx, 0);
|
||||||
|
|
||||||
@ -751,6 +749,20 @@ int obi_ecopcr(const char* i_dms_name,
|
|||||||
o1c = complementPattern(o1);
|
o1c = complementPattern(o1);
|
||||||
o2c = complementPattern(o2);
|
o2c = complementPattern(o2);
|
||||||
|
|
||||||
|
// check for primers equal or longer than MAX_PAT_LEN (32)
|
||||||
|
if (strlen(primer1) >= MAX_PAT_LEN)
|
||||||
|
{
|
||||||
|
obi_set_errno(OBI_ECOPCR_ERROR);
|
||||||
|
obidebug(1, "\nError: first primer is too long, needs to be < 32bp (%s)", primer1);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (strlen(primer2) >= MAX_PAT_LEN)
|
||||||
|
{
|
||||||
|
obi_set_errno(OBI_ECOPCR_ERROR);
|
||||||
|
obidebug(1, "\nError: second primer is too long, needs to be < 32bp (%s)", primer2);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Open input DMS
|
// Open input DMS
|
||||||
i_dms = obi_open_dms(i_dms_name, false);
|
i_dms = obi_open_dms(i_dms_name, false);
|
||||||
if (i_dms == NULL)
|
if (i_dms == NULL)
|
||||||
|
Reference in New Issue
Block a user