ecopcr: added warnings and check of primer length (related to #75)

This commit is contained in:
Celine Mercier
2020-04-05 18:40:56 +02:00
parent 0b98371688
commit b9f68c76c8
3 changed files with 14 additions and 5 deletions

View File

@ -35,13 +35,13 @@ def addOptions(parser):
action="store", dest="ecopcr:primer1",
metavar='<PRIMER>',
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='<PRIMER>',
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.")

View File

@ -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);

View File

@ -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.