/// <summary>
        /// clones simple properties and deeper trees
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public IqTarget DeepClone(IqTarget target)
        {
            var util = new IqTargetUtilities();

            //basic copy

            //TODO: the problem is here is we are creating an IqTargetBasic, which might not fit everyone's liking
            IqTarget copiedTarget = new IqTargetBasic();

            CopyTargetProperties(target, copiedTarget);

            //this returnes the copied tree
            var deepCopy = CloneIqTrees(target);

            //set root via private set
            copiedTarget.RootTarget = deepCopy.RootTarget;

            //set parent target
            copiedTarget.ParentTarget = deepCopy.ParentTarget;

            //set the child targets
            var childTargets = deepCopy.ChildTargets().ToList();

            if (deepCopy.HasChildren() && childTargets.Count > 0)
            {
                foreach (var subtarget in childTargets)
                {
                    copiedTarget.AddTarget(subtarget);
                }
            }

            return(copiedTarget);
        }
        public List <IqTarget> CreateTargets(IEnumerable <string> empiricalFormulaList, double minMZObs = 400, double maxMZObserved = 1500)
        {
            var targetIDCounter = 0;

            var targetList = new List <IqTarget>();


            foreach (var formula in empiricalFormulaList)
            {
                IqTarget parentTarget = new IqTargetBasic();


                parentTarget.EmpiricalFormula = formula;
                parentTarget.ID = targetIDCounter++;

                parentTarget.MonoMassTheor =
                    EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(parentTarget.EmpiricalFormula);

                parentTarget.ElutionTimeTheor = 0.5;
                parentTarget.ChargeState      = 0; //this is the neutral mass


                var childTargets = CreateChargeStateTargets(parentTarget, minMZObs, maxMZObserved);
                parentTarget.AddTargetRange(childTargets);


                targetList.Add(parentTarget);
            }

            return(targetList);
        }
        /// <summary>
        /// for cloning a IqTarget. Recursive
        /// </summary>
        /// <param name="target">Input the root target so all children will be cloned</param>
        /// <returns></returns>
        public IqTarget Clone(IqTarget target)
        {
            IqTarget tempTarget = new IqTargetBasic();

            CopyTargetProperties(target, tempTarget);

            //child targets
            var childTargets = target.ChildTargets().ToList();

            if (target.HasChildren() && childTargets.Count > 0)
            {
                foreach (var child in childTargets)
                {
                    var clone = Clone(child);
                    clone.ParentTarget = target;
                    tempTarget.AddTarget(clone);
                }
            }
            return(tempTarget);
        }