0 | module Test.Text.Smiles.Generators
 1 |
 2 | import public Test.Chem.Generators
 3 | import public Text.Smiles
 4 |
 5 | import Data.Vect
 6 |
 7 | %default total
 8 |
 9 | export
10 | chirality : Gen Chirality
11 | chirality = frequency
12 |   [ (5, pure None)
13 |   , (1, element [CW, CCW, TH1, TH2, AL1, AL2, SP1, SP2, SP3])
14 |   , (1, maybe None TB . refineTBIx <$> bits8 (linear 1 20))
15 |   , (1, maybe None OH . refineOHIx <$> bits8 (linear 1 20))
16 |   ]
17 |
18 | export
19 | subset : Gen SmilesAtom
20 | subset = element
21 |   [ SubsetAtom C False
22 |   , SubsetAtom B False
23 |   , SubsetAtom N False
24 |   , SubsetAtom O False
25 |   , SubsetAtom P False
26 |   , SubsetAtom S False
27 |   , SubsetAtom F False
28 |   , SubsetAtom Cl False
29 |   , SubsetAtom Br False
30 |   , SubsetAtom I False
31 |   , SubsetAtom B True
32 |   , SubsetAtom C True
33 |   , SubsetAtom N True
34 |   , SubsetAtom O True
35 |   , SubsetAtom P True
36 |   , SubsetAtom S True
37 |   ]
38 |
39 | export
40 | hcount : Gen HCount
41 | hcount = fromMaybe 0 . refineHCount <$> bits8 (linear 0 9)
42 |
43 | export
44 | atom : Gen SmilesAtom
45 | atom = frequency
46 |   [ (1, subset)
47 |   , (5, Prelude.[| bracket aromIsotope chirality hcount charge |])
48 |   ]
49 |
50 | export
51 | bond : Gen SmilesBond
52 | bond = element [Sngl,Dbl,Trpl,Quad,Arom,FW,BW]
53 |
54 | export
55 | ringNr : Gen RingNr
56 | ringNr = fromMaybe 0 . refineRingNr <$> bits8 (linear 0 99)
57 |
58 | export
59 | ring : Gen Ring
60 | ring = [| R ringNr (maybe bond) |]
61 |