public static Pdb FromPdbidChainAltlocResis(string pdbIdChain, bool removeSymbolAltloc) { /// "pdbid:chains:altlocs:residues" /// ex: "1A6G:A::1-151" string[] tokens = pdbIdChain.Split(':'); Pdb.Atom[] atoms; { string pdbid = tokens[0]; Pdb pdb = FromPdbid(pdbid); atoms = pdb.atoms; } if (tokens.Length >= 2) { char[] chains = tokens[1].ToCharArray(); atoms = atoms.SelectByChainID(chains).ToArray(); } if ((tokens.Length >= 3) && (tokens[2].Trim().Length >= 1)) { char[] altlocs = tokens[2].ToCharArray(); HDebug.Assert(altlocs.Length >= 1); HDebug.ToDo(); } else { atoms = atoms.SelectByAltLoc().ToArray(); } if ((tokens.Length >= 4) && (tokens[3].Trim().Length >= 1)) { /// "1,2,5,10,15-100,113,115-160" List <int> resis = new List <int>(); string resis0 = tokens[3].Trim(); string[] resis1 = resis0.Split(','); foreach (string resis2 in resis1) { string[] resis3 = resis2.Trim().Split('-').HTrim().HRemoveAll(""); int[] resis4 = resis3.HParseInt(); if (resis4.Length == 1) { int resi = resis4[0]; HDebug.Assert(resis.Contains(resi) == false); resis.Add(resi); continue; } HDebug.Assert(resis4.Length == 2); //if(resis4.Length == 2) { HDebug.Assert(resis4[0] <= resis4[1]); for (int resi = resis4[0]; resi <= resis4[1]; resi++) { HDebug.Assert(resis.Contains(resi) == false); resis.Add(resi); } continue; } } atoms = atoms.SelectByResSeq(resis.ToArray()).ToArray(); } if (removeSymbolAltloc) { atoms = atoms.CloneByRemoveSymbolAltLoc().ToArray(); } return(Pdb.FromAtoms(atoms)); }