-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax for deuteration, exchange percentage and D2O percentage in solvent #35
Comments
Do we also need a swelling fraction for the protein which increases volume and decreases contrast as solvent is incorporated? Deuteration can be handled using H-D ratios in the underlying formula but this is somewhat awkward and won't work for fasta sequences. Maybe Specifying mixtures by concentration (mg/mL) is supported (e.g., Together, |
We may want to preserve the parse tree for mixtures in the |
You can fake 70%deuterated in the formula by replacing all H with (H.3D.7). Similarly, for 90%exchanged can replace H[1] with (H.1H[1].9). For both %exchange and %deuterated the exchange applies first, with the new H.1 then substituted by deuteration, giving (H.3D.7) for H and ((H.3D.7).1H[1].9) for H[1] in the original formula. For fasta calculations you will need to do this in two steps, first finding compact formula for the sequence then replacing the H and H[1] for the exchanges. Awkward but doable. In code it might look something like this (untested): def deuterate(compound, deuteration_percent, exchange_percent, solvent_percent):
parts = []
dp, ep, sp = deuteration_percent/100, exchange_percent/100, solvent_percent/100
for count, el in compound.hill.structure:
if el is H[1]:
# unexchanged percent (1-ep) is partially deuterated (dp) giving H:(1-ep)*(1-dp), D:(1-ep)*dp
# exchanged percent ep follows solvent percent giving H:ep*(1-sp), D:ep*sp
# adding gives:
part_H = (1-ep)*(1-dp)+ep*(1-sp)
part_D = (1-ep)*dp + ep*sp
el = ((part_H, H), (part_D, D))
elif el is H:
el = ((1-dp, H), (dp, D))
parts.append((count, el))
return formula(parts, natural_density=compound.natural_density)
compound = deuterate(formula("C8H10H[1]2NOS@1.2"), 70, 90, 30) |
For labile H we need exchange percentage (default 90%) for the protein and D₂O percentage for the solvent (default 0%). For non-labile H we need deuteration percentage (default 0%). All three percentages can be present for the same material.
Perhaps x %D y %D2O z %exch? A little confusing since %wt and %vol are used in the context of (x %vol A // y % B // C).
The text was updated successfully, but these errors were encountered: