public static void SelectCommonAtoms <Atom>(ref List <Atom> atoms1, ref List <Atom> atoms2) where Atom : IAtom { List <Atom> _atoms1 = new List <Atom>(atoms1); List <Atom> _atoms2 = new List <Atom>(atoms2); _atoms1 = _atoms1.ListCommon(_atoms2); HPack <List <int> > idxAtom2ToAtom1 = new HPack <List <int> >(); //{ // List<Atom> cas1 = _atoms1.SelectByName("CA"); // List<Atom> cas2 = _atoms2.SelectByName("CA"); // List<int> idx1 = new List<int>(); // List<int> idx2 = new List<int>(); // LCS.LongestCommonSubsequence( cas1 , cas2 , idx1, idx2, Atom.CompareNameResName); // cas1 = cas1.SelectByIndex(idx1); // cas2 = cas2.SelectByIndex(idx2); //} _atoms2 = _atoms2.ListCommon(_atoms1, idxAtom2ToAtom1); _atoms1 = _atoms1.HSelectByIndex(idxAtom2ToAtom1.value).ToList(); if (HDebug.IsDebuggerAttached) { HDebug.AssertAllEquals(_atoms1.Count, _atoms2.Count); for (int i = 0; i < _atoms1.Count; i++) { HDebug.AssertAllEquals(_atoms1[i].name.Trim(), _atoms2[i].name.Trim()); HDebug.AssertAllEquals(_atoms1[i].resName.Trim(), _atoms1[i].resName.Trim()); HDebug.AssertAllEquals(_atoms1[i].resSeq, _atoms1[i].resSeq); } } atoms1 = _atoms1; atoms2 = _atoms2; }
public static void SelectCommonAtoms <Atom>(ref List <Atom> atoms1, ref List <Atom> atoms2, ref List <Atom> atoms3, ref List <Atom> atoms4, ref List <Atom> atoms5) where Atom : IAtom { List <Atom> _atoms1 = new List <Atom>(atoms1); List <Atom> _atoms2 = new List <Atom>(atoms2); List <Atom> _atoms3 = new List <Atom>(atoms3); List <Atom> _atoms4 = new List <Atom>(atoms4); List <Atom> _atoms5 = new List <Atom>(atoms5); _atoms1 = _atoms1.ListCommon(_atoms2); _atoms1 = _atoms1.ListCommon(_atoms3); _atoms1 = _atoms1.ListCommon(_atoms4); _atoms1 = _atoms1.ListCommon(_atoms5); HPack <List <int> > idxAtom2ToAtom1 = new HPack <List <int> >(); _atoms2 = _atoms2.ListCommon(_atoms1, idxAtom2ToAtom1); _atoms2 = _atoms2.HSelectByIndex(idxAtom2ToAtom1.value).ToList(); HPack <List <int> > idxAtom3ToAtom1 = new HPack <List <int> >(); _atoms3 = _atoms3.ListCommon(_atoms1, idxAtom3ToAtom1); _atoms3 = _atoms3.HSelectByIndex(idxAtom3ToAtom1.value).ToList(); HPack <List <int> > idxAtom4ToAtom1 = new HPack <List <int> >(); _atoms4 = _atoms4.ListCommon(_atoms1, idxAtom4ToAtom1); _atoms4 = _atoms4.HSelectByIndex(idxAtom4ToAtom1.value).ToList(); HPack <List <int> > idxAtom5ToAtom1 = new HPack <List <int> >(); _atoms5 = _atoms5.ListCommon(_atoms1, idxAtom5ToAtom1); _atoms5 = _atoms5.HSelectByIndex(idxAtom5ToAtom1.value).ToList(); if (HDebug.IsDebuggerAttached) { HDebug.AssertAllEquals(_atoms1.Count, _atoms2.Count, _atoms3.Count, _atoms4.Count, _atoms5.Count); for (int i = 0; i < _atoms1.Count; i++) { HDebug.AssertAllEquals(_atoms1[i].name, _atoms2[i].name, _atoms3[i].name, _atoms4[i].name, _atoms5[i].name); HDebug.AssertAllEquals(_atoms1[i].resName, _atoms1[i].resName, _atoms3[i].resName, _atoms4[i].resName, _atoms5[i].resName); HDebug.AssertAllEquals(_atoms1[i].resSeq, _atoms1[i].resSeq, _atoms3[i].resSeq, _atoms4[i].resSeq, _atoms5[i].resSeq); } } atoms1 = _atoms1; atoms2 = _atoms2; atoms3 = _atoms3; atoms4 = _atoms4; atoms5 = _atoms5; }