Ejemplo n.º 1
0
        public void Do(RequestInterface request)
        {
            foreach (var pdb in request.PDBs)
            {
                var Iface = new Dictionary <Residue, bool>();
                pdb.Residues.Each(r => Iface.Add(r, false));
                var filename = Location + pdb.Name + "_" + request.Distance + "_" + request.UseVanDerWaalsRadii + "." + FileEnding;
                if (Directory.GetFiles(Location).Contains(filename))
                {
                    using (var reader = new StreamReader(filename))
                    {
                        string line = "";
                        while ((line = reader.ReadLine()) != null)
                        {
                            var residue = pdb.Residues.First(res => (res.Chain + "_" + res.Id).Equals(line));
                            Iface[residue] = true;
                        }
                    }
                }
                else
                {
                    var comprequest = new ComputeInterface(pdb, request.Distance, request.UseVanDerWaalsRadii);
                    comprequest.RequestInDefaultContext();
                    var result = comprequest.Result;

                    using (var writer = new StreamWriter(Location + pdb.Name + "_" + request.Distance + "_" + request.UseVanDerWaalsRadii + "." + FileEnding))
                    {
                        foreach (var entry in result)
                        {
                            foreach (var residue in entry.Value)
                            {
                                writer.WriteLine(residue.Chain + "_" + residue.Id);
                                Iface[residue] = true;
                            }
                        }
                    }
                }
                request.Interface.Add(pdb.Name, Iface);
            }
        }
Ejemplo n.º 2
0
 private void OnRequest(ComputeInterface obj)
 {
     obj.Result = ComputeInterfaceatomDistance.Do(obj.PDB, obj.Distance, obj.UseVanDerWaalsRadii);
 }