使用 TikZ 绘制酶

使用 TikZ 绘制酶

可以使用以下方法绘制如下图所示的图像TikZ 在此处输入图片描述或者任何其他 Latex 包?

答案1

我会用pics它。这可以让你一遍又一遍地画出同样的东西,可能有一些变化。在这个例子中,我使用

\draw (1.2,2.9) pic[rotate=25] {Enzyme B=3};

这里,Enzyme B是你的第二个酶,3意味着两个受体(?)都被填满了。如果我选​​择了01或者2没有,那么下面的一个或上面的一个就会被填满。(1.2,2.9)是坐标,正如你所见,你可以旋转pic(或对其进行其他变换,例如scale)。我留下了一些酶供你练习。;-) (编辑:使臀部的半径变得更小且可以调节。)

\documentclass[tikz, margin=3.14mm]{standalone} 
\pgfkeys{tikz/.cd,
bummy radius/.store in=\BummyRadius,
bummy radius=1.6mm
}
\tikzset{pics/.cd,
  Enzyme A/.style={
    code={
      \draw[thin,fill=green!30] (0.3,0) arc(90:270:0.15) -- (0.3,-0.3) to[out=-90,in=0] (0,-0.5)
      to[out=180,in=-90] (-0.3,-0.3) to (-0.3,0.3) to[out=90,in=180] (0,0.5)
      to[out=0,in=90] (0.3,0.3) arc(90:270:0.15) --cycle;
      \ifnum#1=1
       \fill[red!80] (1.1mm+\BummyRadius,-0.21) circle (\BummyRadius) (1.1mm+2.8*\BummyRadius,-0.21) circle (\BummyRadius);
      \fi 
      \ifnum#1=2
       \fill[red!80] (1.1mm+\BummyRadius,0.21) circle (\BummyRadius) (1.1mm+2.8*\BummyRadius,0.21) circle (\BummyRadius);
      \fi 
      \ifnum#1=3
       \fill[red!80] (1.1mm+\BummyRadius,-0.21) circle (\BummyRadius) (1.1mm+2.8*\BummyRadius,-0.21) circle (\BummyRadius);
       \fill[red!80] (1.1mm+\BummyRadius,0.21) circle (\BummyRadius) (1.1mm+2.8*\BummyRadius,0.21) circle (\BummyRadius);
      \fi 
    } 
  },
  Enzyme B/.style={
     code={
       \draw[thin,fill=green!30] (0.3,-0.02) -- (0.1,-0.02) |- (0.3,-0.4)
      |- (-0.3,-0.5) |- (0.3,0.5) |- (0.1,0.4) |- (0.3,0.02) -- cycle;
      \ifnum#1=1
       \fill[red!80] (1.1mm+\BummyRadius,-0.21) circle (\BummyRadius) (1.1mm+2.8*\BummyRadius,-0.21) circle (\BummyRadius);
      \fi 
      \ifnum#1=2
       \fill[red!80] (1.1mm+\BummyRadius,0.21) circle (\BummyRadius) (1.1mm+2.8*\BummyRadius,0.21) circle (\BummyRadius);
      \fi 
      \ifnum#1=3
       \fill[red!80] (1.1mm+\BummyRadius,-0.21) circle (\BummyRadius) (1.1mm+2.8*\BummyRadius,-0.21) circle (\BummyRadius);
       \fill[red!80] (1.1mm+\BummyRadius,0.21) circle (\BummyRadius) (1.1mm+2.8*\BummyRadius,0.21) circle (\BummyRadius);
      \fi 
     }
   },
} 

\begin{document}
\begin{tikzpicture}
\draw[blue!40,ultra thick] plot[domain=-7.5:7.5,variable=\x,smooth,samples=50]
(\x,{tanh(\x/1.5)+3*exp(-0.5*\x*\x)});
\foreach \X in {-2.5,2.5}
{\draw[thick,dashed] (\X,-1) -- (\X,8);}
% left panel
\foreach \X in {0,1.5}
{\foreach \Y in {1,...,5}
{\draw (\X-7+0.1*rand,1.5*\Y+0.1*rand) pic[rotate=rand*20] {Enzyme A=0};}}
\draw (-3.3,6.8) pic[rotate=rand*20] {Enzyme B=0};
\draw (-3.4,5.3) pic[rotate=rand*20] {Enzyme B=0};
% middle
\foreach \X in {0,1.25}
{\foreach \Y [evaluate=\Y as \Z using {int(5-\Y)}]in {3,4,5}
{\draw (\X-2+0.1*rand,1.5*\Y+0.1*rand) pic[rotate=rand*20] {Enzyme A=\Z};}}
\draw (-1.2,2.8) pic {Enzyme A=3};
\foreach \X in {0,1.25}
{\foreach \Y [evaluate=\Y as \Z using {int(5-\Y)}]in {3,4,5}
{\draw (\X+0.75+0.1*rand,1.5*\Y+0.1*rand) pic[rotate=rand*20] {Enzyme B=\Z};}}
\draw (1.2,2.9) pic[rotate=25] {Enzyme B=3};
% right panel
\foreach \X in {0,1.5}
{\foreach \Y in {1,...,5}
{\draw (\X+5.5+0.1*rand,1.25*\Y+1+0.1*rand) pic[rotate=rand*20] {Enzyme B=3};}}
\draw (3.3,6.8) pic[rotate=rand*20] {Enzyme A=3};
\draw (3.4,5.3) pic[rotate=rand*20] {Enzyme A=3};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

只是为了好玩,并认识到土拨鼠的代码确实很实用,该版本具有其他需要手动定位的选项,以使结果尽可能接近示例;酶具有源自土拨鼠答案的条件部分,但这些部分用 0 或 1 激活或停用,以避免定义 4 种状态。

结果: 在此处输入图片描述

梅威瑟:

\documentclass[border=0pt]{standalone}
\usepackage{tikz}
\definecolor{mygreen}{HTML}{BED395}
\definecolor{myblue}{HTML}{87ABEC}
\definecolor{linegreen}{HTML}{989F7F}
\definecolor{color1}{HTML}{DFD8C8}
\begin{document}
\pagecolor{color1}
    \begin{tikzpicture}
    \def\activator(#1){
        \begin{scope}[shift={(#1)}]
        \draw[line width=1pt,linegreen,fill=red](0,0)
            arc (180:40:0.15) arc (140:0:0.15) arc (0:-140:0.15) arc (-40:-180:0.15);
        \end{scope}

    }
    \def\enzymeA(#1)[#2]#3#4{
        \begin{scope}[shift={(#1)},rotate=#2]
        \draw[linegreen,fill=mygreen,line width=1pt]    (-0.5,0.76)
            -| ++ (1,-0.3) -| ++ (-0.4,-0.4) -| ++ (0.4,-0.12) -| ++ (-0.4,-0.4) -| ++ (0.4,-0.3) -| cycle;
            \ifnum#3=1 \activator(0.3,0.26) \fi
            \ifnum#4=1 \activator(0.3,-0.26) \fi
        \end{scope}
    }

    \def\enzymeB(#1)[#2]#3#4{
        \begin{scope}[shift={(#1)},rotate=#2]
        \draw[linegreen,fill=mygreen,line width=1pt](-0.5,0.76-0.3)
            arc (180:90:0.3) -- ++ (0.4,0) arc (90:0:0.3) arc (90:270:0.22) -- ++ (0,-0.05) arc (90:270:0.22) 
            arc (0:-90:0.3) -- ++ (-0.4,0) arc (-90:-180:0.3) -| cycle;
            \ifnum#3=1 \activator(0.4,0.24) \fi
            \ifnum#4=1 \activator(0.4,-0.25) \fi
        \end{scope}
    }
    %Start drawing the thing
    \draw[myblue,line width=3pt]
    (1.5,0) 
        to [out=0, in=180,out looseness=1.8,in looseness=0.4] ++(9,6)
        to [out=0, in=180,out looseness=0.4,in looseness=2] ++(9,-4);
    \draw[dash pattern = on 10pt off 10pt, very thick](0,0)++(6,0) -- ++(0,14);
    \draw[dash pattern = on 10pt off 10pt, very thick](6,0)++(9,0) -- ++(0,14);
    %Draw void enzymes B
    \foreach \x/\y/\rotation in {
        0/4/-5,
        1.5/5/10,
        3/4/10,
        0.2/6/-15, 
        2/7/10,
        3.5/6/-15,
        0.2/8/5,
        1.5/9/5,
        0.1/10/-10,
        1.5/11/26,
        0.2/12/-10,
        1.7/13/10,
        7/12/26,
        9/13/-10
        }
    {
        \enzymeB(\x,\y)[\rotation]{0}{0}
    }
    %Draw activated enzymes B
    \foreach \x/\y/\rotation in {
        8/6/-20,
        16/10/15,
        16/12/-15
        }
    {
        \enzymeB(\x,\y)[\rotation]{1}{1}
    }
    %Draw void enzymes A
    \foreach \x/\y/\rotation in {
        5/9/10,
        4.5/11/-5,
        13/13/-15
        }
    {
        \enzymeA(\x,\y)[\rotation]{0}{0}
    }
    %Draw activated enzymes A
    \foreach \x/\y/\rotation in {
        20/3.5/-15,
        18.2/3.5/26,
        20/5.4/15,
        18.5/5.4/10,
        19.2/7.3/-5,
        17.7/7.1/-5,
        19.7/9.1/-15,
        18/9/10,
        20./11/15,
        18.2/11/-5,
        20/13/15,
        18.2/13/-15,
        14/5.4/-10,
        12.5/6.2/26
        }
    {
        \enzymeA(\x,\y)[\rotation]{1}{1}
    }
    %Incomplete activation enzymes
    \enzymeB(7,8)[26]{0}{1}
    \enzymeB(7,10)[-15]{0}{1}
    \enzymeB(9,8.5)[15]{1}{0}
    \enzymeB(9,10.5)[-15]{0}{1}
    \enzymeA(12,11)[15]{1}{0}
    \enzymeA(14,11)[-15]{0}{1}
    \enzymeA(12,8.5)[15]{1}{0}
    \enzymeA(14,8.5)[-26]{0}{1}
    \end{tikzpicture}

\end{document}

答案3

因为这只是一个非常简短的回答,所以这里只列出必要的“样式”:

\documentclass[border=5pt,tikz]{standalone}
\begin{document}
    \begin{tikzpicture}[green!70!black]
        \begin{scope}[rotate=75]
            \draw (0,0) arc(0:180:.5);
            \draw (1,0) arc(0:180:.5);
                \draw (-1.5,.5) arc(180:270:.5);
                \draw (-1.5,.5) --+ (0,.5) arc(-180:-270:.5) --+ (2,0);
                \draw (1.5,1) arc(0:90:.5);
            \draw (1.5,1) --+ (0,-.5) arc(0:-90:.5);
        \end{scope}
        \fill[yshift=-4cm,xshift=-1.7cm,green!70!black!50] (0,2) -- (0,0) --+ (1.5,0) --+ (1.5,.3) --+ (1.1,.3) --+ (1.1,.9) --+ (1.5,.9) --+ (1.5,1) -- (1.1,1) --+ (0,.7) --+ (.4,.7) --+ (.4,1) -- cycle;
        \begin{scope}[xshift=-1.2cm,yshift=-5cm]
            \draw[very thick,red!70!black,fill=red!70!black!80] (0,0) circle(.5);
            \draw[very thick,red!70!black,fill=red!70!black!80] (.5,0) circle(.5);
                \draw[red!70!black!80,fill=red!70!black!80] (0,0) circle(.5);
                \draw[red!70!black!80,fill=red!70!black!80] (.5,0) circle(.5);
        \end{scope}
    \end{tikzpicture}
\end{document}

输出如下:

截屏

相关内容