R-biomaRt使用-代码备份
目标:使用R脚本从ensembl上下载transcript数据
简单粗暴,直接上代码。biomaRt的介绍晚一点更新。
# this file helps extract information from ensembl with gene name as input
# 11/02/2018, pxy7896 library(biomaRt) # 使用参数
# args=commandArgs(T)
# 从文件读取
geneNamesFile <- "geneNames.txt"
otherInfoFile <- "otherInfo.txt" raw <- read.table(geneNamesFile, col.names = c("geneNames"), stringsAsFactors = FALSE)
# geneNames is character
geneNames <- raw[["geneNames"]]
#geneNames <- args[1]
otherInfo <- read.table(otherInfoFile, stringsAsFactors = FALSE)
dataSet <- otherInfo[[1]][1]
# choose database
#dataSet <- args[2]
mart = useMart("ensembl", dataset=dataSet)
attr <- c("hgnc_symbol", "ensembl_transcript_id", "chromosome_name", "transcript_start", "transcript_end")
# get transcript ids
ids <- getBM(attributes = attr, filters = "hgnc_symbol", values = geneNames, mart = mart)
write.table(ids, "ids.txt", sep="\t", quote=FALSE, row.names=FALSE)
targetIds <- ids["ensembl_transcript_id"]
# get exons info
exonAttr <- c("5_utr_start","5_utr_end","3_utr_start","3_utr_end","strand", "ensembl_transcript_id", "ensembl_exon_id", "exon_chrom_start", "exon_chrom_end")
#attr2 <- c(attr, exonAttr)
result <- getBM(attributes = exonAttr, filters = "ensembl_transcript_id", values = targetIds, mart = mart)
write.table(result, args[4], sep = "\t", quote = FALSE, row.names=FALSE)
R-biomaRt使用-代码备份的更多相关文章
- 随机森林入门攻略(内含R、Python代码)
随机森林入门攻略(内含R.Python代码) 简介 近年来,随机森林模型在界内的关注度与受欢迎程度有着显著的提升,这多半归功于它可以快速地被应用到几乎任何的数据科学问题中去,从而使人们能够高效快捷地获 ...
- 博客使用的CSS代码备份
CSS代码备份 /*simplememory*/ #google_ad_c1, #google_ad_c2 { display: none; } .syntaxhighlighter a, .synt ...
- 1.svn 彻底clear时,注意代码备份 2.借助vc助手加头文件
1.svn 彻底clear时,注意代码备份 2.不小心彻底clear可以在回收站找到 3.借助vc助手加头文件
- 决策树ID3原理及R语言python代码实现(西瓜书)
决策树ID3原理及R语言python代码实现(西瓜书) 摘要: 决策树是机器学习中一种非常常见的分类与回归方法,可以认为是if-else结构的规则.分类决策树是由节点和有向边组成的树形结构,节点表示特 ...
- 同时将代码备份到Gitee和GitHub
同时将代码备份到Gitee和GitHub 如何将GitHub项目一步导入Gitee 如何保持Gitee和GitHub同步更新 如何将GitHub项目一步导入Gitee 方法一: 登陆 Gitee 账号 ...
- 我的R代码备份
1 #f1=scan(file="f1.txt"); 2 #f2=scan(file="f2.txt"); 3 f=scan(file="5.2_ ...
- Android短信管家视频播放器代码备份
自己保留备份,增强记忆 这是video的类 public class VideoActivity extends Activity { /** * 解析网络页面 */ private WebVie ...
- [Python]南邮OJ代码备份爬虫
之前看过Python学习的经验,说以project为导向学习. 自己分析了一下,一般接触Python的都有一定的其它语言基础,对于程序设计的基本逻辑,语法都有一个大概的了解.而Python这样的脚本语 ...
- html和js基础功能代码备份
1)贴图:<img src="图片地址">2)加入连接:<a href="所要连接的相关地址">写上你想写的字</a> 3) ...
随机推荐
- HashMap源码详解与对比
前几天工作忙得焦头烂额时,同事问了一下关于Map的特性,刹那间懵了一下,紧接着就想起来了一些关于Map的一些知识,因为只要涉及到Collection集合类时,就会谈及Map类,因此理解好Map相关的知 ...
- jQuery中表单的常用操作(全选、反选)
表单的全选.反选操作一 <form method="post" action=""> 你爱好的运动是?<input type="ch ...
- ajax提交 返回值为undefined
easyui form 表单提交成功,但是返回值为undefined,原因是返回值不是json格式,是字符串的格式,那么解决办法就是把其转化成json格式 示例: $(function () { / ...
- appium(四)交互分析
转自:http://blog.csdn.net/Yejianyun1/article/details/56017360 一.简介 英文官网:appium官网 Appium跨平台.开源的自动化测试工具, ...
- OpenGL学习 Following the Pipeline
Passing Data to the Vertex Shader Vertex Attributes At the start of the OpenGL pipeline,we use the i ...
- java——二叉树面试题
import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util ...
- 377. Combination Sum IV 70. Climbing Stairs
back function (return number) remember the structure class Solution { int res = 0; //List<List< ...
- QT学习之QPair类
#QPair类 QPair是一个用来存储一对对象的容器模板.其有两个值,first和second. QPair() QPair(const T1 & value1, const T2 & ...
- testng失败重跑
重跑失败场景 1.要添加两个文件 背景:因为这里只是想单独展示失败的重跑的案例,所以先暂时把app这块的运行注释掉,只跑一个简单的demo,就一个简单类,类中就3个测试方法,失败重跑的原理是,运行方法 ...
- CKEditor4x word导入不保存格式的解决方案
后台上传文档时,目前功能都通过word直接复制黏贴实现,之前和word控件朋友一起测试找个问题,原始代码CK4.X没有找个问题. 第一时间排查config.js的配置发现端倪,测试解决! 由于配合ck ...