Пример #1
0
        public static async Task AddIncludeAsync(this Taxon taxon, Taxon include)
        {
            Start();
            await Task.Run(() => taxon.AddInclude(include));

            Finish();
        }
Пример #2
0
        // 重建系统发生树。
        public void RebuildTo(PhylogeneticTree tree)
        {
            // 先按照层次升序排序,用于确保总是先创建父类群
            // 再按照索引升序排序,用于确保每个类群的次序与原先相同
            var evoAtoms = from atom in _Evo.Atoms
                           where atom is not null
                           orderby atom.Level ascending,
                atom.Index ascending
            select atom;

            // 重建单系群关系
            foreach (var evoAtom in evoAtoms)
            {
                evoAtom.ToTaxon().SetParent(_GetTaxonOfTree(tree, evoAtom.ParentsIndex));
            }

            // 重建并系群、复系群关系
            foreach (var refAtom in _Ref.Atoms)
            {
                Common.IdStringToIndexList(refAtom.ID, out List <int> indexList);

                Taxon taxon = _GetTaxonOfTree(tree, indexList);

                foreach (var exclude in refAtom.Excludes)
                {
                    Common.IdStringToIndexList(exclude, out List <int> refIndexList);

                    taxon.AddExclude(_GetTaxonOfTree(tree, refIndexList));
                }

                foreach (var include in refAtom.Includes)
                {
                    Common.IdStringToIndexList(include, out List <int> refIndexList);

                    taxon.AddInclude(_GetTaxonOfTree(tree, refIndexList));
                }
            }
        }