From 501d1837aeddc838bf1ea0898f94d6b9435aa205 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 18 Oct 2012 22:52:50 +0000 Subject: pgfmolbio 0.2 (7oct12) git-svn-id: svn://tug.org/texlive/trunk@28023 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/lualatex/pgfmolbio/README | 9 +- .../doc/lualatex/pgfmolbio/SampleGff.gff | 14 + .../doc/lualatex/pgfmolbio/SampleUniprot.txt | 19 + .../doc/lualatex/pgfmolbio/pgfmolbio.lua | 80 + .../doc/lualatex/pgfmolbio/pgfmolbio.pdf | Bin 386065 -> 853848 bytes .../source/lualatex/pgfmolbio/pgfmolbio.dtx | 5520 ++++++++++++++++---- .../source/lualatex/pgfmolbio/pgfmolbio.ins | 22 +- .../lualatex/pgfmolbio/pgfmolbio.chromatogram.lua | 624 ++- .../lualatex/pgfmolbio/pgfmolbio.chromatogram.tex | 233 +- .../tex/lualatex/pgfmolbio/pgfmolbio.convert.tex | 40 + .../tex/lualatex/pgfmolbio/pgfmolbio.domains.lua | 810 +++ .../tex/lualatex/pgfmolbio/pgfmolbio.domains.tex | 799 +++ .../tex/lualatex/pgfmolbio/pgfmolbio.sty | 52 +- 13 files changed, 6850 insertions(+), 1372 deletions(-) create mode 100644 Master/texmf-dist/doc/lualatex/pgfmolbio/SampleGff.gff create mode 100644 Master/texmf-dist/doc/lualatex/pgfmolbio/SampleUniprot.txt create mode 100644 Master/texmf-dist/doc/lualatex/pgfmolbio/pgfmolbio.lua create mode 100644 Master/texmf-dist/tex/lualatex/pgfmolbio/pgfmolbio.convert.tex create mode 100644 Master/texmf-dist/tex/lualatex/pgfmolbio/pgfmolbio.domains.lua create mode 100644 Master/texmf-dist/tex/lualatex/pgfmolbio/pgfmolbio.domains.tex (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/lualatex/pgfmolbio/README b/Master/texmf-dist/doc/lualatex/pgfmolbio/README index c2f28947af5..824c1ff68b8 100644 --- a/Master/texmf-dist/doc/lualatex/pgfmolbio/README +++ b/Master/texmf-dist/doc/lualatex/pgfmolbio/README @@ -1,13 +1,12 @@ -The pgfmolbio package +The pgfmolbio package v0.2 ------------------------------------------------------------------------------ This package is released under the LaTeX Project Public License v1.3c or later (see http://www.latex-project.org/lppl.txt). The experimental package pgfmolbio draws graphs typically found in -molecular biology texts. Currently, the package contains one module, -which creates DNA sequencing chromatograms from files in standard -chromatogram format (scf). +molecular biology texts. Currently, the package contains modules +for drawing DNA sequencing chromatograms and protein domain diagrams. The package requires pgf/TikZ (http://tug.ctan.org/pkg/pgf) and LuaTeX (http://www.luatex.org). @@ -16,4 +15,4 @@ Installation: Run pgfmolbio.ins through LaTeX and follow the instructions. -- Wolfgang Skala -September 20th, 2011 +October 1st, 2012 diff --git a/Master/texmf-dist/doc/lualatex/pgfmolbio/SampleGff.gff b/Master/texmf-dist/doc/lualatex/pgfmolbio/SampleGff.gff new file mode 100644 index 00000000000..0c6754989fe --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pgfmolbio/SampleGff.gff @@ -0,0 +1,14 @@ +##gff-version 3 +##sequence-region TestProtein 1 200 +TestProtein TheDatabase disulfide 5 45 . . . Disulfide 1 +TestProtein TheDatabase disulfide 30 122 . . . Disulfide 2 +TestProtein TheDatabase disulfide 51 99 . . . Disulfide 3 +TestProtein TheDatabase domain 10 40 . . . Domain 1 +TestProtein TheDatabase domain 60 120 . . . Domain 2 +TestProtein TheDatabase domain 135 178 . . . Domain 3 +TestProtein TheDatabase beta strand 15 23 . . . Strand 1 +TestProtein TheDatabase beta strand 25 32 . . . Strand 2 +TestProtein TheDatabase alpha helix 60 75 . . . Helix 1 +TestProtein TheDatabase alpha helix 80 108 . . . Helix 1 +TestProtein TheDatabase carbohydrate 151 151 . . . Sugar 1 +TestProtein TheDatabase carbohydrate 183 183 . . . Sugar 2 \ No newline at end of file diff --git a/Master/texmf-dist/doc/lualatex/pgfmolbio/SampleUniprot.txt b/Master/texmf-dist/doc/lualatex/pgfmolbio/SampleUniprot.txt new file mode 100644 index 00000000000..ca0f6b98eca --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pgfmolbio/SampleUniprot.txt @@ -0,0 +1,19 @@ +ID TestProtein Reviewed; 200 AA. +FT DISULFID 5 45 Disulfide 1 +FT DISULFID 30 122 Disulfide 2 +FT DISULFID 51 99 Disulfide 3 +FT DOMAIN 10 40 Domain 1 +FT DOMAIN 60 120 Domain 2 +FT DOMAIN 135 178 Domain 3 +FT STRAND 15 23 Strand 1 +FT STRAND 25 32 Strand 2 +FT HELIX 60 75 Helix 1 +FT HELIX 80 108 Helix 2 +FT CARBOHYD 151 151 Sugar 1 +FT CARBOHYD 183 183 Sugar 2 +SQ SEQUENCE 200 AA; 22041 MW; 00A52FE2EC5431D9 CRC64; + MGSKRSVPSR HRSLTTYEVM FAVLFVILVA LCAGLIAVSW LSIQGSVKDA AFGKSHEARG + TLKIISGATY NPHLQDKLSV DFKVLAFDIQ QMIDDIFQSS NLKNEYKNSR VLQFENGSII + VIFDLLFDQW VSDKNVKEEL IQGIEANKSS QLVTFHIDLN SIDITASLEN FSTISPATTS + EKLTTSIPLA TPGNVSIECP +// \ No newline at end of file diff --git a/Master/texmf-dist/doc/lualatex/pgfmolbio/pgfmolbio.lua b/Master/texmf-dist/doc/lualatex/pgfmolbio/pgfmolbio.lua new file mode 100644 index 00000000000..2fe66b4090f --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pgfmolbio/pgfmolbio.lua @@ -0,0 +1,80 @@ +-- +-- This is file `pgfmolbio.lua', +-- generated with the docstrip utility. +-- +-- The original source files were: +-- +-- pgfmolbio.dtx (with options: `pgfmolbio-lua') +-- +-- Copyright (C) 2012 by Wolfgang Skala +-- +-- This work may be distributed and/or modified under the +-- conditions of the LaTeX Project Public License, either version 1.3 +-- of this license or (at your option) any later version. +-- The latest version of this license is in +-- http://www.latex-project.org/lppl.txt +-- and version 1.3 or later is part of all distributions of LaTeX +-- version 2005/12/01 or later. +-- +module("pgfmolbio", package.seeall) + + +if luatexbase then + luatexbase.provides_module({ + name = "pgfmolbio", + version = 0.2, + date = "2012/10/01", + description = "Molecular biology graphs wit LuaLaTeX", + author = "Wolfgang Skala", + copyright = "Wolfgang Skala", + license = "LPPL", + }) +end + +local coordUnit, coordFmtStr + +function setCoordinateFormat(unit, fmtString) + coordUnit = unit + coordFmtStr = fmtString +end + +function stringToDim(x) + if type(x) == "string" then + return dimen(x)[1] + end +end + +function dimToString(x) + return number.todimen(x, coordUnit, coordFmtStr) +end + +function getRange(rangeInput, ...) + if type(rangeInput) ~= "string" then return end + local result = {} + for _, v in ipairs(arg) do + if type(v) ~= "string" then return end + table.insert(result, rangeInput:match(v)) + end + return unpack(result) +end + +function packageWarning(message) + tex.sprint("\\PackageWarning{pgfmolbio}{" .. message .. "}") +end + +function packageError(message) + tex.error("Package pgfmolbio Error: " .. message) + errorCatched = true +end + +errorCatched = false + +if not string.trim then + string.trim = function(self) + return self:match("^%s*(.-)%s*$") + end +end + +outputFileId = 0 +-- +-- End of file `pgfmolbio.lua'. diff --git a/Master/texmf-dist/doc/lualatex/pgfmolbio/pgfmolbio.pdf b/Master/texmf-dist/doc/lualatex/pgfmolbio/pgfmolbio.pdf index 749c9ec9341..f64765d15a0 100644 Binary files a/Master/texmf-dist/doc/lualatex/pgfmolbio/pgfmolbio.pdf and b/Master/texmf-dist/doc/lualatex/pgfmolbio/pgfmolbio.pdf differ diff --git a/Master/texmf-dist/source/lualatex/pgfmolbio/pgfmolbio.dtx b/Master/texmf-dist/source/lualatex/pgfmolbio/pgfmolbio.dtx index ef1a7e930d6..95c27940ce2 100644 --- a/Master/texmf-dist/source/lualatex/pgfmolbio/pgfmolbio.dtx +++ b/Master/texmf-dist/source/lualatex/pgfmolbio/pgfmolbio.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2011 by Wolfgang Skala +% Copyright (C) 2012 by Wolfgang Skala % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -13,22 +13,26 @@ % \fi % % \iffalse -%\ProvidesPackage{pgfmolbio}[2011/09/20 v0.1 Molecular biology graphs with TikZ] -%\NeedsTeXFormat{LaTeX2e}[1999/12/01] -%\ProvidesFile{pgfmolbio.chromatogram.tex}[2011/09/20 v0.1 SCF Chromatograms] +%\ProvidesPackage{pgfmolbio}[2012/10/01 v0.2 Molecular biology graphs with TikZ] +%\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%module("pgfmolbio", package.seeall) +%\ProvidesFile{pgfmolbio.chromatogram.tex}[2012/10/01 v0.2 SCF chromatograms] %module("pgfmolbio.chromatogram", package.seeall) +%\ProvidesFile{pgfmolbio.domains.tex}[2012/10/01 v0.2 Protein domains] +%module("pgfmolbio.domains", package.seeall) +%\ProvidesFile{pgfmolbio.convert.tex}[2012/10/01 v0.2 pgfmolbio graph conversion] % %<*driver> \documentclass[captions=tableheading,cleardoublepage=empty,titlepage=false]{scrreprt} \setkomafont{title}{\rmfamily\bfseries} \addtokomafont{sectioning}{\rmfamily} -\usepackage[english]{babel} - \frenchspacing +\usepackage[ngerman,english]{babel} \usepackage[hdivide={2cm,*,5cm}]{geometry} \usepackage{fontspec} -\usepackage[dvipsnames]{xcolor} -\usepackage{array,booktabs} +\usepackage{array,booktabs,tabularx} +\usepackage[chromatogram,domains]{pgfmolbio} + \usetikzlibrary{patterns,backgrounds,decorations.pathreplacing} \usepackage{ydoc-doc,ydoc-code,ydoc-desc,ydoc-expl} \AlsoImplementation @@ -42,18 +46,18 @@ pdfhighlight=/N,% } \AtBeginDocument{% - \lstMakeShortInline[style=latex-expl,basicstyle=\ttfamily]|% - \lstMakeShortInline[style=lua-doc,basicstyle=\ttfamily,frame=none]§% + \lstMakeShortInline[style=latex-expl,basicstyle=\ttfamily,numbers=none,firstnumber=last]|% + \lstMakeShortInline[style=lua-doc,basicstyle=\ttfamily,frame=none,numbers=none]§% } \makeatletter - \def\DescribeOption#1#2{% - \gdef\OptDefault{\textcolor{black!50}{Default:}~\texttt{#2}}% + \newcommand\DescribeOption[4][=]{% + \gdef\OptDefault{\textcolor{black!50}{Default:}~\texttt{#4}}% \DescribeMacros \let\DescribeMacros\y@egroup \optionalon \def\after@Macro@args{\y@egroup\PrintOptions\endgroup}% \hbox\y@bgroup - \texttt{\textcolor{opt}{#1}~=}% + \texttt{\textcolor{opt!50}{/pgfmolbio/#2}\textcolor{opt}{#3}~#1}% \ydoc@macrocatcodes \macroargsstyle \read@Macro@arg% @@ -104,15 +108,25 @@ \fi \endgroup } + \newcommand\DescribeFeature{\@ifstar\DescribeFeatureNoAlias\DescribeFeatureAlias} + \newcommand\DescribeFeatureAlias[2]{\paragraph{Feature \texttt{#1}} (\textit{alias} \texttt{#2})\\} + \newcommand\DescribeFeatureNoAlias[1]{\paragraph{Feature \texttt{#1}} (\textit{no alias})\\} \makeatother \def\ometa#1{{\optional\meta{#1}}} \lstdefinestyle{exampleextract}{gobble=2} + \lstdefinestyle{examplecode}{style=latex-expl} \def\ydoclistingssettings{\lstset{style=latex-expl}} \definecolor{opt}{named}{OliveGreen} + \definecolor{mod}{named}{black} + \definecolor{macrodesc}{named}{ProcessBlue} + \definecolor{macroimpl}{named}{ProcessBlue} + \newcommand\module[1]{\textsf{\textcolor{mod}{#1}}} + \renewcommand*\optstyle[1]{\texttt{\textcolor{opt}{#1}}} \lstdefinestyle{latex-expl}{ language=[AlLaTeX]TeX, columns=fullflexible, + keepspaces=true, tabsize=2, numbers=left, numberstyle=\sffamily\tiny\color{gray}, @@ -123,31 +137,40 @@ texcsstyle=*\color{MidnightBlue}, texcsstyle=*[2]\color{ProcessBlue}, keywordstyle=\color{RedOrange}, - emphstyle=\color{opt}, commentstyle=\itshape\color{black!50}, - morekeywords={tikzpicture}, + morekeywords={tikzpicture,pgfinterruptboundingbox,pgfinterruptpicture,pmbdomains,scope}, moretexcs=[1]{ - @empty,@ifundefined,definecolor,directlua,draw, - pgfkeys,pgfkeysdef,pgfqkeys,ProcessOptions,RequireLuaModule, - useasboundingbox,usetikzlibrary + @empty,@ifundefined,@nameuse,clip,colorlet,definecolor,directlua,draw,ifluatex, + luaescapestring,node,path,pdfdraftmode,pgf@protocolsizes,pgf@x,pgf@y,pgfdeclareverticalshading, + pgfkeys,pgfkeysalso,pgfkeysdef,pgfkeyssetvalue,pgfkeysvalueof,pgfmathsetmacro,pgfpoint,pgfqkeys, + ProcessOptions,RequireLuaModule,textcolor,tikzset,useasboundingbox,usetikzlibrary }, moretexcs=[2]{ - @pmb@chr@getkey,@pmb@chr@keydef,@pmb@chr@stylekeydef,pmb@chr@tikzpicturefalse,pmb@chr@tikzpicturetrue, - @pmb@getkey,@tempa,ifpmb@chr@showbasenumbers,ifpmb@chr@tikzpicture, - ifpmb@loadmodule@chromatogram,pgfmolbioset,pmb@loadmodule@chromatogramtrue,pmbchromatogram + @pmb@chr@getkey,@pmb@chr@keydef,@pmb@chr@stylekeydef, + @pmb@dom@feature@default@shape,@pmb@dom@helixsegment,@pmb@dom@helixhalfsegment,@pmb@dom@keydef, + @pmb@toksa,@pmb@toksb,@tempa,adddisulfidefeatures,addfeature,featureSequence,currentResidue, + pmb@chr@tikzpicturefalse,pmb@chr@tikzpicturetrue,ifpmb@chr@showbasenumbers,ifpmb@chr@tikzpicture, + ifpmb@con@includedescription,ifpmb@con@outputtikzcode,ifpmb@dom@showname,ifpmb@dom@showruler, + ifpmb@dom@showsecstructure,ifpmb@dom@tikzpicture,ifpmb@loadmodule@chromatogram,ifpmb@loadmodule@convert, + ifpmb@loadmodule@domains,inputuniprot,inputgff, + pgfmolbioset,pmb@con@outputtikzcodefalse,pmb@con@outputtikzcodetrue, + pmb@dom@addfeature,pmb@dom@inputgff,pmb@dom@inputuniprot,pmb@dom@tikzpicturetrue,pmb@dom@tikzpicturefalse, + pmb@loadmodule@chromatogramtrue,pmb@loadmodule@converttrue, + pmb@loadmodule@domainstrue,pmb@magnifiedsequence@width,pmbchromatogram,pmbdomdrawfeature, + pmbdomvalueof,pmbprotocolsizes,removedisulfidefeatures,removefeatureprintfunction, + residueNumber,setdisulfidefeatures,setfeaturealias, + setfeatureprintfunction,setfeatureshape,setfeatureshapealias,setfeaturestyle,setfeaturestylealias, + turnXradius,turnYradius,xLeft,xLowerLeft,xLowerRight,xMid,xRight,xUpperLeft,xUpperRight, + yLower,yMid,yShift,yUpper }, - emph={ - A,base,bases,baseline,C,canvas,coordinate, - distance,drawn,format,function,G,height, - label,labels,length,line,number,numbers,per, - probability,probabilities,range,sample,samples,show, - skip,string,style,T,text,tick,ticks,trace,traces,unit,x,y - } + escapebegin=\begin{rmfamily}\color{black!50}, + escapeend=\end{rmfamily} } \lstdefinestyle{latex-doc}{ style=latex-expl, - numbers=none, + showlines, + firstnumber=last, breaklines, frame=single, frameround=tttt, @@ -157,16 +180,21 @@ \lstdefinestyle{lua-doc}{ language=lua, columns=fullflexible, + keepspaces=true, tabsize=2, basicstyle=\ttfamily\small\color{ForestGreen}, keywordstyle=\color{MidnightBlue}, keywordstyle=[2]\color{ProcessBlue}, stringstyle=\color{Red}, identifierstyle=\color{Black}, - emphstyle=\color{Violet}, + emphstyle=\color{BurntOrange!50!Black}, showstringspaces=false, - numbers=none, + numbers=left, + numberstyle=\sffamily\tiny\color{gray}, + numbersep=5pt, + firstnumber=last, breaklines, + showlines, frame=single, frameround=tttt, rulecolor=\color{black!50}, @@ -177,43 +205,33 @@ morekeywords={and,break,do,else,elseif,end,false,for,function,if,in,local, nil,not,or,repeat,return,then,true,until,while}, morekeywords=[2]{arg,assert,collectgarbage,dofile,error,_G,format,getfenv, - getmetatable,ipairs,load,loadfile,loadstring,next,pairs,pcall,print, - rawequal,rawget,rawset,select,setfenv,setmetatable,tonumber,tostring, + getmetatable,__index,ipairs,load,loadfile,loadstring,next,pairs,pcall,print, + rawequal,rawget,rawset,select,self,setfenv,setmetatable,tonumber,tostring,__tostring, type,unpack,_VERSION,xpcall}, - morekeywords=[2]{coroutine.create,coroutine.resume,coroutine.running, - coroutine.status,coroutine.wrap,coroutine.yield}, - morekeywords=[2]{module,require,package.cpath,package.load,package.loaded, - package.loaders,package.loadlib,package.path,package.preload, - package.seeall}, - morekeywords=[2]{string.byte,string.char,string.dump,string.find, - string.format,string.gmatch,string,gsub,string.len,string.lower, - string.match,string.rep,string.reverse,string.sub,string.upper}, - morekeywords=[2]{table.concat,table.insert,table.maxn,table.remove, - table.sort}, - morekeywords=[2]{math.abs,math.acos,math.asin,math.atan,math.atan2, - math.ceil,math.cos,math.cosh,math.deg,math.exp,math.floor,math.fmod, - math.frexp,math.huge,math.ldexp,math.log,math.log10,math.max,math.min, - math.modf,math.pi,math.pow,math.rad,math.random,math.randomseed,math.sin, - math.sinh,math.sqrt,math.tan,math.tanh}, - morekeywords=[2]{io.close,io.flush,io.input,io.lines,io.open,io.output, - io.popen,io.read,io.tmpfile,io.type,io.write,file:close,file:flush, - file:lines,file:read,file:seek,file:setvbuf,file:write}, + morekeywords=[2]{module,require,package,seeall}, + morekeywords=[2]{string,byte,char,dump,find, + format,gmatch,string,gsub,len,lower, + match,rep,reverse,sub,trim,upper}, + morekeywords=[2]{table,concat,insert,maxn,remove,sort}, + morekeywords=[2]{math,min}, + morekeywords=[2]{io,input,open,output,close,flush, + lines,read,seek,setvbuf,write}, morekeywords=[2]{os.clock,os.date,os.difftime,os.execute,os.exit,os.getenv, os.remove,os.rename,os.setlocale,os.time,os.tmpname}, - morekeywords=[2]{tex.error,tex.sprint}, - emph={baseToSampleIndex,evaluateScfFile,findBasesInStr, - getMinMaxProbability,getRange,printTikzChromatogram, - readInt,readScfFile,setParameters,stdProbStyle}, + morekeywords=[2]{tex,sprint}, + emph={addFeature,aliasFeatureStyle,calculateDisulfideLevels,Chromatogram,clearKeys,dimToString,findBasesInStr, + getBaseKey,getMinMaxProbability,getParameters,getRange,getSampleAndPeakIndex,new,packageError, + packageWarning,printSequenceFeature,printHelixFeature,printTikzChromatogram,printTikzDomains,Protein, + readGffFile,readInt,readScfFile,readUniprotFile,selectStyleFromList,setCoordinateFormat, + setFeatureStyle,setKeys,setParameters,SpecialKeys,stdProbStyle,stringToDim,toAbsoluteResidueNumber}, sensitive=true, - alsoletter={.:0123456789}, + alsoletter={0123456789}, morecomment=[l]{--}, morecomment=[s]{--[[}{]]--}, morestring=[b]{"}, morestring=[d]{'} } -\lstset{style=latex-expl} - \def\TikZ{Ti\textit{k}Z} \usepackage{caption} @@ -221,9 +239,6 @@ \makeatletter\@addtoreset{example}{chapter}\makeatother \renewcommand\theexample{\arabic{chapter}.\arabic{example}} -\usepackage[chromatogram]{pgfmolbio} -\usetikzlibrary{decorations.pathreplacing} - \pdfpageattr{/Group <>} @@ -254,7 +269,7 @@ % % \GetFileInfo{pgfmolbio.sty} % -% \CheckSum{175} +% \CheckSum{1254} % % \pagenumbering{roman} % \title{The \texttt{pgfmolbio} package --\texorpdfstring{\\}{}Molecular Biology Graphs with \TikZ\texorpdfstring{\footnote{This document describes version \fileversion, dated \filedate.}}{}} @@ -263,56 +278,72 @@ % \maketitle % % \begin{abstract} -% The experimental package \pkg{pgfmolbio} draws graphs typically found in molecular biology texts. Currently, the package contains one module, which creates DNA sequencing chromatograms from files in standard chromatogram format (\file{scf}). Since \file{scf} files are binary, \pkg{pgfmolbio} relies on the Lua\TeX\ engine for converting information from these files into \TikZ\ drawing commands. +% The experimental package \pkg{pgfmolbio} draws graphs typically found in molecular biology texts. Currently, the package contains three modules: \module{chromatogram} creates DNA sequencing chromatograms from files in standard chromatogram format (\file{scf}); \module{domains} draws protein domain diagrams; \module{convert} integrates \pkg{pgfmolbio} with \TeX\ engines that lack Lua support. % \end{abstract} % % \tableofcontents % % % \chapter{Introduction} +% \label{cha:Introduction} % \pagenumbering{arabic} % % % \section{About \texorpdfstring{\pkg{pgfmolbio}}{pgfmolbio}} +% \label{sec:IntroAbout} % % Over the decades, \TeX\ has gained popularity across a large number of disciplines. Although originally designed as a mere typesetting system, packages such as \pkg{pgf}\footnote{Tantau, T. (2010). The \TikZ\ and \textsc{pgf} packages. \url{http://ctan.org/tex-archive/graphics/pgf/}.} and \pkg{pstricks}\footnote{van Zandt, T., Niepraschk, R., and Voß, H. (2007). PSTricks: PostScript macros for Generic \TeX. \url{http://ctan.org/tex-archive/graphics/pstricks}.} have strongly extended its \textit{drawing} abilities. Thus, one can create complicated charts that perfectly integrate with the text. % -% Texts on molecular biology include a range of special graphs, e.\,g. multiple sequence alignments, membrane protein topologies, DNA sequencing chromatograms, plasmid maps, protein domain diagrams and others. The \pkg{texshade}\footnote{Beitz, E. (2000). \TeX shade: shading and labeling multiple sequence alignments using \LaTeXe. \textit{Bioinformatics}~\textbf{16}(2), 135--139.\\\url{http://ctan.org/tex-archive/macros/latex/contrib/texshade}.} and \pkg{textopo}\footnote{Beitz, E. (2000). \TeX topo: shaded membrane protein topology plots in \LaTeXe. \textit{Bioinformatics} \textbf{16}(11), 1050--1051.\\\url{http://ctan.org/tex-archive/macros/latex/contrib/textopo}.} packages cover alignments and topologies, respectively, but packages dedicated to the remaining graphs are absent. Admittedly, one may create those images with various external programs and then include them in the \TeX\ document. Nevertheless, purists (like the author of this document) might prefer a \TeX-based approach. +% Texts on molecular biology include a range of special graphs, e.\,g. multiple sequence alignments, membrane protein topologies, DNA sequencing chromatograms, protein domain diagrams, plasmid maps and others. The \pkg{texshade}\footnote{Beitz, E. (2000). \TeX shade: shading and labeling multiple sequence alignments using \LaTeXe. \textit{Bioinformatics}~\textbf{16}(2), 135--139.\\\url{http://ctan.org/tex-archive/macros/latex/contrib/texshade}.} and \pkg{textopo}\footnote{Beitz, E. (2000). \TeX topo: shaded membrane protein topology plots in \LaTeXe. \textit{Bioinformatics} \textbf{16}(11), 1050--1051.\\\url{http://ctan.org/tex-archive/macros/latex/contrib/textopo}.} packages cover alignments and topologies, respectively, but packages dedicated to the remaining graphs are absent. Admittedly, one may create those images with various external programs and then include them in the \TeX\ document. Nevertheless, purists (like the author of this document) might prefer a \TeX-based approach. % -% The \pkg{pgfmolbio} package aims at becoming such a purist solution. In its first development release, \pkg{pgfmolbio} is able to read DNA sequencing files in standard chromatogram format (\file{.scf}) and draw the corresponding chromatogram using routines from \pkg{pgf}'s \TikZ\ frontend. In order to convert the data from the \file{scf} input file to an image, \pkg{pgfmolbio} relies on the Lua scripting language implemented in Lua\TeX. Consequently, the package will not work with traditional engines like pdf\TeX. +% The \pkg{pgfmolbio} package aims at becoming such a purist solution. In the current development release, \pkg{pgfmolbio} is able to +% \begin{itemize} +% \item read DNA sequencing files in standard chromatogram format (\file{scf}) and draw the corresponding chromatogram; +% \item read protein domain information from Uniprot or general feature format files (\file{gff}) and draw domain diagrams. +% \end{itemize} +% To this end, \pkg{pgfmolbio} relies on routines from \pkg{pgf}'s \TikZ\ frontend and on the Lua scripting language implemented in Lua\TeX. Consequently, the package will not work directly with traditional engines like pdf\TeX. However, a converter module ensures a high degree of backward compatibility. % % Since this is a development release, \pkg{pgfmolbio} presumably includes a number of bugs, and its commands and features are likely to change in future versions. Moreover, the current version is far from complete, but since time is scarce, I am unable to predict when (and if) additional functions become available. Nevertheless, I would greatly appreciate any comments or suggestions. % % % \section{Getting Started} +% \label{sec:IntroGettingStarted} % -% Before you consider using \pkg{pgfmolbio}, please make sure that both your Lua\TeX\ (at least 0.70.1) and \pkg{pgf} (at least 2.10) installations are up-to-date. Once your \TeX\ system meets these requirements, just load \pkg{pgfmolbio} as usual, i.\,e. by +% Before you consider using \pkg{pgfmolbio}, please make sure that both your Lua\TeX\ (at least 0.70.2) and \pkg{pgf} (at least 2.10) installations are up-to-date. Once your \TeX\ system meets these requirements, just load \pkg{pgfmolbio} as usual, i.\,e. by % % \DescribeMacro\usepackage[]{pgfmolbio} % -% The package is divided into \textit{modules}, each of which produces a certain type of graph. Currently, only one \ometa{module} is available: \opt*{chromatogram} allows you to draw DNA sequencing chromatograms as obtained by the Sanger sequencing method. Thus, the only sensible way of including the package is currently |\usepackage[chromatogram]{pgfmolbio}|. +% The package is divided into \textit{modules}, each of which produces a certain type of graph. Currently, three \ometa{module}s are available: +% \begin{itemize} +% \item \module{chromatogram} (chapter~\ref{cha:Chromatogram}) allows you to draw DNA sequencing chromatograms obtained by the Sanger sequencing method. +% \item \module{domains} (chapter~\ref{cha:Domains}) provides macros for drawing protein domain diagrams and is also able to read domain information from files in Uniprot or general feature format. +% \item Furthermore, \module{convert} (chapter~\ref{cha:Convert}) is used with one of the modules above and generates ``pure'' \TikZ\ code suitable for \TeX\ engines lacking Lua support. +% \end{itemize} % % \DescribeMacro\pgfmolbioset[]{} -% The \meta{key-value list} in the mandatory argument of this command allows you to fine-tune the graphs produced by each {\optional\meta{module}} of \pkg{pgfmolbio}. The possible keys are described in the sections on the respective modules. +% Fine-tunes the graphs produced by each \pkg{pgfmolbio} module. The possible keys are described in the sections on the respective modules. % % % -% -% \chapter{The \texorpdfstring{\opt{chromatogram}}{chromatogram} module} +% +% \chapter{The \texorpdfstring{\module{chromatogram}}{chromatogram} module} +% \label{cha:Chromatogram} % % % \section{Overview} +% \label{sec:ChrOverview} % -% The \opt{chromatogram} module draws DNA sequencing chromatograms stored in standard chromatogram format (\file{scf}), which was developed by Simon Dear and Rodger Staden\footnote{Dear, S. and Staden, R. (1992). A standard file format for data from DNA sequencing instruments. \textit{DNA Seq.} \textbf{3}(2), 107--110.}. The documentation for the Staden package\footnote{\url{http://staden.sourceforge.net/}} describes the current version of the \file{scf} format in detail. As far as they are crucial to understanding the Lua code, we will discuss some details of this file format in the documented source code (section~\ref{sec:DocLuaScf}). Note that \pkg{pgfmolbio} only supports \file{scf} version 3.00. +% The \module{chromatogram} module draws DNA sequencing chromatograms stored in standard chromatogram format (\file{scf}), which was developed by Simon Dear and Rodger Staden\footnote{Dear, S. and Staden, R. (1992). A standard file format for data from DNA sequencing instruments. \textit{DNA Seq.} \textbf{3}(2), 107--110.}. The documentation for the Staden package\footnote{\url{http://staden.sourceforge.net/}} describes the current version of the \file{scf} format in detail. As far as they are crucial to understanding the Lua code, we will discuss some details of this file format in the documented source code (section~\ref{sec:DocChrLua}). Note that \pkg{pgfmolbio} only supports \file{scf} version 3.00. % % % \section{Drawing Chromatograms} +% \label{sec:ChrDrawingChromatograms} % % \DescribeMacro\pmbchromatogram[]{} -% The \opt{chromatogram} module defines a single command, which reads a chromatogram from an \meta{scf file} and draws it with routines from \TikZ\ (Example~\ref{exa:tikzpicture}). The options, which are set in the \ometa{key-value list}, configure the appearance of the chromatogram. The following sections will elaborate on the available keys. +% The \module{chromatogram} module defines a single command, which reads a chromatogram from an \meta{scf file} and draws it with routines from \TikZ\ (Example~\ref{exa:ChrTikzpicture}). The options, which are set in the \ometa{key-value list}, configure the appearance of the chromatogram. The following sections will elaborate on the available keys. % \begin{exampletable} % \caption{} -% \label{exa:tikzpicture} +% \label{exa:ChrTikzpicture} % \begin{examplecode} % \begin{tikzpicture} % optional % \pmbchromatogram{SampleScf.scf} @@ -324,83 +355,84 @@ % % % \section{Displaying Parts of the Chromatogram} -% \label{sec:DisplayingParts} +% \label{sec:ChrDisplayingParts} % -% \DescribeOption{sample range}{1 to 500 step 1}' to '[' step ']\relax -% |sample range| selects the part of the chromatogram which \pkg{pgfmolbio} should display. The value for this key consists of two or three parts, separated by the keywords |to| and |step|. The package will draw the chromatogram data between the \meta{lower} and \meta{upper} boundary. There are two ways of specifying these limits: +% \DescribeOption{chromatogram/}{sample range}{1-500 step 1}'-'[' step ']\relax +% \opt{sample range} selects the part of the chromatogram which \pkg{pgfmolbio} should display. The value for this key consists of two or three parts, separated by the keywords |-| and |step|. The package will draw the chromatogram data between the \meta{lower} and \meta{upper} boundary. There are two ways of specifying these limits: % \begin{enumerate} -% \item If you enter a number, \pkg{pgfmolbio} includes the data from the \meta{lower} to the \meta{upper} sample point (Example~\ref{exa:LimitsSamplePoints}). A \textit{sample point} represents one measurement of the fluorescence signal along the time axis, where the first sample point has index 1. One peak comprises about 20 sample points. +% \item If you enter a number, \pkg{pgfmolbio} includes the data from the \meta{lower} to the \meta{upper} sample point (Example~\ref{exa:ChrLimitsSamplePoints}). A \textit{sample point} represents one measurement of the fluorescence signal along the time axis, where the first sample point has index 1. One peak comprises about 20 sample points. % \begin{exampletable} % \caption{} -% \label{exa:LimitsSamplePoints} +% \label{exa:ChrLimitsSamplePoints} % \begin{examplecode} -% \pmbchromatogram[sample range=200 to 600]{SampleScf.scf} +% \pmbchromatogram[sample range=200-600]{SampleScf.scf} % \end{examplecode} % \end{exampletable} -% \item If you enter the keyword |base| followed by an optional space and a number, the chromatogram starts or stops at the peak corresponding to the respective base. The first detected base peak has index 1. Compare Examples~\ref{exa:LimitsSamplePoints} and~\ref{exa:LimitsBases} to see the difference. +% \item If you enter the keyword |base| followed by an optional space and a number, the chromatogram starts or stops at the peak corresponding to the respective base. The first detected base peak has index 1. Compare Examples~\ref{exa:ChrLimitsSamplePoints} and~\ref{exa:ChrLimitsBases} to see the difference. % \end{enumerate} -% The optional third part of the value for |sample range| orders the package to draw every \ometa{interval}th sample point. If your document contains large chromatograms or a great number of them, drawing fewer sample points increases typesetting time at the cost of image quality (Example~\ref{exa:SampleStep}). Nevertheless, the key may be especially useful while optimizing the layout of complex chromatograms. +% The optional third part of the value for \opt{sample range} orders the package to draw every \ometa{int}th sample point. If your document contains large chromatograms or a great number of them, drawing fewer sample points increases typesetting time at the cost of image quality (Example~\ref{exa:ChrSampleStep}). Nevertheless, the key may be especially useful while optimizing the layout of complex chromatograms. % % \begin{exampletable}[p] % \caption{} -% \label{exa:LimitsBases} +% \label{exa:ChrLimitsBases} % \begin{examplecode} % \pmbchromatogram[% -% sample range=base 50 to base60 +% sample range=base 50-base60 % ]{SampleScf.scf} % \end{examplecode} % \end{exampletable} % % \begin{exampletable}[p] % \caption{} -% \label{exa:SampleStep} +% \label{exa:ChrSampleStep} % \pgfmolbioset[chromatogram]{canvas height=1cm} % \begin{examplecode} % \pmbchromatogram[% -% sample range=base 20 to base 50 step 1 +% sample range=base 20-base 50 step 1 % ]{SampleScf.scf} % \end{examplecode} % \begin{examplecode} % \pmbchromatogram[% -% sample range=base 20 to base 50 step 2 +% sample range=base 20-base 50 step 2 % ]{SampleScf.scf} % \end{examplecode} % \begin{examplecode} % \pmbchromatogram[% -% sample range=base 20 to base 50 step 4 +% sample range=base 20-base 50 step 4 % ]{SampleScf.scf} % \end{examplecode} % \end{exampletable} % % % \section{General Layout} +% \label{sec:ChrGeneralLayout} % -% \DescribeOption{x unit}{0.2mm} -% \DescribeOption{y unit}{0.01mm} -% These keys set the horizontal distance between two consecutive sample points and the vertical distance between two fluorescence intensity values, respectively. Example~\ref{exa:xyunit} illustrates how you can enlarge a chromatogram twofold by doubling these values. +% \DescribeOption{chromatogram/}{x unit}{0.2mm} +% \DescribeOption{chromatogram/}{y unit}{0.01mm} +% These keys set the horizontal distance between two consecutive sample points and the vertical distance between two fluorescence intensity values, respectively. Example~\ref{exa:Chrxyunit} illustrates how you can enlarge a chromatogram twofold by doubling these values. % \begin{exampletable} % \caption{} -% \label{exa:xyunit} +% \label{exa:Chrxyunit} % \begin{examplecode} % \pmbchromatogram[% -% sample range=base 50 to base 60, +% sample range=base 50-base 60, % x unit=0.4mm, % y unit=0.02mm % ]{SampleScf.scf} % \end{examplecode} % \end{exampletable} -% \DescribeOption{samples per line}{500} -% \DescribeOption{baseline skip}{3cm} -% A new chromatogram ``line'' starts after \meta{number} sample points, and the baselines of adjacent lines (i.\,e., the $y$-value of fluorescence signals with zero intensity) are separated by \meta{dimension}. In Example~\ref{exa:SamplesPerLine}, you see two lines, each of which contains 250 of the 500 sample points drawn. Furthermore, the baselines are 3.5~cm apart. +% \DescribeOption{chromatogram/}{samples per line}{500} +% \DescribeOption{chromatogram/}{baseline skip}{3cm} +% A new chromatogram ``line'' starts after \meta{number} sample points, and the baselines of adjacent lines (i.\,e., the $y$-value of fluorescence signals with zero intensity) are separated by \meta{dimension}. In Example~\ref{exa:ChrSamplesPerLine}, you see two lines, each of which contains 250 of the 500 sample points drawn. Furthermore, the baselines are 3.5~cm apart. % \begin{exampletable} % \caption{} -% \label{exa:SamplesPerLine} +% \label{exa:ChrSamplesPerLine} % \begin{examplecode} % \begin{tikzpicture}% % [decoration=brace] % \pmbchromatogram[% -% sample range=401 to 900, +% sample range=401-900, % samples per line=250, % baseline skip=3.5cm % ]{SampleScf.scf} @@ -412,16 +444,17 @@ % \end{examplecode} % \end{exampletable} % -% \DescribeOption{canvas style}{draw=none, fill=none}