Skip to content

Latest commit

 

History

History
83 lines (78 loc) · 6.34 KB

File metadata and controls

83 lines (78 loc) · 6.34 KB

{{define "pharma"}}{{$v := . -}} {{$inters := list -}} {{$alset := false}} {{with get $v "KEGG Entries"}}{{range . -}} {{range $int := .Interactions -}} {{$alset = false}} {{range $sint := $inters -}} {{if eq $int.Target $sint.Target}}{{$_ := $int.Action | append $sint.Actions | uniq | sortAlpha | set $sint "Actions"}} {{$alset = true}} {{end -}} {{end -}} {{if eq $alset false}}{{$inters = (dict "Target" $int.Target "Actions" (list $int.Action)) | append $inters}}{{end -}} {{end}}{{end}}{{end -}}

{{if any $v.Actives $v.SwissTargetPredictions $inters (get $v "ATC Code") -}}

Pharmacology

{{with $ratc := get $v "ATC Code" -}} {{with $atc := kindIs "string" $ratc | ternary (list $ratc "") $ratc -}}

{{template "user" "{wkp 'Anatomical Therapeutic Chemical Classification System' 'ATC Classification'}"}}

{{$l := ""}}{{$lclass := list -}} {{range $code := $atc -}} {{$pre := splitList "-" $code | first | default "" | trim -}} {{$class := splitList "-" $code | rest | first | default "" | trim -}} {{if len $pre | eq 1 -}} In the {{lower $class}} ({{printf "%s) %s" $pre $pre (lower $v.Title)}} acts {{$l = printf "!%s" $code -}} {{else if hasPrefix "N" $code -}} {{$class = $class | replace "Psychostimulants, agents used for adhd and nootropics" "stimulant" -}} {{$class = $class | replace "Centrally acting sympathomimetics" "sympathomimetic" -}} {{$class = $class | replace "Amfetamine" "" -}} {{$class = $class | trimSuffix "s" -}} {{if empty $class | not}}{{$class = printf "%s (%s)" ($class | lower) $pre $pre}}{{$lclass = append $lclass $class}}{{end -}} {{$l = printf "%s - %s" $pre (default "" $class) -}} {{else if and $lclass $l (hasPrefix "!" $l | not)}}{{if hasPrefix ($l | trunc 1) $code | not}} as a {{template "rca" (sortAlpha $lclass)}}{{$lclass = list}}.{{template "refg" (dict "refs" $v.Refs "grep" "pubchem")}}{{end -}} {{else}}{{$l = $code -}} {{end}}{{end -}} {{end}}{{end -}}

{{$rmesh := get $v "MeSH Pharmacological Classification" -}} {{if kindIs "list" $rmesh}}{{with $mesh := $rmesh -}}

{{template "user" "{wkp 'List of MeSH codes' 'MeSH Classification'}"}}

    {{range $me := $mesh -}} {{$name := $me.Name | replace "Central Nervous System Stimulant" "Stimulant" -}} {{$name = $name | lower | trimSuffix "s" -}}
  • {{printf "%s (%s)" $name $me.Id $me.Id -}}
  • {{end -}}
{{end}}{{end -}}

{{if $v.Actives -}}

Metabolism

{{$v.Title}} acts as a {{$ac := "prodrug"}}{{range $cc := $v.Classes}}{{if eq (lower $cc) "codrug"}}{{$ac = "codrug"}}{{end}}{{end}}{{if eq $ac "codrug"}}codrug{{else}}prodrug{{end}} for:

Metabolic pathways {{template "exnd" .collapse}}
>
{{$v.Title}}
{{$v.Title}}
{{$off := 0}}{{range $active := $v.Actives}}{{$apiPath := printf "/api/substance/%s" (replace "_" "%20" (lower $active))}}{{$apiFile := httpInclude $apiPath}}{{$aars := fromJson $apiFile}}{{$off = add 200 $off}}{{end}}
{{/*FMO3*/}}

{{/*FMO3*/}}
{{/*
At normal urine pH, about 30–40% of amphetamine is excreted unchanged and roughly 50% is excreted as the inactive metabolites (bottom row).[2] The remaining 10–20% is excreted as the active metabolites.
*/}}
{{end}}

{{if $inters}}

Interactions {{template "exnd" .collapse}}

{{range $int := $inters}}{{end}}
{{$int.Target}}{{range $i, $act:= $int.Actions}}{{.}}{{if eq (add1 $i) (len $int.Actions) | not}} / {{end}}{{end}}
{{end}} {{end}}{{end}}