Beispiel #1
0
        public FingerprintChemHasseNode(string StrMolecule, HasseNodeTypes ElementType, string debugInfo)
            : base(ElementType, debugInfo)
        {
            ChemObject = new IndigoChemistry();
            if (ElementType == HasseNodeTypes.ROOT)
            {
                this.keystring = "0";
            }
            else if (Convert.ToBoolean(ElementType & HasseNodeTypes.FRAGMENT))  // is fragment
            {
                //   molecule = null;
                hFingerprint = ChemObject.GetEmptyHasseFingerPrint();
                hFingerprint.FromHex(StrMolecule);
                base.size      = hFingerprint.bitCount;
                this.keystring = StrMolecule;
                return;
            }

            else
            {
                ChemObject.InitMolecule(StrMolecule);
                this.keystring = ChemObject.keystr;
                _isvalid       = ChemObject.ChemistryIsValid;
                hFingerprint   = ChemObject.GetHasseFingerPrint();
                base.size      = hFingerprint.bitCount;
            }
        }
        public FingerprintChemHasseNode(string StrMolecule, HasseNodeTypes ElementType, string debugInfo)
            : base(ElementType, debugInfo)
        {
            ChemObject = new IndigoChemistry();
            if (ElementType == HasseNodeTypes.ROOT)
            {
                this.keystring = "0";
            }
            else if (Convert.ToBoolean(ElementType &  HasseNodeTypes.FRAGMENT)) // is fragment
            {
                //   molecule = null;
                hFingerprint = ChemObject.GetEmptyHasseFingerPrint();
                hFingerprint.FromHex(StrMolecule);
                base.size = hFingerprint.bitCount;
                this.keystring = StrMolecule;
                return;
            }

            else
            {
                ChemObject.InitMolecule(StrMolecule);
                this.keystring = ChemObject.keystr;
                _isvalid = ChemObject.ChemistryIsValid;
                hFingerprint = ChemObject.GetHasseFingerPrint();
                base.size = hFingerprint.bitCount;
            }
        }
Beispiel #3
0
        public override bool GetMaxCommonFragments(
            HasseNode Node1, HasseNode Node2,
            bool dbg, HasseFragmentInsertionQueue NewFragmentList,
            int MinimumOverlap)
        {
            string           debugInfo = "";
            HasseFingerprint fp1       = ((FingerprintChemHasseNode)Node1).hFingerprint;
            HasseFingerprint fp1_clone = fp1.CloneHasseFingerprint();
            HasseFingerprint fp2       = ((FingerprintChemHasseNode)Node2).hFingerprint;

            fp1_clone.AndBits(fp2);
            if (fp1_clone.bitCount >= MinimumOverlap)
            {
                string strMCS = fp1_clone.ToHex();

                HasseFingerprint test = new HasseFingerprint();
                test.FromHex(strMCS);

                NewFragmentList.Add(
                    new HasseNode[1] {
                    this
                },                                    // this is lower than new frag
                    new HasseNode[2] {
                    Node1, Node2
                },                                                                                               // those are higher than new frag
                    strMCS,                                                                                      // string to use for new node creation later
                    debugInfo, HasseNode.HasseNodeTypes.FRAGMENT | HasseNode.HasseNodeTypes.MAX_COMMON_FRAGMENT, // type of frag
                    null                                                                                         // this new frag is not associated with a single edge
                    );
                return(true);
            }
            return(false);
        }
        public override bool GetMaxCommonFragments(
        HasseNode Node1, HasseNode Node2,
        bool dbg, HasseFragmentInsertionQueue NewFragmentList,
        int MinimumOverlap)
        {
            string debugInfo = "";
            HasseFingerprint fp1 = ((FingerprintChemHasseNode)Node1).hFingerprint;
            HasseFingerprint fp1_clone = fp1.CloneHasseFingerprint();
            HasseFingerprint fp2 = ((FingerprintChemHasseNode)Node2).hFingerprint;
            fp1_clone.AndBits(fp2);
            if(fp1_clone.bitCount >= MinimumOverlap ){
                string strMCS = fp1_clone.ToHex();

                HasseFingerprint test = new HasseFingerprint();
                test.FromHex(strMCS);

            NewFragmentList.Add(
                           new HasseNode[1] { this }, // this is lower than new frag
                           new HasseNode[2] { Node1, Node2 }, // those are higher than new frag
                           strMCS, // string to use for new node creation later
                           debugInfo, HasseNode.HasseNodeTypes.FRAGMENT | HasseNode.HasseNodeTypes.MAX_COMMON_FRAGMENT, // type of frag
                           null // this new frag is not associated with a single edge
                           );
                return true;
            }
            return false;
        }