Compare commits

..

10 Commits

Author SHA1 Message Date
Celine Mercier
3db93ee9c4 Fixed stdout output 2024-01-12 16:13:30 +13:00
Celine Mercier
4844b20770 Merge branch 'master' of https://git.metabarcoding.org/obitools/obitools3 2024-01-12 15:36:58 +13:00
Celine Mercier
0d98a4f717 Switch to version 3.0.1b26 2024-01-10 16:40:08 +13:00
Celine Mercier
837ff1a1ba Taxonomy: fixed an issue related to StopIteration behaviour in new
versions of python
2024-01-10 15:53:15 +13:00
Celine Mercier
aeed42456a export: columns are now in alphabetical order when exporting to tab
format
2024-01-10 15:52:28 +13:00
Celine Mercier
fb6e27bb5d Revert "Testing RAM instead of mmap for blob alignment"
This reverts commit 6d94cdcc0d
2023-11-29 04:22:31 +01:00
Celine Mercier
6d94cdcc0d Testing RAM instead of mmap for blob alignment 2023-11-29 16:19:34 +13:00
Celine Mercier
8a1f844645 obi import: fixed bug caused by new behaviour of StopIteration
exceptions in Python>=3.7
2023-09-21 17:47:40 +12:00
Celine Mercier
791ccfb92e Fixed include bug in previous version and switch to version 3.0.1b24 2023-05-15 11:35:42 +12:00
Celine Mercier
1c9a906f5b ngsfilter and ecopcr: now check for primers too long for apat library to
handle (31bp max) and switch to version 3.0.1b23
2023-05-12 17:04:21 +12:00
8 changed files with 47 additions and 19 deletions

View File

@@ -24,6 +24,9 @@ from cpython.exc cimport PyErr_CheckSignals
from io import BufferedWriter
MAX_PAT_LEN = 31
__title__="Assign sequence records to the corresponding experiment/sample based on DNA tags and primers"
@@ -84,6 +87,8 @@ class Primer:
@type direct:
'''
assert len(sequence) <= MAX_PAT_LEN, "Primer %s is too long, 31 bp max" % sequence
assert sequence not in Primer.collection \
or Primer.collection[sequence]==taglength, \
"Primer %s must always be used with tags of the same length" % sequence
@@ -271,7 +276,7 @@ cdef tuple annotate(sequences, infos, no_tags, verbose=False):
if not_aligned:
sequences[1] = sequences[1].clone()
sequences[0][REVERSE_SEQUENCE_COLUMN] = sequences[1].seq # used by alignpairedend tool
sequences[0][REVERSE_SEQUENCE_COLUMN] = sequences[1].seq # used by alignpairedend tool
sequences[0][REVERSE_QUALITY_COLUMN] = sequences[1].quality # used by alignpairedend tool
for seq in sequences:

View File

@@ -325,8 +325,9 @@ cdef class Taxonomy(OBIWrapper) :
cdef Taxon taxon
try:
taxon = self.get_taxon_by_taxid(taxid)
except:
raise StopIteration
except Exception as e:
print('\n'+e, file=sys.stderr)
return
if taxon is not None:
while taxon.taxid != 1:
yield taxon
@@ -334,7 +335,7 @@ cdef class Taxonomy(OBIWrapper) :
taxon = taxon.parent
yield taxon
else:
raise StopIteration
return
def is_ancestor(self, int ancestor_taxid, int taxid):

View File

@@ -23,15 +23,16 @@ cdef class TabFormat:
@cython.boundscheck(False)
def __call__(self, object data):
cdef set ktags
cdef object ktags
cdef list tags = [key for key in data]
line = []
if self.tags is not None and self.tags:
ktags = self.tags
if self.tags != None and self.tags:
ktags = list(self.tags)
else:
ktags = set(tags)
ktags = list(set(tags))
ktags.sort()
if self.header and self.first_line:
for k in ktags:

View File

@@ -103,7 +103,11 @@ def fastqWithQualityIterator(lineiterator,
yield seq
read+=1
hline = next(i)
try:
hline = next(i)
except StopIteration:
return
def fastqWithoutQualityIterator(lineiterator,
@@ -174,5 +178,7 @@ def fastqWithoutQualityIterator(lineiterator,
yield seq
read+=1
hline = next(i)
try:
hline = next(i)
except StopIteration:
return

View File

@@ -99,7 +99,10 @@ def tabIterator(lineiterator,
read+=1
line = next(iterator)
try:
line = next(iterator)
except StopIteration:
return

View File

@@ -280,7 +280,7 @@ def open_uri(uri,
iseq = urib
objclass = bytes
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']:
raise Exception("Prefix needed when exporting for metabaR (--metabaR-prefix option)")
else:

View File

@@ -1,5 +1,5 @@
major = 3
minor = 0
serial= '1b22'
serial= '1b26'
version ="%d.%d.%s" % (major,minor,serial)

View File

@@ -365,8 +365,6 @@ static int print_seq(Obiview_p i_view, Obiview_p o_view,
int32_t i;
// TODO add check for primer longer than MAX_PAT_LEN (32)
// Get sequence id
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);
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
i_dms = obi_open_dms(i_dms_name, false);
if (i_dms == NULL)