200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 生信人写程序2. Editplus添加Perl Shell R模板和语法高亮

生信人写程序2. Editplus添加Perl Shell R模板和语法高亮

时间:2021-09-25 22:43:11

相关推荐

生信人写程序2. Editplus添加Perl  Shell  R模板和语法高亮

/

前言

“工欲善其事必先利其器”,生信工程师每天写代码、搭流程,而且要使用至少三门编程语言,没有个好集成开发环境(IDE,Integrated Development Environment)那怎么行?

本人使用过vim, editplus, ultraedit, notepad++, sublime。感觉在多语言支持、直接远程编辑脚本、启动速度等方面还是editplus用着比较舒服,适合我的个人习惯。

Editplus 下载和安装

最好官网下载最新版4.3,喜欢的话正版才30$,关键是不注册也不影响使用。

/download.html

有32/64位版,建议安装64位版epp430_64bit.exe,还有中文版(不建议,全是老版本),英语拼写检查(安装了没看到效果);

先安装完成后,打开,会出现配置设置、语法文件位置选择,如下图

建议修改到自己的目录,方便管理和备份,如改为C:\Users\woodc\Desktop\home\soft\editplus

如果不想看到试用字样,百度可以找到很多注册机/注册码,很容易激活。

添加Perl语言模板

该程序对Perl语法默认支持已经非常好了,只是缺少个生信专用模板,参考我的上篇文章

生信人写程序1. Perl语言模板及配置(http://bailab./markdown/editplus_dir.png)

右键另存下载perl模板文件直接单击会报错,因为Perl的pl文件是也属于网页的一种,会被解释,而内容又不是网页,所以报错。

主要操作如下:将原文中模板代码复制到editplus中新建的空白文件,点保存;

第一种情况:如果刚才设置了新的模板目录,请选择你自己设置的目录,替换template.pl。

第二种情况:默认的保存位置可替换template.pl即可。

如果下次使用新建 Perl打不开模板,可以尝试将模板代码保存为template.pl在任何位置,选择Tools - Preference - template 选择Perl,设置模板为刚才保存的文件即可。

以后点新建- perl会自己加载我们配置的模板开使写新程序;其实我们更多是找写过相近的程序再修改。

添加Shell语言支持

/others.html

选择* Shell stx - 肖俊斌 (-06-21)下载,解压后有stx语法文件放在之前设置的目录;也可直接右键点我下载shell语法

再选择

Tools – Preference – Setting & syntax, Add - 输入 “Shell” – OK, 文件扩展添”sh”,语法文件选择下载的shell.stx;点OK;

Shell写作模板

主要包括命令行参数解析、默认参数设置、程序功能描述及帮助文档等

右键另存下载Shell模板文件

#!/bin/bashset -e### Default parameterinput=input.txtoutput=output.txtdatabase=database.txtexecute='TRUE'# Function for script description and usageusage(){cat <<EOF >&2Usage:-------------------------------------------------------------------------------Filename: template.shRevision: 1.0Date: /6/24Author:Yong-Xin LiuEmail: yxliu@Website:http://bailab./Description: This script is solve parameter read and defaultNotes: Function of this script-------------------------------------------------------------------------------Copyright: (c) Yong-Xin LiuLicense:GPLThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.If any changes are made to this script, please mail me a copy of the changes-------------------------------------------------------------------------------Version 1.0 /6/24# Input files: input.txt, can inclue many file# 1. input.txt, design of exprimentSampleID BarcodeSequence group gene batch descriptionWT.1 TAGCTT WT ggps9.10 2 double mutant of ggps9-ggps10, cause A/B downWT.2 GGCTAC WT ggps9.10 2 double mutant of ggps9-ggps10, cause A/B downWT.3 CGCGCG WT ggps9.10 2 double mutant of ggps9-ggps10, cause A/B down# 2. database.txt, annotation of geneID descriptionAT3G48300 Transcript factor# Output file1. Annotated samples & DE genesSamples ID descriptionWt AT3G48300 Transcript factor2. Volcano plot: vol_otu_SampleAvsSampleB.pdfOPTIONS:-d database file-i input file-o output file or output directory, default output.txt-h/? show help of scriptExample:template.sh -i input.txt -d database.txt -o result.txtEOF}# Analysis parameterwhile getopts "d:h:i:o:" OPTIONdocase $OPTION ind)database=$OPTARG;;h)usageexit 1;;i)input=$OPTARG;;o)output=$OPTARG;;?)usageexit 1;;esacdone

将以上代码保存为template.sh,点击Tools – Preference – Template – Add 命名为Shell,选择template.sh文件,OK。

以后点New file, 选择shell即自动加载模板;

R语言的语法支持

官网下载* R programming language stx - Wei Wang (-05-15),或点我下载R语法文件

Tools – Preference – Setting & syntax, Add - 输入 “R” – OK, 文件扩展添”r,R,Rmd”,语法文件选择下载r的stx;点OK;

现在打开个R文件试试,已经语法高亮了

如果有Rstudio server的小伙伴,建议直接用网页版Rstudio在服务器上调式;

远程编辑脚本

先添加远程打开和保存工具栏按钮

Tools - Preference - Tools bar ; 把左侧的Open Remote, Save as Remote 选中按右箭头添加右侧;再选择edit菜单的Line Comment, Line Uncoment添加右侧;把右侧的远程打开和保存托至顶部,常用在前面好找;点OK确定配置

连接服务器打开文件编辑

点Open Remote按扭,点Setting设置远程服务器信息,添加服务器名称、IP、账号和密码,再点Advance中选择Encryption为sftp,OK再OK;即可正常连接服务器并浏览文件,我们选择编码Encoding为UTF-8,再打开shell脚本;

编辑吧,保存自动为远程保存,可以随时保存后马上运行调试,非常方便;

下次再打开已经使用过的文件,记得文件-最近打开文件选择更方便。 5.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。