parse_tree
bigsmiles.methods.display_methods.tree_to_string.tree_to_string(bigsmiles_, show_object_labels=True, print_repr=False)
¶
Creates a string representation of a tree for printing.
PARAMETER | DESCRIPTION |
---|---|
bigsmiles_ |
Root node
TYPE:
|
show_object_labels |
show object labels
TYPE:
|
print_repr |
print str or print repr of objects True: repr() is called False: str() is called
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
text
|
String with the structure of a tree.
TYPE:
|
Example¶
Code:¶
import bigsmiles
import bigsmiles.methods as bs_methods
polymer_string = "CC{[>][<]CC(C)[>][<]}CC(C)=C"
polymer = bigsmiles.BigSMILES(polymer_string)
text = bs_methods.print_tree(polymer)
print(text)
Output:¶
BigSMILES: CC{[>][<]CC(C)[>][<]}CC(C)=C
├── Atom: C
├── Bond:
├── Atom: C
├── Bond:
├── StochasticObject: {[>][<]CC(C)[>][<]}
│ └── StochasticFragment: [<]CC(C)[>]
│ ├── BondDescriptorAtom: [<]
│ ├── Bond:
│ ├── Atom: C
│ ├── Bond:
│ ├── Atom: C
│ ├── Branch: (C)
│ │ ├── Bond:
│ │ └── Atom: C
│ ├── Bond:
│ └── BondDescriptorAtom: [>]
├── Bond:
├── Atom: C
├── Bond:
├── Atom: C
├── Branch: (C)
│ ├── Bond:
│ └── Atom: C
├── Bond: =
└── Atom: C
Configuration¶
bigsmiles.methods.display_methods.tree_to_string.TreeConfig
¶
this class can be used to configure the tree parsing output
PARAMETER | DESCRIPTION |
---|---|
tree_symbol_options |
symbols to build the tree. various ascii options are available
|
symbols |
select from 'tree_symbol_options' what ascii symbols you want to use
|
Notes¶
- color can be added to the output with through the main configuration class