今天终于考完了本该一年前考完的试,明天考完准备开启大四下的躺平生活(雾)。重温这一遍基因工程还是有所收获的,除了专业进步还发现了这一冷知识。
折腾成果:点击查看
步骤:
- 配置你的博客
- iPad端导出xmind为markdown
- 用写的程序处理
- 粘到markdown里
第一步
按照官网操作即可,把需要的代码插入你的index.html
的相应位置。(以下和官网相同)
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<body>
<!-- markmap is based on d3, so must load those files first. -->
<script src="//unpkg.com/d3@3/d3.min.js"></script>
<script src="//unpkg.com/markmap@0.6.1/lib/d3-flextree.js"></script>
<script src="//unpkg.com/markmap@0.6.1/lib/view.mindmap.js"></script>
<link rel="stylesheet" href="//unpkg.com/markmap@0.6.1/style/view.mindmap.css">
<div id="app"></div>
<script>
window.$docsify = {
mindmap: {
// https://github.com/dundalek/markmap
markmap: {
preset: 'colorful', // or default
linkShape: 'diagonal' // or bracket
}
}
}
</script>
<script src="//unpkg.com/docsify@4/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify-mindmap/dist/docsify-mindmap.min.js"></script>
</body>
</html>
# Plain text
第二步
打开一个markdown文件,写入:
```mindmap
root
topic1
subtopic
topic2
subtopic
```
就会呈现思维导图结构(长什么样子还是自己看官网吧)
等会,是不是觉得这个结构很像markdown?
Xmind可以转json,但转换太复杂,必须把字典字符串合理得换行。。
第三步
从Xmind导出你的思维导图为markdown。我试的时候iPad上可以,但电脑端要收钱(发现bug?)
大概是这个样子:
## Chp 3 Obtaining Target Genes
### From genomic/plasmid DNA
#### Genome: isolation
##### 研磨+裂解液
###### 吸附柱+漂洗洗脱
###### 酚+氯仿,醇沉淀
#### Plasmid: alkaline isolation
##### Resuspension
###### Glucose, RNase, EDTA
##### Lysis
###### NaOH, SDS
##### Neutralization
###### High salt HAc buffer
###### Plasmid renaturation
### From genomic/cDNA library
#### Library
##### Into fragments, into vectors, into host
##### Complete, stable
###### capacity*clone number
#### Genome
(gDNA)
#####
##### Steps
###### Extract genomic DNA
###### Partially digestion
* Choose enzyme and time
* Pick fragments whose length fit the vector
###### Insert into vector and transform
###### Screening
* With nucleic acid probes/antibody
(Replicate to NC membrane)
* With resistance gene
##### gDNA lib
Signigicance
###### Stable storage
###### Enrichment and amplification
###### Genome profiling and find unknown genes
#### cDNA
##### Steps
###### Extract mRNA
* Affinity chromatography: oligo-dT(poly a tail) cellulose
###### Synthesis of cDNA
* template chain
* Oligo dT primer
* Random primer
* Gene specific primer
* 2nd strand
* method1
* remove RNA
* RNase H
* coding chain
* 3’ folds back as primer
* S1 nuclease cut hairpin
* method2
* No removal
* Gene specific reverse primer
* Or add poly C
oligo-dG as primer
第四步
观察代码特点,写程序转换成所需格式。
策略:设计者应该是把空两个作为一个tab的,我们进行文本替换,把一个#换成两个空格。其实很简单
这个例子包括了所有需要注意的问题:
- chapter那里没有缩进,所以每行都应删去两个
#
- 所有
#
结束后有一个空格,一并删去 - *是七级标题,处理前替换为七个
#
- 七级标题往下改用四个空格的缩进,所以把四个空格替换为一个
#
- 有的地方我用了强制换行,需要退回上一行
所以Python代码如下:
def parse_md(path):
# read file
with open(path + '.md', 'r', encoding='utf-8') as f:
lines = f.readlines()
# process, to be consistent
for i in range(len(lines)):
if '*' in lines[i]:
lines[i] = lines[i].replace('*', '#######') # *是七级标题
if ' ' in lines[i]:
lines[i] = lines[i].replace(' ', '#') # 假设不会再出现这样的四个空格了
if lines[i][0] != '#' and lines[i][0] != '*': # 处理强制换行
lines[i-1] = lines[i-1].strip('\n') + ' ' + lines[i] # 上一行去掉换行符,拼上这一行
lines[i] = '' # 清空这一行
# transformation
with open(path + '.txt', 'w') as f:
for line in lines:
l = line.replace('## ', '').replace('�', '')
# 若按章节分开,就删去两个#,根据需要调整;并删去可能的乱码
f.write(l.replace('#', ' ')) # 两个空格
path = 'test' # 不要加.md
parse_md(path)
比如上面的例子转换后就是
Chp 3 Obtaining Target Genes
From genomic/plasmid DNA
Genome: isolation
研磨+裂解液
吸附柱+漂洗洗脱
酚+氯仿,醇沉淀
Plasmid: alkaline isolation
Resuspension
Glucose, RNase, EDTA
Lysis
NaOH, SDS
Neutralization
High salt HAc buffer
Plasmid renaturation
From genomic/cDNA library
Library
Into fragments, into vectors, into host
Complete, stable
capacity clone number
Genome (gDNA)
Steps
Extract genomic DNA
Partially digestion
Choose enzyme and time
Pick fragments whose length fit the vector
Insert into vector and transform
Screening
With nucleic acid probes/antibody (Replicate to NC membrane)
With resistance gene
gDNA lib Signigicance
Stable storage
Enrichment and amplification
Genome profiling and find unknown genes
cDNA
Steps
Extract mRNA
Affinity chromatography: oligo-dT(poly a tail) cellulose
Synthesis of cDNA
template chain
Oligo dT primer
Random primer
Gene specific primer
2nd strand
method1
remove RNA
RNase H
coding chain
3’ folds back as primer
S1 nuclease cut hairpin
method2
No removal
Gene specific reverse primer
Or add poly C
oligo-dG as primer
结果会保存在同名.txt文件中,复制到你的文档里,代码类型为mindmap
,部署后就可以看到了。
另外还发现这个插件的一些特点
- 开头空格无所谓,会被省略
- 中文还是支持的
- 只支持最简单的思维导图结构,美化其实也一般。。
回头再把其他课程也安排了!