受此问题的启发chemfig 和乐高风格的分子结构,我决定制作一种绘制肽的通用方法......对于初学者来说,这是一系列结合在一起的氨基酸。
我制作了具有可替换取代基的 $\alpha$-氨基酸链的通用骨架。我还根据肽的位置制作了每条链的两个版本(aa1 在位置 1,aa2 在位置 2,aa1 在位置 3,aa2 在位置 4,即奇数骨架在奇数位置等)
我可以制造亚分子,我可以派生亚分子,但我不能把它们放在一起!
(请原谅乐高风格答案的剪切和粘贴以及最少的格式......)
我做错了什么简单的事情?在最后一个环境中注释掉除一个子分子之外的所有子分子\chemfig
,只会产生该分子,但所有注释都没有任何效果。
\documentclass{minimal}
\usepackage{chemfig,xstring,chemmacros}
\makeatletter
% "\derivesubmol" defines the new #1 submol, obtained by replacing all the
% occurrences of "#3" by "#4" in the code of #2 submol
% arguments: #1 = new submol name, #2 = old submol name,
% #3 = old substring, #4 = new substring
\newcommand*\derivesubmol[4]{%
\saveexpandmode\saveexploremode\expandarg\exploregroups
\csname @\ifcat\relax\noexpand#2first\else second\fi oftwo\endcsname
{\expandafter\StrSubstitute\@car#2\@nil}
{\expandafter\StrSubstitute\csname CF@@#2\endcsname}
{\@empty#3}{\@empty#4}[\temp@]%
\csname @\ifcat\relax\noexpand#1first\else second\fi oftwo\endcsname
{\expandafter\let\@car#1\@nil}
{\expandafter\let\csname CF@@#1\endcsname}\temp@
\restoreexpandmode\restoreexploremode
}
\makeatother
\setatomsep{2.5em}
\setcrambond{2pt}{}{}
\definesubmol{rt1}{<[::-60]rt1}
\definesubmol{rt2}{<:[::60]rt2}
\definesubmol{aa1}
{
N(-[::90,0.3,,,draw=none]H)-[::-30](!{rt1})-[::60](=[::60]O)-[::-60]
}
\definesubmol{aa2}
{
N(-[::-90,0.3,,,draw=none]H)-[::30](!{rt2})-[::-60](=[::-60]O)-[::60]
}
\def\drawhline{\medbreak\hrulefill\medbreak}
\begin{document}
\chemfig{!{aa1}} \quad\quad The $\alpha$-amino acid template\quad\quad\chemfig{!{aa2}}
\drawhline%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\derivesubmol{ala1}{aa1}{!{rt1}}{<[::-60]CH_3}
\chemfig{!{ala1}} \quad\quad In Alanine, substituent rt1 is replaced by \ch{CH3}
\derivesubmol{ala2}{aa2}{!{rt2}}{<:[::60]CH_3}
\chemfig{!{ala2}}\quad\quad rotated
\drawhline
\derivesubmol{gly1}{aa1}{!{rt1}}{}
\chemfig{!{gly1}} \quad\quad In Glycine, substituent rt1 is replaced by nothing
\quad\quad
\derivesubmol{gly2}{aa2}{!{rt2}}{}
\chemfig{!{gly2}}\quad\quad rotated
\drawhline
\drawhline%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\derivesubmol{Val1}{aa1}{!{rt1}}{<[::-60](-[::-60]CH_3)(-[::60]CH_3)}
\chemfig{!{Val1}} \quad\quad In Val, substituent rt1 is replaced by \ch{CH(CH3)2)}
\quad\quad Valine
\quad\quad
\derivesubmol{Val2}{aa2}{!{rt2}}{<:[::60](-[::-60]CH_3)(-[::60]CH_3)}
\chemfig{!{Val2}}\quad\quad rotated
\drawhline
\drawhline%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\derivesubmol{Phe1}{aa1}{!{rt1}}{<[::-60]CH2-[::0]Ph}
\chemfig{!{Phe1}} \quad\quad In Phe, substituent rt1 is replaced by \ch{CH2Ph}
\quad\quad Phenylanaline
\quad\quad
\derivesubmol{Phe2}{aa2}{!{rt2}}{<:[::60]CH2-[::0]Ph}
\chemfig{!{Phe2}}\quad\quad rotated
\drawhline
\chemfig{
!{Val1}
!{ala2}
!{Phe1}
!{Phe2}
!{gly1}
}
\end{document}
答案1
一个简单的解决方案是“结合”亚分子,即
替换您的代码:
\chemfig{
!{Val1}
!{ala2}
!{Phe1}
!{Phe2}
!{gly1}
}
例如(可能需要进行一些调整):
\chemfig{
!{Val1}-[,0.3,,,draw=none]
!{ala2}-[,0.3,,,draw=none]
!{Phe1}-[,0.3,,,draw=none]
!{Phe2}-[,0.3,,,draw=none]
!{gly1}
}