1. 结果

1. 结果

核小体是细胞中 DNA 包装的基本单位,我正在尝试生成一些图形,供手稿和演示文稿中经常使用。核小体通常以两种方式抽象成图画。一种表示法是维基百科 维基百科用户 Darekk2 创作的创意共享核小体图像

画成八个球体的核心(代表核心组蛋白八聚体),有两圈 DNA 和第九个组蛋白(H1)。有时蛋白质被进一步抽象为圆柱体或单个球体,以便可以说明几个相邻的核小体包装 DNA。这就是我想要实现的。圆柱体经常是倾斜的,就像在这个极其贫乏的 tikz 尝试中一样。我很高兴保留多个组蛋白,但这可能太有挑战性了。

 \documentclass{standalone}
 \usepackage {tikz}
 \usetikzlibrary{shapes}
 \begin {document}
 \tikzset{nucleosome core/.style={cylinder, 
     rotate=30,shape aspect=0.5,minimum width=1cm,
     minimum height=0.7cm, cylinder uses custom fill,
     cylinder end fill=red!50,cylinder body fill=red!25}}
 \begin{tikzpicture}
 \foreach \i in {0,2,4,6} { 
   \path node [nucleosome core] at (\i,0) {} edge [bend right] (\i + 1.7,0);
 }
   \end{tikzpicture}
 \end{document}

核小体

在这里,连接相邻核小体的 DNA 很明显,但它缺少 DNA 包裹,而这非常重要,因为这就是核小体

我认为要获得类似 Wikipedia 版本的效果,我需要使用 pstricks,尽管我通常使用 tikz 制作图形,并且愿意用 3D 真实感换取熟悉感。至少,我希望我的 cylinder-tikz 版本包含包装。

[编辑:我之所以添加悬赏,是因为虽然我认识到这个特定问题可能对 TeX.SX 社区的吸引力有限,但我认为我会从比我目前最好的努力中学到很多东西。如果需要更多灵感,这里是一些圆柱形核小体的例子,并且这里具有表观遗传标记修饰核小体。]

答案1

绝对不是完美的,并且它大多数可以/应该被参数化(并且“frontwrapping”层可以说是不必要的):

\documentclass{article}
\usepackage{tikz}

\begin{document}

\pgfdeclarelayer{backwrapping}
\pgfdeclarelayer{frontwrapping}
\pgfsetlayers{backwrapping,main,frontwrapping}

\tikzset{
    wrapping/.style={
        draw=black!60, 
        line cap=round, 
        line join=round, 
        ultra thick},
    nucleosome/.style={
        fill=red!40, 
        fill opacity=.9, 
        draw=none},
    top cylinder/.style={
        fill=red!60, 
        fill opacity=.9
    }
}


\begin{tikzpicture}[scale=0.75]

\foreach \q [remember=\q as \p] in {1, 2, 3, 4}{

\begin{scope}[shift={(\q*3,0)}, rotate=30]
\path [nucleosome] 
    (0,1) 
    arc (90:270:0.375 and 1) -- (1.25,-1) 
    arc (270:90:0.375 and 1) -- cycle;
\path [top cylinder] 
    (1.625, 0) arc (0:360:0.375 and 1) -- cycle;

\begin{scope}[shift={(0.25,0)}]
\begin{pgfonlayer}{backwrapping}
\draw [wrapping] 
    (0.25, -1.125) 
    \foreach \i in {180,185,...,360}{ -- (\i/720+0.375*sin -\i, 1.125*cos \i)};
\draw [wrapping] (0, 1.125)  arc(90:0:0.125cm and 0.25cm) arc(0:-90:1cm and 1cm) coordinate (wrapping-start-\q);
\end{pgfonlayer}

\begin{pgfonlayer}{frontwrapping}
\draw [wrapping] 
    (0, 1.125)  
    \foreach \i in {0,5,...,180}{ -- (\i/720+0.375*sin -\i,1.125*cos \i)}
    [shift={(0.5,0)}]
    (0, 1.125) 
    \foreach \i in {0,5,...,150}{ -- (\i/720+0.375*sin -\i,1.125*cos \i)} coordinate (wrapping-end-\q);
\end{pgfonlayer}
\end{scope}
\ifnum\q>1
    \draw [wrapping] (wrapping-end-\p) .. controls ++(-60:0.5cm)  and ++(180:0.25cm) .. (wrapping-start-\q);
\fi
\ifnum\q=4
\draw [wrapping] (wrapping-end-\q) arc (210:270:1cm and 0.75cm);
\fi
\end{scope}
}

\end{tikzpicture}

\end{document}

我无法发布图片,但绘制相邻核小体之间的连接是通过反复试验完成的,因此并不理想。我可以“大致”看到它如何自动完成,但我太懒了。

由 mwibrow 编辑.(initially 0)由于在某些 PGF 版本中存在错误,因此被删除。


由 JLDiaz 编辑。由于作者的声誉不足以发布图片,所以我替他发布。为了生成此图片,必须在源代码中进行小幅修改。该选项(initially 0)已在循环中删除\foreach

结果

答案2

这是我的一个“黑客”解决方案,请不要太当真。

我将首先展示结果,然后展示高级代码,然后展示绘制一个圆柱体及其包装的丑陋的宏,最后展示我如何完成这一切的解释。

1. 结果

结果

2. 高水平tikzpicture

它包含一个循环,其中从前一个核小体绘制一条链到当前核小体,然后将核小体绘制在顶部,最后为下一次迭代设置一些坐标点。

% Define styles, colors and opacity
\tikzset{
  wrapping/.style = {draw=black!60, line cap=round, line join=round, ultra thick},
  nucleosome/.style = {red!40, fill opacity=.9, draw=none},
  top cylinder/.style= {red!60, fill opacity=.9}
}

\begin{tikzpicture} % Draw the chain
\coordinate (previous) at (-1,0) {};
\coordinate (start) at (-.235,.423) {};
\foreach \x in {0,2,4,6} {  % Draw four nucleosomes, 2cm apart each other
  \begin{scope}[xshift=\x cm]
  \draw[wrapping] (previous) to[out=-50, in=-60] (start); % connection from previous
  \nucleosome                                             % Black magic here
  \coordinate (previous) at (end) {};                     % update join points
  \coordinate (start) at ([xshift=2cm] start) {};
  \end{scope}
}
% Last strand
\draw[wrapping] (previous) to[out=-50, in=-60] +(1,.3); 
\end{tikzpicture}

3.\nucleosome

请注意,它很丑陋。之后,解释一下这些数字的来源:

\def\nucleosome{
\draw[wrapping](.198,-.549)--(.204,-.543)--(.225,-.519)--(.243,-.49)--(.26,-.457)--(.274,-.42)--(.285,-.379)--(.294,-.335)--(.3,-.288)--(.303,-.238)--(.304,-.186)--(.302,-.133)--(.297,-.078)--(.29,-.023)--(.281,.033)--(.27,.089)--(.256,.143)--(.24,.197)--(.223,.249)--(.204,.299)--(.184,.347)--(.163,.391)--(.14,.432)--(.117,.47)--(.094,.504)--(.071,.533)--(.047,.558)--(.024,.578)--(.002,.593)--(-.012,.599);
\draw[wrapping](-.235,.423)--(-.259,.449)--(-.282,.471)--(-.305,.488)--(-.325,.499);
%\filldraw[fill=green](-.235,.423) circle (2pt);
\coordinate (start) at (-.235,.423) {};
\filldraw[top cylinder](.422,-.414)--(.499,-.422)--(.561,-.379)--(.6,-.288)--(.614,-.159)--(.6,-.003)--(.561,.163)--(.499,.324)--(.422,.464)--(.336,.569)--(.251,.629)--(.173,.638)--(.112,.595)--(.072,.504)--(.059,.374)--(.072,.218)--(.112,.052)--(.173,-.109)--(.251,-.249)--(.336,-.354)--cycle;
\filldraw[nucleosome](-.561,.379)--(.112,.595)--(.173,.638)--(-.499,.422)--cycle;
\draw[wrapping](-.325,.499)--(-.327,.5)--(-.348,.507)--(-.368,.509)--(-.386,.505)--(-.391,.503);
\filldraw[nucleosome](-.173,-.638)--(.499,-.422)--(.422,-.414)--(-.251,-.629)--cycle;
\draw[wrapping](.112,-.59)--(.129,-.587)--(.156,-.578)--(.181,-.563)--(.198,-.549);
\draw[wrapping](-.012,.599)--(-.02,.603)--(-.041,.609)--(-.06,.609)--(-.077,.604);
\filldraw[nucleosome](-.6,.288)--(.072,.504)--(.112,.595)--(-.561,.379)--cycle;
\draw[wrapping](-.391,.503)--(-.403,.497)--(-.418,.484)--(-.431,.466)--(-.441,.443)--(-.45,.415)--(-.454,.392);
\filldraw[nucleosome](-.251,-.629)--(.422,-.414)--(.336,-.354)--(-.336,-.569)--cycle;
\draw[wrapping](-.059,-.538)--(-.057,-.54)--(-.024,-.56)--(.009,-.575)--(.04,-.586)--(.071,-.592)--(.101,-.592)--(.112,-.59);
\draw[wrapping](-.077,.604)--(-.078,.604)--(-.094,.594)--(-.108,.579)--(-.121,.559)--(-.131,.535)--(-.138,.506)--(-.14,.493);
\filldraw[nucleosome](-.614,.159)--(.059,.374)--(.072,.504)--(-.6,.288)--cycle;
\filldraw[nucleosome](-.336,-.569)--(.336,-.354)--(.251,-.249)--(-.422,-.464)--cycle;
\draw[wrapping](-.454,.392)--(-.456,.384)--(-.46,.348)--(-.461,.309)--(-.459,.267)--(-.459,.264);
\filldraw[nucleosome](-.6,.003)--(.072,.218)--(.059,.374)--(-.614,.159)--cycle;
\filldraw[nucleosome](-.422,-.464)--(.251,-.249)--(.173,-.109)--(-.499,-.324)--cycle;
\draw[wrapping](-.167,-.438)--(-.155,-.452)--(-.122,-.486)--(-.089,-.515)--(-.059,-.538);
\filldraw[nucleosome](-.561,-.163)--(.112,.052)--(.072,.218)--(-.6,.003)--cycle;
\filldraw[nucleosome](-.499,-.324)--(.173,-.109)--(.112,.052)--(-.561,-.163)--cycle;
\draw[wrapping](-.459,.264)--(-.455,.222)--(-.448,.175)--(-.438,.125)--(-.433,.105);
\draw[wrapping](-.14,.493)--(-.144,.473)--(-.146,.436)--(-.147,.396)--(-.145,.365);
\draw[wrapping](-.269,-.298)--(-.248,-.331)--(-.218,-.375)--(-.187,-.415)--(-.167,-.438);
\draw[wrapping](-.433,.105)--(-.426,.074)--(-.411,.022)--(-.394,-.03)--(-.38,-.069);
\draw[wrapping](.146,-.337)--(.17,-.363)--(.202,-.395)--(.235,-.423);
%\filldraw[fill=green](.235,-.423) circle (2pt);
\coordinate (end) at (.235,-.423) {};
\draw[wrapping](-.355,-.131)--(-.353,-.135)--(-.329,-.187)--(-.304,-.237)--(-.277,-.285)--(-.269,-.298);
\draw[wrapping](-.38,-.069)--(-.375,-.083)--(-.355,-.131);
\draw[wrapping](-.145,.365)--(-.144,.353)--(-.139,.307)--(-.131,.259)--(-.121,.209)--(-.12,.205);
\draw[wrapping](.044,-.197)--(.047,-.2)--(.076,-.246)--(.106,-.288)--(.138,-.328)--(.146,-.337);
\draw[wrapping](-.12,.205)--(-.108,.158)--(-.092,.105)--(-.074,.053)--(-.066,.032);
\draw[wrapping](-.04,-.031)--(-.032,-.052)--(-.007,-.103)--(.019,-.153)--(.044,-.197);
\draw[wrapping](-.066,.032)--(-.054,0)--(-.04,-.031);
}

4. 解释

首先,受@cmhughes 评论的启发,我编写了一个sketch程序来绘制单个核小体,周围有部分螺旋。我还用一个大绿点标记了螺旋的起点和终点。这些将是从一个核小体到下一个核小体的“连接点”。这是代码sketch,请注意,我使用line style=wrappingfill style=nucleosome以便能够稍后从中自定义样式tikz

def start_angle 180       % starting and ending angles of the helix
def end_angle 720-180
def radius_helix 1.08     % helix radius, a bit more than the cylinder
def cylinder_height 1.4   
def percentage_wrapped 70 % How many of the cylinder is wrapped in the helix
def start_point (radius_helix*cos(start_angle), 
                 -percentage_wrapped/100*cylinder_height/2,
                 radius_helix*sin(start_angle))

def helix {
  def n_segs 100
  sweep [line style=wrapping]
     { n_segs, translate([0, cylinder_height*percentage_wrapped/100/n_segs,0]),
               rotate(end_angle/n_segs, [0,1,0]) } (start_point)
}

def start {  % Starting point of the helix
  dots [fill=green](start_point)
}

def end {    % Ending point of the helix
  put { translate([0, cylinder_height*percentage_wrapped/100,0]) 
        then rotate(end_angle, [0,1,0]) } {{start}}
}

def cylinder {
  def n_cyl_segs 20
  sweep[fill style=top cylinder]{ n_cyl_segs<>,
        rotate(360/n_cyl_segs, [0,1,0]) }
        line[fill style=nucleosome](1,-cylinder_height/2)(1,cylinder_height/2)
}

def nucleosome {
  put { rotate (-60, [1, 0, 0])} {{cylinder}{helix}{start}{end}}
}

put { view((10,15,0)) } { {nucleosome} }  % Draw it!

global { language tikz }

我使用以下命令处理了上述文件:

sketch nucleosome.sketch > nucleosome.tex

然后将结果包含在文档中:

\documentclass{article}
\usepackage{tikz}
\tikzset{
  wrapping/.style = {draw=black!60, line cap=round, line join=round, ultra thick},
  nucleosome/.style = {red!40, fill opacity=.9, draw=none},
  top cylinder/.style= {red!60, fill opacity=.9}
}
\begin{document}
\input nucleosome
\end{document}

并得到(请注意绿色的大点):

核小体

然后编辑nucleosome.tex并搜索字符串green。我发现:

[...]
\filldraw[fill=green](-.235,.423) circle (2pt);
[...]
\filldraw[fill=green](.235,-.423) circle (2pt);
[...]

这给了我核小体包裹起点和终点在二维投影中的坐标。我手动将这些行替换为:

[...]
%\filldraw[fill=green](-.235,.423) circle (2pt);
\coordinate (start) at (-.235,.423) {};
[...]
%\filldraw[fill=green](.235,-.423) circle (2pt);
\coordinate (end) at (.235,-.423) {};
[...]

然后将\begin{tikzpicture}with\def\nucleosome{\end{tikzpicture}with替换}以获得宏的定义\nucleosome,如第 3 节中所示。其余部分应该很清楚。

答案3

我会尝试回答我自己的问题,尽管这仍然不够充分。穷人的 DNA 缠绕可以通过沿着圆柱体的一些弯曲路径来实现(我第一次使用角度而不是命名锚点)。但缠绕和连接链之间的连接充其量只是一种黑客行为。

 \documentclass{standalone}
 \usepackage {tikz}
 \usetikzlibrary{shapes,backgrounds}
 \begin {document}
 \tikzset{nucleosome core/.style={cylinder,
     rotate=150,
     shape aspect=0.5,minimum width=1cm,
     minimum height=0.7cm, cylinder uses custom fill,
     cylinder end fill=red!50,cylinder body fill=red!25}}

 \tikzset {DNA wrap/.style= {ultra thick, draw,color=gray,line cap=round}}

 \begin{tikzpicture}
 \foreach \i in {0,2,4,6} { 
   \path node [nucleosome core] (\i) at (\i,0) {} ;
   \begin{pgfonlayer} {background}
     \draw (\i-1.7,0) edge [DNA wrap, bend right=55] (\i.70);
   \end{pgfonlayer}
   \draw [DNA wrap] (\i.70) edge [bend right=15] (\i.285);
   \draw [DNA wrap] (\i.95) edge [bend right=15] (\i.260);
 }
   \end{tikzpicture}
 \end{document}

其结果是这(编辑:固定包装的惯用手性并添加背景层)

TODO:为核小体命名,以便它们可以用表观遗传标记进行修饰(阅读 Amy Hendrickson 在 TUGBoat 33(2):219 中的“\csname...\endcsname 的乐趣”)

相关内容