diff --git a/python/obitools3/commands/ecopcr.pyx b/python/obitools3/commands/ecopcr.pyx index 8228a1c..240930e 100755 --- a/python/obitools3/commands/ecopcr.pyx +++ b/python/obitools3/commands/ecopcr.pyx @@ -35,13 +35,13 @@ def addOptions(parser): action="store", dest="ecopcr:primer1", metavar='', type=str, - help="Forward primer.") + help="Forward primer, length must be less than or equal to 32") group.add_argument('--primer2', '-R', action="store", dest="ecopcr:primer2", metavar='', type=str, - help="Reverse primer.") + help="Reverse primer, length must be less than or equal to 32") group.add_argument('--error', '-e', action="store", dest="ecopcr:error", @@ -203,6 +203,7 @@ def run(config): #print("\n\nOutput view:\n````````````", file=sys.stderr) #print(repr(o_dms[o_view_name]), file=sys.stderr) - o_dms.close() + i_dms.close(force=True) + o_dms.close(force=True) logger("info", "Done.") diff --git a/src/obi_ecopcr.c b/src/obi_ecopcr.c index 994e2f8..1ab7876 100755 --- a/src/obi_ecopcr.c +++ b/src/obi_ecopcr.c @@ -739,6 +739,14 @@ int obi_ecopcr(const char* i_dms_name, return -1; } + // Check primer length (apat lib limits to 32) + if ((strlen(primer1) > 32) || (strlen(primer2) > 32)) + { + obi_set_errno(OBI_ECOPCR_ERROR); + obidebug(1, "\nError: primer length can not be greater than 32 (primers %s, %s)", primer1, primer2); + return -1; + } + o1 = buildPattern(primer1, error_max); o2 = buildPattern(primer2, error_max); diff --git a/src/obi_ecopcr.h b/src/obi_ecopcr.h index 5ba4c6a..5fa6c7d 100755 --- a/src/obi_ecopcr.h +++ b/src/obi_ecopcr.h @@ -81,8 +81,8 @@ * @param o_dms_name The path to the output DMS. * @param o_view_name The name of the output view. * @param o_view_comments The comments to associate with the output view. - * @param primer1 The first primer. - * @param primer2 The second primer. + * @param primer1 The first primer, length must be less than or equal to 32 (because of apat lib limitation). + * @param primer2 The second primer, length must be less than or equal to 32 (because of apat lib limitation). * @param error_max The maximum number of errors allowed per primer for amplification. * @param min_len The minimum length of an amplicon. * @param max_len The maximum length of an amplicon.