diff --git a/rpg/RapidPeptidesGenerator.py b/rpg/RapidPeptidesGenerator.py index 03de3f6d163c77be281f1b16db696ad4e18f7fd6..9657c6765fe0d9b51664cbb373076cee49526c96 100644 --- a/rpg/RapidPeptidesGenerator.py +++ b/rpg/RapidPeptidesGenerator.py @@ -31,6 +31,7 @@ necessary functions #DOC : last peptide, cut at pos -1 because no cut # add with same name !! +# miscleavage et pas miscleavage #Started on 22 avr. 2016 #Digest sequences given restriction enzymes @@ -50,6 +51,7 @@ import os import sys import uuid from pathlib import Path +from context import rpg from rpg import core from rpg import digest from rpg import enzyme @@ -61,7 +63,7 @@ ALL_ENZYMES = AVAILABLE_ENZYMES + AVAILABLE_ENZYMES_USER """All available enzymes in RPG.""" def restricted_float(mc_val): - """Restricts input miss-cleavage value to a float between 0 and 100. + """Restricts input miscleavage value to a float between 0 and 100. :param mc_val: value to test :type mc_val: float @@ -75,12 +77,12 @@ def restricted_float(mc_val): try: mc_val = float(mc_val) if mc_val < 0 or mc_val > 100: - core.handle_errors("miss-cleavage value should be between 0 and "\ + core.handle_errors("miscleavage value should be between 0 and "\ "100.", 0, "Value ") return mc_val except ValueError: # Throw an error - core.handle_errors("miss-cleavage value should be a float between 0 "\ + core.handle_errors("miscleavage value should be a float between 0 "\ "and 100.", 0, "Type ") def restricted_enzyme_id(enz_id): @@ -116,23 +118,23 @@ def list_enzyme(): def create_enzymes_to_use(enzymes, miss_cleavage): """Create the list of chosen :py:class:`~rpg.enzyme.Enzyme` to use. - Each enzyme can be associated to a miss-cleavage value. + Each enzyme can be associated to a miscleavage value. :param enzymes: enzymes ids chosen by user - :param miss_cleavage: associated miss-cleavage values + :param miss_cleavage: associated miscleavage values :type enzymes: list(int) :type miss_cleavage: list(float) - :return: list of enzyme's id with associated miss-cleavage values + :return: list of enzyme's id with associated miscleavage values :rtype: list(int) """ # Complete Enzymes to use (return) enzymes_to_use = [] if enzymes: - # Too much miss-cleavage values + # Too much miscleavage values if len(miss_cleavage) > len(enzymes): - core.handle_errors("Too much miss-cleavage values. Last values" + core.handle_errors("Too much miscleavage values. Last values" " will be ignored.") # Get only the first ones miss_cleavage = miss_cleavage[:len(enzymes)] @@ -161,17 +163,17 @@ def create_enzymes_to_use(enzymes, miss_cleavage): # Not tested def get_enzymes_to_use(mode, id_enz_selected, miss_cleavage): """Get the list of chosen :py:class:`~rpg.enzyme.Enzyme` to use. - Each enzyme (and associated miss-cleavage value) are inputed by + Each enzyme (and associated miscleavage value) are inputed by user. If there is a problem, user is interrogated again. - :param mode: Digestion mode. If 'concurrent', no miss-cleavage values are used + :param mode: Digestion mode. If 'concurrent', no miscleavage values are used :param enzymes: enzyme's ids chosen by user - :param miss_cleavage: associated miss-cleavage values + :param miss_cleavage: associated miscleavage values :type mode: str :type enzymes: list(int) :type miss_cleavage: list(float) - :return: list of enzyme's id with associated miss-cleavage values + :return: list of enzyme's id with associated miscleavage values :rtype: list(int) .. warning:: Not tested @@ -204,7 +206,7 @@ def get_enzymes_to_use(mode, id_enz_selected, miss_cleavage): " values will be ignored." % i) mc_enz_inputed = [] if mode == "sequential": - mc_enz_inp = input("Percentage of miss-cleavage per inputed" + mc_enz_inp = input("Percentage of miscleavage per inputed" " enzyme (default 0), separated by comma" " (example: 1,5,6):\n") if mc_enz_inp: @@ -236,7 +238,7 @@ def main(): "n). All sequences will be cl" "eaved according to selected " "enzymes (-e option) and give" - "n miss-cleavage percentage (" + "n miscleavage percentage (" "-m option). Cleaving can be " "sequential or concurrent (-d" " option). Resulting peptides" @@ -250,7 +252,7 @@ def main(): "tion).") group_launch = parser.add_mutually_exclusive_group(required=True) group_launch.add_argument("-a", "--addenzyme", action="store_true", - help="Add a new cleaving enzyme. See the manual" + help="Create a new enzyme. See the manual" " for more information") parser.add_argument("-d", "--digest", metavar="", choices=['s', 'sequential', 'c', 'concurrent'], @@ -272,7 +274,7 @@ def main(): help="Display the list of available enzymes") parser.add_argument("-m", "--misscleavage", metavar="", default=[], action='append', type=restricted_float, - help="Percentage of miss-cleavage, between 0 and 100," + help="Percentage of miscleavage, between 0 and 100," " by enzyme(s). It should be in the same order than " "-enzymes options (i.e. -m 15 -m 5 -m 10). Only for " "sequential digestion (default: 0)") @@ -292,7 +294,8 @@ def main(): group_verbose.add_argument("-q", "--quiet", action="store_true", help="No standard output, only error(s)") group_verbose.add_argument("-v", "--verbose", action="count", default=0, - help="Increase output verbosity") + help="Increase output verbosity. -vv will " + "increase more than -v") parser.add_argument("--version", action="version", version="%(prog)s " + __version__ + " from " + __revision_date__) @@ -307,7 +310,7 @@ def main(): mode = "sequential" if args.digest == "c" or args.digest == "concurrent": mode = "concurrent" - args.misscleavage = [] # No miss-cleavage on concurrent, infinite time + args.misscleavage = [] # No miscleavage on concurrent, infinite time # --list option if args.list: @@ -357,7 +360,7 @@ def main(): # More miss cleavage than enzyme if len(args.misscleavage) > len(args.enzymes): - core.handle_errors("Too much miss-cleavage values. Last values will " + core.handle_errors("Too much miscleavage values. Last values will " "be ignored.") args.misscleavage = args.misscleavage[:len(args.enzymes)] @@ -369,7 +372,7 @@ def main(): print("Input: " + args.inputdata) print("Enzyme(s) used: " + str([enz.name for enz in enzymes_to_use])) print("Mode: " + mode) - print("Miss-cleavage ratio: " + + print("miscleavage ratio: " + str([enz.ratio_miss_cleavage for enz in enzymes_to_use])) print("Output file: " + os.path.abspath(output_file))