| 1 |
%% |
| 2 |
%% This is file `pgfmolbio.chromatogram.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% pgfmolbio.dtx (with options: `pmb-chr-tex') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2024 by Wolfgang Esser-Skala |
| 10 |
%% |
| 11 |
%% This work may be distributed and/or modified under the |
| 12 |
%% conditions of the LaTeX Project Public License, either version 1.3c |
| 13 |
%% of this license or (at your option) any later version. |
| 14 |
%% The latest version of this license is in |
| 15 |
%% https://www.latex-project.org/lppl.txt |
| 16 |
%% and version 1.3c or later is part of all distributions of LaTeX |
| 17 |
%% version 2008/05/04 or later. |
| 18 |
%% |
| 19 |
\ProvidesFile{pgfmolbio.chromatogram.tex}[2024/06/17 v0.21a SCF chromatograms] |
| 20 |
|
| 21 |
|
| 22 |
\ifluatex |
| 23 |
\RequireLuaModule{pgfmolbio.chromatogram} |
| 24 |
\fi |
| 25 |
|
| 26 |
\definecolor{pmbTraceGreen}{RGB}{34,114,46} |
| 27 |
\definecolor{pmbTraceBlue}{RGB}{48,37,199} |
| 28 |
\definecolor{pmbTraceBlack}{RGB}{0,0,0} |
| 29 |
\definecolor{pmbTraceRed}{RGB}{191,27,27} |
| 30 |
\definecolor{pmbTraceYellow}{RGB}{233,230,0} |
| 31 |
|
| 32 |
\def\@pmb@chr@keydef#1#2{% |
| 33 |
\pgfkeyssetvalue{/pgfmolbio/chromatogram/#1}{#2}% |
| 34 |
} |
| 35 |
\def\@pmb@chr@stylekeydef#1#2{% |
| 36 |
\pgfkeys{/pgfmolbio/chromatogram/#1/.style={#2}}% |
| 37 |
} |
| 38 |
\def\@pmb@chr@getkey#1{% |
| 39 |
\pgfkeysvalueof{/pgfmolbio/chromatogram/#1}% |
| 40 |
} |
| 41 |
|
| 42 |
\@pmb@chr@keydef{sample range}{1-500 step 1} |
| 43 |
|
| 44 |
\@pmb@chr@keydef{x unit}{0.2mm} |
| 45 |
\@pmb@chr@keydef{y unit}{0.01mm} |
| 46 |
\@pmb@chr@keydef{samples per line}{500} |
| 47 |
\@pmb@chr@keydef{baseline skip}{3cm} |
| 48 |
\@pmb@chr@stylekeydef{canvas style}{draw=none, fill=none} |
| 49 |
\@pmb@chr@keydef{canvas height}{2cm} |
| 50 |
|
| 51 |
\@pmb@chr@stylekeydef{trace A style}{pmbTraceGreen} |
| 52 |
\@pmb@chr@stylekeydef{trace C style}{pmbTraceBlue} |
| 53 |
\@pmb@chr@stylekeydef{trace G style}{pmbTraceBlack} |
| 54 |
\@pmb@chr@stylekeydef{trace T style}{pmbTraceRed} |
| 55 |
\pgfmolbioset[chromatogram]{% |
| 56 |
trace style/.code=\pgfkeysalso{ |
| 57 |
trace A style/.style={#1}, |
| 58 |
trace C style/.style={#1}, |
| 59 |
trace G style/.style={#1}, |
| 60 |
trace T style/.style={#1} |
| 61 |
}% |
| 62 |
} |
| 63 |
\@pmb@chr@keydef{traces drawn}{} |
| 64 |
|
| 65 |
\@pmb@chr@stylekeydef{tick A style}{thin, pmbTraceGreen} |
| 66 |
\@pmb@chr@stylekeydef{tick C style}{thin, pmbTraceBlue} |
| 67 |
\@pmb@chr@stylekeydef{tick G style}{thin, pmbTraceBlack} |
| 68 |
\@pmb@chr@stylekeydef{tick T style}{thin, pmbTraceRed} |
| 69 |
\pgfmolbioset[chromatogram]{% |
| 70 |
tick style/.code=\pgfkeysalso{ |
| 71 |
tick A style/.style={#1}, |
| 72 |
tick C style/.style={#1}, |
| 73 |
tick G style/.style={#1}, |
| 74 |
tick T style/.style={#1} |
| 75 |
}% |
| 76 |
} |
| 77 |
\@pmb@chr@keydef{tick length}{1mm} |
| 78 |
\@pmb@chr@keydef{ticks drawn}{} |
| 79 |
|
| 80 |
\@pmb@chr@keydef{base label A text}{\strut A} |
| 81 |
\@pmb@chr@keydef{base label C text}{\strut C} |
| 82 |
\@pmb@chr@keydef{base label G text}{\strut G} |
| 83 |
\@pmb@chr@keydef{base label T text}{\strut T} |
| 84 |
\@pmb@chr@stylekeydef{base label A style}% |
| 85 |
{below=4pt, font=\ttfamily\footnotesize, pmbTraceGreen} |
| 86 |
\@pmb@chr@stylekeydef{base label C style}% |
| 87 |
{below=4pt, font=\ttfamily\footnotesize, pmbTraceBlue} |
| 88 |
\@pmb@chr@stylekeydef{base label G style}% |
| 89 |
{below=4pt, font=\ttfamily\footnotesize, pmbTraceBlack} |
| 90 |
\@pmb@chr@stylekeydef{base label T style}% |
| 91 |
{below=4pt, font=\ttfamily\footnotesize, pmbTraceRed} |
| 92 |
\pgfmolbioset[chromatogram]{% |
| 93 |
base label style/.code=\pgfkeysalso{ |
| 94 |
base label A style/.style={#1}, |
| 95 |
base label C style/.style={#1}, |
| 96 |
base label G style/.style={#1}, |
| 97 |
base label T style/.style={#1} |
| 98 |
}% |
| 99 |
} |
| 100 |
\@pmb@chr@keydef{base labels drawn}{} |
| 101 |
|
| 102 |
\newif\ifpmb@chr@showbasenumbers |
| 103 |
\pgfmolbioset[chromatogram]{% |
| 104 |
show base numbers/.is if=pmb@chr@showbasenumbers, |
| 105 |
show base numbers |
| 106 |
} |
| 107 |
\@pmb@chr@stylekeydef{base number style}% |
| 108 |
{pmbTraceBlack, below=-3pt, font=\sffamily\tiny} |
| 109 |
\@pmb@chr@keydef{base number range}{auto-auto step 10} |
| 110 |
|
| 111 |
\@pmb@chr@keydef{probability distance}{0.8cm} |
| 112 |
\@pmb@chr@keydef{probabilities drawn}{} |
| 113 |
\@pmb@chr@keydef{probability style function}{nil} |
| 114 |
|
| 115 |
\pgfmolbioset[chromatogram]{ |
| 116 |
bases drawn/.code=\pgfkeysalso{ |
| 117 |
traces drawn=#1, |
| 118 |
ticks drawn=#1, |
| 119 |
base labels drawn=#1, |
| 120 |
probabilities drawn=#1 |
| 121 |
}, |
| 122 |
bases drawn=ACGT |
| 123 |
} |
| 124 |
|
| 125 |
\ifluatex\else\expandafter\endinput\fi |
| 126 |
|
| 127 |
\newif\ifpmb@chr@tikzpicture |
| 128 |
|
| 129 |
\newcommand\pmbchromatogram[2][]{% |
| 130 |
\@ifundefined{useasboundingbox}% |
| 131 |
{\pmb@chr@tikzpicturefalse\begin{tikzpicture}}% |
| 132 |
{\pmb@chr@tikzpicturetrue\begingroup}% |
| 133 |
\pgfmolbioset[chromatogram]{#1}% |
| 134 |
\directlua{ |
| 135 |
pmbChromatogram = pgfmolbio.chromatogram.Chromatogram:new() |
| 136 |
pmbChromatogram:readScfFile("#2") |
| 137 |
pmbChromatogram:setParameters{ |
| 138 |
sampleRange = "\@pmb@chr@getkey{sample range}", |
| 139 |
xUnit = "\@pmb@chr@getkey{x unit}", |
| 140 |
yUnit = "\@pmb@chr@getkey{y unit}", |
| 141 |
samplesPerLine = "\@pmb@chr@getkey{samples per line}", |
| 142 |
baselineSkip = "\@pmb@chr@getkey{baseline skip}", |
| 143 |
canvasHeight = "\@pmb@chr@getkey{canvas height}", |
| 144 |
tracesDrawn = "\@pmb@chr@getkey{traces drawn}", |
| 145 |
tickLength = "\@pmb@chr@getkey{tick length}", |
| 146 |
ticksDrawn = "\@pmb@chr@getkey{ticks drawn}", |
| 147 |
baseLabelsDrawn = "\@pmb@chr@getkey{base labels drawn}", |
| 148 |
showBaseNumbers = "\ifpmb@chr@showbasenumbers true\else false\fi", |
| 149 |
probDistance = "\@pmb@chr@getkey{probability distance}", |
| 150 |
probabilitiesDrawn = "\@pmb@chr@getkey{probabilities drawn}", |
| 151 |
probStyle = \@pmb@chr@getkey{probability style function} |
| 152 |
} |
| 153 |
pmbChromatogram:setParameters{ |
| 154 |
baseNumberRange = "\@pmb@chr@getkey{base number range}", |
| 155 |
} |
| 156 |
pgfmolbio.setCoordinateFormat( |
| 157 |
"\pgfkeysvalueof{/pgfmolbio/coordinate unit}", |
| 158 |
"\pgfkeysvalueof{/pgfmolbio/coordinate format string}" |
| 159 |
) |
| 160 |
\ifpmb@loadmodule@convert |
| 161 |
local filename = |
| 162 |
"\pgfkeysvalueof{/pgfmolbio/convert/output file name}" |
| 163 |
if filename == "(auto)" then |
| 164 |
filename = "pmbconverted" .. pgfmolbio.outputFileId |
| 165 |
end |
| 166 |
filename = filename .. |
| 167 |
".\pgfkeysvalueof{/pgfmolbio/convert/output file extension}" |
| 168 |
outputFile, ioError = io.open(filename, "w") |
| 169 |
if ioError then |
| 170 |
tex.error(ioError) |
| 171 |
end |
| 172 |
tex.sprint = function (a) outputFile:write(a) end |
| 173 |
tex.sprint("\string\\begin{tikzpicture}") |
| 174 |
pmbChromatogram:printTikzChromatogram() |
| 175 |
tex.sprint("\string\n\string\\end{tikzpicture}") |
| 176 |
outputFile:close() |
| 177 |
pgfmolbio.outputFileId = pgfmolbio.outputFileId + 1 |
| 178 |
\else |
| 179 |
pmbChromatogram:printTikzChromatogram() |
| 180 |
\fi |
| 181 |
}% |
| 182 |
\ifpmb@chr@tikzpicture\endgroup\else\end{tikzpicture}\fi% |
| 183 |
} |
| 184 |
\endinput |
| 185 |
%% |
| 186 |
%% End of file `pgfmolbio.chromatogram.tex'. |