internal static ReturnCodes LoadSequencesFromFiles(ref Alignment alignmentObject, bool append, string[] fileNames, out List <Tuple <string, int, ReturnCodes> > fileErrors)
        // This method provides the main interface for loading sequences. It takes an array of file names and calls LoadSequencesFromFile.
        // It then checks the return codes and the number of sequences loaded, then clears the alignment if not appending, then adds the
        // new sequences to the alignment. In addition to the main return code, it returns as an output parameter a list containing the error codes.
        {
            ReturnCodes returnCode = ReturnCodes.OK;

            fileErrors = new List <Tuple <string, int, ReturnCodes> >();
            //List<Tuple<Macromolecule, int[]>> loadedAlignedMacromolecules = new List<Tuple<Macromolecule, int[]>>();
            List <AlignedMacromolecule> loadedAlignedMacromolecules = new List <AlignedMacromolecule>();

            foreach (string fileName in fileNames)
            {
                //List<Tuple<Macromolecule, int[]>> fileAlignedMacromolecules;
                List <AlignedMacromolecule> fileAlignedMacromolecules;
                ReturnCodes fileReturnCode = ReturnCodes.OK;
                fileReturnCode = LoadSequencesFromFile(fileName, out fileAlignedMacromolecules);

                if (fileReturnCode != ReturnCodes.OK)
                {
                    // Add any errors to the array
                    fileErrors.Add(Tuple.Create(fileName, fileAlignedMacromolecules.Count, fileReturnCode));
                    returnCode = ReturnCodes.FileErrors;
                }

                if (fileReturnCode == ReturnCodes.OK || fileReturnCode == ReturnCodes.EmptySequencesRemoved)
                {
                    // These codes mean it is okay to add their macromolecules to the main list.
                    //foreach (Tuple<Macromolecule, int[]> alignedMacromolecule in fileAlignedMacromolecules)
                    foreach (AlignedMacromolecule alignedMacromolecule in fileAlignedMacromolecules)
                    {
                        loadedAlignedMacromolecules.Add(alignedMacromolecule);
                    }
                }
            }

            // Ensure that some sequences were loaded.
            if (loadedAlignedMacromolecules.Count > 0)
            {
                // Check that all are the same type, force the minority to conform to the majority, and append to the error list.
                int         numChanged;
                ReturnCodes typeReturnCode = EnsureAllSameType(loadedAlignedMacromolecules, out numChanged);
                if (typeReturnCode != ReturnCodes.OK) //
                {
                    fileErrors.Add(Tuple.Create("DNA to Protein", numChanged, typeReturnCode));
                    returnCode = ReturnCodes.FileErrors;
                }

                if (!append)
                {
                    alignmentObject.Clear();
                }

                // It's now okay to add macromolecules to the alignment object
                alignmentObject.AddAlignedMacromolecules(loadedAlignedMacromolecules);
            }

            return(returnCode);
        }