test_class.declarator: molecule
test_class.modifier: private
test_class.original_string: private MoleculeGraph molecule;
test_class.type: MoleculeGraph
test_class.var_name: molecule
test_class.file: singa-structure/src/test/java/bio/singa/structure/algorithms/fragmentation/RECAPFragmenterTest.java
test_class.identifier: RECAPFragmenterTest
test_case.body: @Test()
      void fragment() {
          MoleculeGraph molecule = SmilesParser.parse("CCCCN(C(=O)N(C)C(=[OH]C1CC1)N(C)Cl)c2ccccc2");
          RECAPFragmenter recapFragmenter = new RECAPFragmenter(molecule);
          DirectedGraph<GenericNode<MoleculeGraph>> fragments = recapFragmenter.getFragmentSpace();
          List<MoleculeGraph> uniqueList = new ArrayList<>(recapFragmenter.getUniqueFragments());
          assertEquals(100, uniqueList.size());
      }
test_case.class_method_signature: RECAPFragmenterTest.fragment()
test_case.full_signature: @Test() void fragment()
test_case.identifier: fragment
test_case.invocations: parse getFragmentSpace getUniqueFragments assertEquals size
test_case.modifiers: @Test()
test_case.parameters: ()
test_case.return: void
test_case.signature: void fragment()
focal_class.declarator: logger = LoggerFactory.getLogger(RECAPFragmenter.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(RECAPFragmenter.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: fragmentationRules = new TreeMap<>()
focal_class.modifier: private final
focal_class.original_string: private final TreeMap<Integer, FragmentationRule> fragmentationRules = new TreeMap<>();
focal_class.type: TreeMap<Integer, FragmentationRule>
focal_class.var_name: fragmentationRules
focal_class.declarator: uniqueFragments = new HashSet<>()
focal_class.modifier: private
focal_class.original_string: private Set<MoleculeGraph> uniqueFragments = new HashSet<>();
focal_class.type: Set<MoleculeGraph>
focal_class.var_name: uniqueFragments
focal_class.declarator: molecule
focal_class.modifier: private
focal_class.original_string: private MoleculeGraph molecule;
focal_class.type: MoleculeGraph
focal_class.var_name: molecule
focal_class.declarator: fragmentSpace
focal_class.modifier: private
focal_class.original_string: private DirectedGraph<GenericNode<MoleculeGraph>> fragmentSpace;
focal_class.type: DirectedGraph<GenericNode<MoleculeGraph>>
focal_class.var_name: fragmentSpace
focal_class.file: singa-structure/src/main/java/bio/singa/structure/algorithms/fragmentation/RECAPFragmenter.java
focal_class.identifier: RECAPFragmenter
focal_class.class_method_signature: RECAPFragmenter.RECAPFragmenter(MoleculeGraph molecule)
focal_class.full_signature: public  RECAPFragmenter(MoleculeGraph molecule)
focal_class.identifier: RECAPFragmenter
focal_class.modifiers: public
focal_class.parameters: (MoleculeGraph molecule)
focal_class.signature:  RECAPFragmenter(MoleculeGraph molecule)
focal_class.class_method_signature: RECAPFragmenter.initRules()
focal_class.full_signature: private void initRules()
focal_class.identifier: initRules
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void initRules()
focal_class.class_method_signature: RECAPFragmenter.fragment()
focal_class.full_signature: private void fragment()
focal_class.identifier: fragment
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void fragment()
focal_class.class_method_signature: RECAPFragmenter.getFragmentSpace()
focal_class.full_signature: public DirectedGraph<GenericNode<MoleculeGraph>> getFragmentSpace()
focal_class.identifier: getFragmentSpace
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: DirectedGraph<GenericNode<MoleculeGraph>>
focal_class.signature: DirectedGraph<GenericNode<MoleculeGraph>> getFragmentSpace()
focal_class.class_method_signature: RECAPFragmenter.getUniqueFragments()
focal_class.full_signature: public Set<MoleculeGraph> getUniqueFragments()
focal_class.identifier: getUniqueFragments
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Set<MoleculeGraph>
focal_class.signature: Set<MoleculeGraph> getUniqueFragments()
focal_class.class_method_signature: RECAPFragmenter.getFragmentSmiles()
focal_class.full_signature: public Map<String, MoleculeGraph> getFragmentSmiles()
focal_class.identifier: getFragmentSmiles
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Map<String, MoleculeGraph>
focal_class.signature: Map<String, MoleculeGraph> getFragmentSmiles()
focal_method.body: private void fragment() {
  
          fragmentSpace = new DirectedGraph<>();
  
          Set<Integer> visitedNodes = new HashSet<>();
          Stack<GenericNode<MoleculeGraph>> stack = new Stack<>();
          GenericNode<MoleculeGraph> rootNode = new GenericNode<>(0, (MoleculeGraph) molecule.getCopy());
          fragmentSpace.addNode(rootNode);
          stack.add(rootNode);
          visitedNodes.add(rootNode.getIdentifier());
  
          // depth-first search strategy to build fragment graph
          while (!stack.isEmpty()) {
  
              GenericNode<MoleculeGraph> currentNode = stack.pop();
              fragmentationRules.forEach((integer, fragmentationRule) -> fragmentationRule.applyTo(currentNode));
  
              List<GenericNode<MoleculeGraph>> neighbours = currentNode.getNeighbours();
              for (int i = 0; i < neighbours.size(); i++) {
                  GenericNode<MoleculeGraph> neighbor = neighbours.get(i);
                  if (!visitedNodes.contains(neighbor.getIdentifier())) {
                      // fragment current node with all rules
                      stack.add(neighbor);
                  }
              }
              visitedNodes.add(currentNode.getIdentifier());
          }
          logger.info("fragmentation yielded {} unique fragments in total", uniqueFragments.size());
      }
focal_method.class_method_signature: RECAPFragmenter.fragment()
focal_method.full_signature: private void fragment()
focal_method.identifier: fragment
focal_method.invocations: getCopy addNode add add getIdentifier isEmpty pop forEach applyTo getNeighbours size get contains getIdentifier add add getIdentifier info size
focal_method.modifiers: private
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void fragment()