示例#1
0
        public List <Indigo> ListIndigo()
        {
            List <Indigo> lista = new List <Indigo>();
            Conexion      con   = new Conexion();
            SqlCommand    cmd   = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Indigo_List";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Indigo ind = new Indigo();
                    ind.Maquina  = reader["Maquina"].ToString();
                    ind.OT       = reader["OT"].ToString();
                    ind.NombreOT = reader["NombreOT"].ToString();
                    ind.Pliego   = reader["Pliego"].ToString();
                    ind.Papel    = reader["Papel"].ToString();
                    ind.Tiraje   = Convert.ToInt32(reader["Tiraje"].ToString());
                    ind.Color    = reader["Color"].ToString();
                    ind.Buenos   = Convert.ToInt32(reader["Buenos"].ToString());
                    ind.Malos    = Convert.ToInt32(reader["Malo"].ToString());
                    lista.Add(ind);
                }
                con.CerrarConexion();
            }
            return(lista);
        }
示例#2
0
        /// <summary>
        /// Returns a depiction of the chemical structure as a bitmap.
        /// </summary>
        /// <param name="width">The desired width in pixels.</param>
        /// <param name="height">The desired height in pixels.</param>
        /// <returns>The bitmap depicting the chemical structure.</returns>
        public Bitmap ToBitmap(int width, int height)
        {
            Bitmap bitmap = null;

            try
            {
                using (Indigo indigo = new Indigo())
                {
                    IndigoRenderer indigoRenderer = new IndigoRenderer(indigo);
                    indigo.setOption("render-coloring", true);
                    indigo.setOption("render-image-size", width, height);
                    indigo.setOption("render-label-mode", "hetero");
                    indigo.setOption("render-margins", 10, 10);
                    indigo.setOption("render-output-format", "png");
                    indigo.setOption("render-relative-thickness", 1.6f);
                    IndigoObject structure = CreateIndigoStructure(indigo);
                    structure.dearomatize();
                    structure.layout();
                    bitmap = indigoRenderer.renderToBitmap(structure);
                    structure.Dispose();
                }
            }
            catch
            {
                bitmap = Properties.Resources.Error;
            }

            return(bitmap);
        }
示例#3
0
        public bool InsertIndigo(Indigo ind)
        {
            Boolean    respuesta = false;
            Conexion   con       = new Conexion();
            SqlCommand cmd       = con.AbrirConexionIntranet();

            if (cmd != null)
            {
                cmd.CommandText = "Indigo_InsertParte";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Maquina", ind.Maquina);
                cmd.Parameters.AddWithValue("@Pliego", ind.Pliego);
                cmd.Parameters.AddWithValue("@OT", ind.OT);
                cmd.Parameters.AddWithValue("@NombreOT", ind.NombreOT);
                cmd.Parameters.AddWithValue("@Papel", ind.Papel);
                cmd.Parameters.AddWithValue("@Tiraje", ind.Tiraje);
                cmd.Parameters.AddWithValue("@Color", ind.Color);
                cmd.Parameters.AddWithValue("@ClickInicio", ind.ClickInicio);
                cmd.Parameters.AddWithValue("@ClickFinal", ind.ClickFinal);
                cmd.Parameters.AddWithValue("@Cantidad_Click", ind.CantidadClick);
                cmd.Parameters.AddWithValue("@Buenos", ind.Buenos);
                cmd.Parameters.AddWithValue("@Malo", ind.Malos);
                cmd.Parameters.AddWithValue("@Formato", ind.Formato);
                cmd.Parameters.AddWithValue("@Observacion", ind.Observacion);
                cmd.Parameters.AddWithValue("@Usuario", ind.Usuario);
                cmd.ExecuteReader();
                respuesta = true;
            }
            return(respuesta);
        }
 public MultiStructureSelector(List <IndigoObject> chemStructures, Indigo indigo)
 {
     InitializeComponent();
     _chemStructures = chemStructures;
     _indigo         = indigo;
     showSelections();
 }
示例#5
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            Indigo idg = new Indigo();

            idg.OT            = txtOT.Text;
            idg.NombreOT      = lblNombreOT.Text;
            idg.Tiraje        = Convert.ToInt32(txtTiraje.Text.Replace(".", string.Empty));
            idg.Pliego        = txtPliego.Text;
            idg.Maquina       = ddlMaquina.SelectedItem.ToString();
            idg.ClickInicio   = Convert.ToInt32(txtInicio.Text.Replace(".", string.Empty));
            idg.ClickFinal    = Convert.ToInt32(txtTermino.Text.Replace(".", string.Empty));
            idg.CantidadClick = idg.ClickFinal - idg.ClickInicio;
            idg.Papel         = txtPapel.Text;
            idg.Buenos        = Convert.ToInt32(txtPliego_Impresos.Text.Replace(".", string.Empty));
            idg.Malos         = Convert.ToInt32(txtPliego_Malos.Text.Replace(".", string.Empty));
            idg.Color         = ddlColor1.SelectedItem.ToString() + "/" + ddlColor2.SelectedItem.ToString();
            idg.Formato       = txtAncho.Text + " x " + txtLargo.Text;
            idg.Observacion   = txtObservacion.Text;
            idg.Usuario       = Session["Usuario"].ToString();
            Indigo_Controller controlHP = new Indigo_Controller();

            if (controlHP.InsertIndigo(idg))
            {
                string popupScript4 = "<script language='JavaScript'>window.opener.location='HPIndigo.aspx?id=13&cat=3';window.close();</script>";
                Page.RegisterStartupScript("PopupScript", popupScript4);
            }
            else
            {
                string popupScript4 = "<script language='JavaScript'>alert('Error al ingreso');</script>";
                Page.RegisterStartupScript("PopupScript", popupScript4);
            }
        }
示例#6
0
        private Indigo GetIndigo()
        {
            var indigo = new Indigo();

            indigo.setOption("ignore-stereochemistry-errors", true);
            indigo.setOption("ignore-noncritical-query-features", true);
            return(indigo);
        }
示例#7
0
 public TemplateBuilder(List <IndigoObject> chemStructures, Indigo indigo)
 {
     InitializeComponent();
     this.comboBox1.DisplayMember = "fragmentName";
     _indigo = indigo;
     //Preserve ordering.
     _indigo.setOption("serialize-preserve-ordering", true);
     _chemStructures = chemStructures;
     renderMolecule();
 }
示例#8
0
        private IndigoRenderer GetRenderer(Indigo indigo)
        {
            var renderer = new IndigoRenderer(indigo);

            indigo.setOption("render-output-format", "png");
            indigo.setOption("render-stereo-style", "ext");
            indigo.setOption("render-margins", 5, 5);
            indigo.setOption("render-coloring", true);
            indigo.setOption("render-relative-thickness", "1.5");
            return(renderer);
        }
示例#9
0
        private IndigoObject CreateIndigoStructure(Indigo indigo)
        {
            // Load the molfile as an Indigo object and set basic properties.
            IndigoObject structure = indigo.loadMolecule(this.MolfileContents);

            structure.aromatize();
            structure.clearCisTrans();
            structure.clearStereocenters();

            return(structure);
        }
示例#10
0
        private IndigoRenderer GetRenderer(Indigo indigo, string format = "png", int width = -1, int height = -1)
        {
            var renderer = new IndigoRenderer(indigo);

            indigo.setOption("render-output-format", format);
            indigo.setOption("render-stereo-style", "ext");
            indigo.setOption("render-margins", 5, 5);
            indigo.setOption("render-coloring", true);
            indigo.setOption("render-relative-thickness", "1.5");
            indigo.setOption("render-image-size", width, height);
            return(renderer);
        }
示例#11
0
        /// <summary>
        /// Returns a unique key for the chemical structure.
        /// </summary>
        /// <returns>A canonical Smiles string representing the unique key for the chemical structure.</returns>
        public string GetUniqueKey()
        {
            string uniqueKey = String.Empty;

            using (Indigo indigo = new Indigo())
            {
                IndigoObject structure = CreateIndigoStructure(indigo);
                uniqueKey = structure.canonicalSmiles();
                structure.Dispose();
            }

            return(uniqueKey);
        }
示例#12
0
        public TemplateBuilder(List <IndigoObject> chemStructres, Indigo indigo, List <fragmentationRule> rules)
        {
            InitializeComponent();
            _indigo = indigo;
            //Preserve ordering.
            _indigo.setOption("serialize-preserve-ordering", true);
            _chemStructures = chemStructres;
            renderMolecule();

            foreach (fragmentationRule rule in rules)
            {
                this.comboBox1.Items.Add(rule);
            }
            comboBox1.SelectedIndex      = comboBox1.Items.Count - 1;
            this.comboBox1.DisplayMember = "fragmentName";
        }
示例#13
0
        //Edit dialogue.
        private void Button2_Click(object sender, EventArgs e)
        {
            Indigo       _indigo    = new Indigo();
            IndigoObject savedStrut = XmlSaver.decryptIndigo(_indigo, openFileDialog1.FileName);

            List <IndigoObject> chemStructures = new List <IndigoObject>();

            chemStructures.Add(savedStrut);

            List <fragmentationRule> _rules = XmlSaver.readRules(openFileDialog1.FileName);
            TemplateBuilder          g      = new TemplateBuilder(chemStructures, _indigo, _rules);

            g.ShowDialog();

            this.Close();
        }
示例#14
0
        public void button2_Click(object sender, EventArgs e)
        {
            Indigo indigo = new Indigo();
            List <IndigoObject> chemStrucutres = new List <IndigoObject>();

            //Mol Files
            if (String.Equals(Path.GetExtension(textBox1.Text), ".cml", StringComparison.OrdinalIgnoreCase))
            {
                foreach (IndigoObject item in indigo.iterateCMLFile(this.textBox1.Text))
                {
                    chemStrucutres.Add(item);
                }
            }
            //CDX Files
            if (String.Equals(Path.GetExtension(textBox1.Text), ".cdx", StringComparison.OrdinalIgnoreCase))
            {
                foreach (IndigoObject item in indigo.iterateCDXFile(this.textBox1.Text))
                {
                    chemStrucutres.Add(item);
                }
            }
            //If > 1 structure will need to loop.
            if (chemStrucutres.Count > 1)
            {
                MultiStructureSelector f = new MultiStructureSelector(chemStrucutres, indigo);
                f.ShowDialog(Application.OpenForms["MainMenu"]);
                this.Close();
            }
            else if (chemStrucutres.Count == 1)
            {
                TemplateBuilder f = new TemplateBuilder(chemStrucutres, indigo);
                this.Close();
                f.ShowDialog(Application.OpenForms["MainMenu"]);
            }
            else
            {
                //TODO: Make a better err message... rather than just changing the label.
                this.label1.Text = "THERE WAS AN ERROR!!!!";
                MessageBox.Show("There are " + chemStrucutres.Count + " structs in file.");
            }
        }
示例#15
0
        /// <summary>
        /// Returns whether the chemical structure contains a specified substructure.
        /// </summary>
        /// <param name="substructureQuery">The specified substructure to search for.</param>
        /// <returns>True if this chemical structure contains the specified substructure.</returns>
        public bool HasSubstructure(ChemicalStructure substructureQuery)
        {
            bool hasSubstructure = false;

            using (Indigo indigo = new Indigo())
            {
                // Load inputs.
                IndigoObject structure    = CreateIndigoStructure(indigo);
                IndigoObject substructure = indigo.loadQueryMolecule(substructureQuery.MolfileContents);

                // Perform the match.
                IndigoObject substructureMatcher = indigo.substructureMatcher(structure);
                hasSubstructure = (substructureMatcher.match(substructure) != null);

                // Dispose.
                structure.Dispose();
                substructure.Dispose();
                substructureMatcher.Dispose();
            }

            return(hasSubstructure);
        }
示例#16
0
        private List <int> GetFingerprintPositions(string type)
        {
            List <int> fingerprintPositions = new List <int>();

            using (Indigo indigo = new Indigo())
            {
                // Get the fingerprint as a byte array; this array is fixed length.
                IndigoObject structure   = CreateIndigoStructure(indigo);
                byte[]       fingerprint = structure.fingerprint(type).toBuffer();
                structure.Dispose();

                // Loop through the array and record the identified fingerprint positions.
                for (int i = 0; i < fingerprint.Length; i++)
                {
                    if (Convert.ToBoolean(fingerprint[i]))
                    {
                        fingerprintPositions.Add(i);
                    }
                }
            }

            return(fingerprintPositions);
        }
示例#17
0
 public static IndigoObject decryptIndigo(Indigo indigo, string fileName)
 {
     return(indigo.unserialize(File.ReadAllBytes(fileName)));
 }
示例#18
0
        private void CarregandoTema(Theme theme)
        {
            switch (theme)
            {
            case Theme.Principal:
                var principal = new Principal();
                ColorPrimary         = principal.ColorPrimary;
                ColorDark            = principal.ColorDark;
                ColorLight           = principal.ColorLight;
                ColorAccent          = principal.ColorAccent;
                ColorTextIcons       = principal.ColorTextIcons;
                ColorTextPrimary     = principal.ColorTextPrimary;
                ColorTextSecondary   = principal.ColorTextSecondary;
                ColorDivider         = principal.ColorDivider;
                ColorButtonPrimary   = principal.ColorButtonPrimary;
                ColorButtonSecondary = principal.ColorButtonSecondary;
                break;

            case Theme.Red:
                var red = new Red();
                ColorPrimary = red.ColorPrimary;
                ColorDark    = red.ColorDark;
                ColorLight   = red.ColorLight;
                ColorAccent  = red.ColorAccent;
                IconCart     = red.IconCart;
                IconChat     = red.IconChat;
                IconCatalogo = red.IconCatalogo;
                break;

            case Theme.Pink:
                var pink = new Pink();
                ColorPrimary = pink.ColorPrimary;
                ColorDark    = pink.ColorDark;
                ColorLight   = pink.ColorLight;
                ColorAccent  = pink.ColorAccent;
                IconCart     = pink.IconCart;
                IconChat     = pink.IconChat;
                IconCatalogo = pink.IconCatalogo;
                break;

            case Theme.Purple:
                var purple = new Purple();
                ColorPrimary = purple.ColorPrimary;
                ColorDark    = purple.ColorDark;
                ColorLight   = purple.ColorLight;
                ColorAccent  = purple.ColorAccent;
                IconCart     = purple.IconCart;
                IconChat     = purple.IconChat;
                IconCatalogo = purple.IconCatalogo;
                break;

            case Theme.DeepPurple:
                var deepPurple = new DeepPurple();
                ColorPrimary = deepPurple.ColorPrimary;
                ColorDark    = deepPurple.ColorDark;
                ColorLight   = deepPurple.ColorLight;
                ColorAccent  = deepPurple.ColorAccent;
                IconCart     = deepPurple.IconCart;
                IconChat     = deepPurple.IconChat;
                IconCatalogo = deepPurple.IconCatalogo;
                break;

            case Theme.Indigo:
                var indigo = new Indigo();
                ColorPrimary = indigo.ColorPrimary;
                ColorDark    = indigo.ColorDark;
                ColorLight   = indigo.ColorLight;
                ColorAccent  = indigo.ColorAccent;
                IconCart     = indigo.IconCart;
                IconChat     = indigo.IconChat;
                IconCatalogo = indigo.IconCatalogo;
                break;

            case Theme.Blue:
                var blue = new Blue();
                ColorPrimary = blue.ColorPrimary;
                ColorDark    = blue.ColorDark;
                ColorLight   = blue.ColorLight;
                ColorAccent  = blue.ColorAccent;
                IconCart     = blue.IconCart;
                IconChat     = blue.IconChat;
                IconCatalogo = blue.IconCatalogo;
                break;

            case Theme.LightBlue:
                var lightBlue = new LightBlue();
                ColorPrimary = lightBlue.ColorPrimary;
                ColorDark    = lightBlue.ColorDark;
                ColorLight   = lightBlue.ColorLight;
                ColorAccent  = lightBlue.ColorAccent;
                IconCart     = lightBlue.IconCart;
                IconChat     = lightBlue.IconChat;
                IconCatalogo = lightBlue.IconCatalogo;
                break;

            case Theme.Cyan:
                var cyan = new Cyan();
                ColorPrimary = cyan.ColorPrimary;
                ColorDark    = cyan.ColorDark;
                ColorLight   = cyan.ColorLight;
                ColorAccent  = cyan.ColorAccent;
                IconCart     = cyan.IconCart;
                IconChat     = cyan.IconChat;
                IconCatalogo = cyan.IconCatalogo;
                break;

            case Theme.Teal:
                var teal = new Teal();
                ColorPrimary = teal.ColorPrimary;
                ColorDark    = teal.ColorDark;
                ColorLight   = teal.ColorLight;
                ColorAccent  = teal.ColorAccent;
                IconCart     = teal.IconCart;
                IconChat     = teal.IconChat;
                IconCatalogo = teal.IconCatalogo;
                break;

            case Theme.Brown:
                var brown = new Brown();
                ColorPrimary = brown.ColorPrimary;
                ColorDark    = brown.ColorDark;
                ColorLight   = brown.ColorLight;
                ColorAccent  = brown.ColorAccent;
                IconCart     = brown.IconCart;
                IconChat     = brown.IconChat;
                IconCatalogo = brown.IconCatalogo;
                break;

            default:
                break;
            }
        }
示例#19
0
 public ChemHasseFingerprint(Indigo _indigo)
 {
     indigo = _indigo;
 }
示例#20
0
 public ChemHasseFingerprint(Indigo _indigo, BitArray _fp)
 {
     indigo        = _indigo;
     fp            = _fp;
     base.bitCount = base.CountBits();
 }
示例#21
0
 public IndigoChemistryDepiction(Indigo _indigo)
 {
     indigo   = _indigo;
     renderer = new IndigoRenderer(indigo);
 }
示例#22
0
        static void Main(string[] args)
        {
            Indigo indigo = new Indigo();

            // By default Bingo loads a database and stores all the data in RAM for faster operations
            // But if the application is limited in the memory usage Bingo can work
            // in a file mode with loading only minor parts of data into the memory
            Bingo database = Bingo.createDatabaseFile(indigo, "db1", "molecule", "storage:file");

            // Insert structures from the file
            using (IndigoObject input = indigo.iterateSmilesFile("input.smi"))
                foreach (IndigoObject obj in input)
                {
                    Console.WriteLine("  Object: {0}", obj.name());

                    // When loading from SMILES the only information that we have is an object name
                    // that is stored on the same line with the SMILES in the file
                    int id = int.Parse(obj.name());

                    // Insert loaded object into the database
                    database.insert(obj, id);

                    // Dispose native Indigo object as .NET object is much smaller than native object
                    // and GC can postpone disposing of this object resulting in a large memory
                    // consumption
                    obj.Dispose();
                }

            // Bingo can also assign structure ID automatically
            int autoId1 = database.insert(indigo.loadMolecule("OC1C(C(=O)O)=CC=CC1O"));

            Console.WriteLine("Automatic id = {0}", autoId1);

            int autoId2 = database.insert(indigo.loadMolecule("OC1C(C(=O)O)=CC=CC1O"));

            Console.WriteLine("Automatic id = {0}", autoId2);

            // Search over the database
            Console.WriteLine("Search Benzene:");
            IndigoObject query  = indigo.loadQueryMolecule("C1=CC=CC=C1");
            BingoObject  search = database.searchSub(query);

            while (search.next())
            {
                Console.WriteLine("  Found id = {0}", search.getCurrentId());
            }

            // You can close and reopen database at any moment
            database.close();
            // Load Bingo in a RAM mode with caching all data into the memory
            // Search operations works faster in this mode
            database = Bingo.loadDatabaseFile(indigo, "db1", "molecule", "storage:ram");

            // Search the same query but in the aromatic form
            // Results are the same
            Console.WriteLine("Search Benzene in the aromatic form:");
            query  = indigo.loadQueryMolecule("c1ccccc1");
            search = database.searchSub(query);
            while (search.next())
            {
                Console.WriteLine("  Found id = {0}", search.getCurrentId());
            }

            Console.WriteLine("Search C=O");
            query = indigo.loadQueryMolecule("C=O");
            // Using block will automatically call search.Dispose() that calls search.close()
            // to terminate further search
            using (search = database.searchSub(query))
            {
                int count = 0;
                while (search.next())
                {
                    Console.WriteLine("  Found id = {0}", search.getCurrentId());
                    count++;
                    if (count == 4)
                    {
                        break;
                    }
                }
            }

            // Similarity search
            Console.WriteLine("Similarity search:");
            query  = indigo.loadMolecule("NC1C=CC=C(C1O)C(O)=O");
            search = database.searchSim(query, 0.7f, 1.0f);
            while (search.next())
            {
                Console.WriteLine("  Found id = {0}", search.getCurrentId());
            }

            // Database will be closed automatically in the object destructor
            // but we can close it manually to dispose memory
            database.close();
        }
示例#23
0
        public static void chemtest()
        {
            //IndigoTests T = new IndigoTests();
            //T.test1();


            Indigo indigo = new Indigo();

            /*
             * ChemHasseNode L_ALA = new ChemHasseNode("N[C@@H](C)C(=O)O", HasseNode.HasseNodeTypes.REAL, allNodes);
             * ChemHasseNode D_ALA = new ChemHasseNode("N[C@H](C)C(=O)O", HasseNode.HasseNodeTypes.REAL, allNodes);
             * d=L_ALA.GetDifferenceString (D_ALA);
             * d = D_ALA.GetDifferenceString(L_ALA);
             */
//            HasseDiagram HDM = new HasseDiagram(HasseNodeFactory.NodeType.CHEM );
            HasseDiagram        HDM      = new HasseDiagram(HasseNodeFactory.NodeType.FINGERPRINTCHEM);
            HasseNodeCollection elements = new HasseNodeCollection();

            //ChemHasseNode A = (ChemHasseNode)HDM.AddNode("c1ccccccc[nH]1"); // azonine
            //ChemHasseNode B = (ChemHasseNode)HDM.AddNode("C12=C(C=NC=C1)NC1=C2C=CC=C1");  // pyrido indol
            //ChemHasseNode C = (ChemHasseNode)HDM.AddNode("c1cccc2[nH]ccc21"); // indol

            //FingerprintChemHasseNode A = (FingerprintChemHasseNode)HDM.AddNode("C"); //
            //FingerprintChemHasseNode B = (FingerprintChemHasseNode)HDM.AddNode("CC");  //
            //FingerprintChemHasseNode C = (FingerprintChemHasseNode)HDM.AddNode("CN"); //


            // ChemHasseNode A = (ChemHasseNode)HDM.AddNode(@"[NH3+]C");
            //ChemHasseNode B = (ChemHasseNode)HDM.AddNode(@"[NH2]CC");

            //bool tst = A.IsLargerThan(B);
            //tst = B.IsLargerThan(A);
            //A.GetMaxCommonFragments(A, B);
            //tst = A.IsLargerThan(C);
            //tst = C.IsLargerThan(A);

            // pyridoindol larger than azonine

            System.Threading.Thread.CurrentThread.Priority = System.Threading.ThreadPriority.BelowNormal;
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            int count = 0;

            //foreach (IndigoObject item in indigo.iterateSDFile(@"C:\temp\benzodiazepines.sdf"))
            //foreach (IndigoObject item in indigo.iterateSDFile(@"C:\temp\monoamtrain_x.sdf"))
            //foreach (IndigoObject item in indigo.iterateSDFile(@"C:\HassePub\Datasets\Jorissen\compounds_1st.sdf"))
            //foreach (IndigoObject item in indigo.iterateSDFile(@"C:\HassePub\Datasets\benzodiazepines_v4.sdf"))
            //    foreach (IndigoObject item in indigo.iterateSDFile(@"C:\HassePub\Datasets\small_set.sdf"))
            // foreach (IndigoObject item in indigo.iterateSDFile(@"C:\HassePub\Datasets\chembl_pyridines.sdf"))
            //foreach (IndigoObject item in indigo.iterateSDFile(@"C:\HassePub\Datasets\ChEBI_anilines_480-500.sdf"))
            //foreach (IndigoObject item in indigo.iterateSDFile(@"C:\HassePub\Datasets\ChEBI_valines.sdf"))
            foreach (IndigoObject item in indigo.iterateSDFile(@"C:\HassePub\Datasets\ChEBI_valines_v21.sdf")) // in pub
            {
                if (item.isChiral() == false)
                {
                    continue;
                }
                count++;
                //System.Diagnostics.Debugger.Break();
                if (count > 24)
                {
                    break;            //24 for valines in pub
                }
                //         HasseNode N = HDM.CreateNewNode(item);
                //if (N.IsValid())
                //{
                System.Diagnostics.Stopwatch sw2 = new System.Diagnostics.Stopwatch();
                sw2.Start();
                try
                {
                    HasseNode N = HDM.CreateNewNode(item.molfile());
                    if (item.hasProperty("CHEMBL ID"))
                    {
                        string ChemblID = item.getProperty("CHEMBL ID");
                        N.SetName(ChemblID);
                    }
                    else if (item.hasProperty("ChEBI ID"))
                    {
                        string ChebiID = item.getProperty("ChEBI ID");
                        N.SetName(ChebiID);
                    }
                    else
                    {
                        N.SetName(count.ToString());
                    }

                    HDM.AddNode(N);
                    System.Diagnostics.Debug.WriteLine("---   " + N.KeyString);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("WARNING: could not add node: " + ex.ToString());
                }
            }

            List <HasseNode> subset = new List <HasseNode>();

            /*
             * foreach (HasseNode N in HDM.HasseDiagramNodes.Values)
             * {
             * if (N.NodeType != HasseNode.HasseNodeTypes.ROOT)
             * {
             *  float weight = N.Weight();
             *  N.SetName("w=" + weight.ToString());
             *  float w = 5F * weight / 29F;
             *  if (w < 1) w = 1F;
             *  if (w > 3.5) w = 3.5F;
             * //       N.CreateImage(w);
             *  N.CreateImage();
             *  //if (weight > 20) subset.Add(N);
             * }
             *
             * }
             */
            //DotFileWriter DW = new DotFileWriter(HDM.HasseDiagramNodes, subset, "C:\\temp\\testdotfile.dot");
            DotFileWriter DW = new DotFileWriter(HDM.HasseDiagramNodes, "C:\\temp\\testdotfile.dot");

            int cnt = 0;


            foreach (HasseNode N in HDM.HasseDiagramNodes.Values)
            {
                if ((N.GetType() == typeof(ChemHasseNode) || N.GetType() == typeof(FingerprintChemHasseNode)) && N.NodeType != HasseNode.HasseNodeTypes.ROOT)
                {
                    cnt++;
                    N.SetName(cnt.ToString());
                    if (N.GetType() == typeof(ChemHasseNode))
                    {
                        ((ChemHasseNode )N).CreateImage();
                    }
                    if (N.GetType() == typeof(FingerprintChemHasseNode))
                    {
                        ((FingerprintChemHasseNode)N).CreateImage();
                    }
                }
            }

            DW.SetLabelsToNumericSequence();
            DW.SetDrawingColors();
            DW.LabelMode     = labelMode.NO_LABELS; // for figure 5
            DW.directionMode = graphDirection.RIGHT;

            //DW.LabelMode = labelMode.USE_NODE_LABEL;
            //DW.LabelMode = labelMode.USE_NODE_ID;

            DW.UseImage        = true;
            DW.WriteEdgeLabels = false;

            sw.Stop();
            System.Diagnostics.Debug.WriteLine(sw.ElapsedMilliseconds.ToString());

            DW.WriteDotFile();

            System.Diagnostics.Debug.WriteLine("Nodes: " + HDM.HasseDiagramNodes.Count());
            System.Diagnostics.Debug.WriteLine("Diffs: " + HDM.DifferenceNodes.Count());
            System.Diagnostics.Debug.WriteLine("Hash: " + HDM.RootNode.HashString());

            foreach (HasseNode N in HDM.HasseDiagramNodes.Values)
            {
                if (N.HasNodeType(HasseNode.HasseNodeTypes.FRAGMENT))
                {
                    ;
                }
                //  System.Diagnostics.Debug.WriteLine(N.KeyString + " " + N.Weight().ToString() );
            }
            System.Diagnostics.Debug.WriteLine(HasseDiagramStats.Report(HDM.HasseDiagramNodes, HDM.RootNode));
        }