Making Organism packages

by Marc Carlson

Overview

Making Organism Packages is a straightforward process using the helper functions makeOrgPackageFromNCBI() and makeOrgPackage(). If your package is available at NCBI with an identifiable NCBI Taxonomy ID you can try makeOrgPackageFromNCBI(). However, even if this fails, the second and more general makeOrgPackage() function will allow you to make a database package using only data.frames of data.

Making use of makeOrgPackageFromNCBI()

The makeOrgPackageFromNCBI() function, will take several different arguments to help declare who made the package and what species it is for. But the most important arguement is the tax_id arguement. That arguement is uses to search for gene records from NCBI that go with that species. So when calling this function it is important to choose the correct NCBI taxonomny ID for this argument. You can look up information about the taconomy ID at NCBIs website. Here is an example of calling this function to make a package for zebrafinch.

library(AnnotationForge)
makeOrgPackageFromNCBI(version = "0.1",
                       author = "Some One <so@someplace.org>",
                       maintainer = "Some One <so@someplace.org>",
                       outputDir = ".",
                       tax_id = "59729",
                       genus = "Taeniopygia",
                       species = "guttata")

Making use of makeOrgPackage()

Sometimes you may not find what you need at NCBI, most commonly this is because they may just not have enough data about the organism you are interested in. But often other resources will have annotation data that you want to make into an organism package. When this happens you can use the much more general makeOrgPackage() function. This function takes more arguments, but it does not rely on NCBI in order to run. We do however still ask for you to provice a tax ID for the metadata (even though we are not using it to look up data from NCBI). Many of the other arguments are also the same as the makeOrgPackageFromNCBI() function. But a key difference is that the 1st argument for this function is (…). For that argument, we want you to provide named arguments corresponding to data.frames of data. Each named argument will become a table name in the resulting database, and each field name (for the data.frames) will become the field names of the database as well as the names looked up by the columns() and keytypes() methods. With the exception of any table that is named by the goTable argument (more on this below), there are not too many restrictions on what kind of data you can put into the data.frame. But one rule you must follow is that the 1st collumn of each data.frame has to correspond to a central gene ID and be labeled “GID”.

Finally, the goTable method is also new. That argument indicates when one of the data.frames contains GO information. If you choose to use this argument, makeOrgPackage() will post-process your GO data to 1) remove IDs that are too new and 2) create a second table to also represent the GOALL, EVIDENCEALL and ONTOLOGYALL fields for the select method etc. However to use the goTable argument, you have to follow a strict convention with the data. Such a data.frame must have three columns only and these must correspond to the gene id, GO id and evidence codes. These columns also have to be named as “GID”, “GO” and “EVIDENCE” Below is an example that parses an example file into three data.frame and that makes use of the goTable argument.

## Makes an organism package for Zebra Finch data.frames:
finchFile <- system.file("extdata","finch_info.txt",
                 package="AnnotationForge")
finch <- read.table(finchFile,sep="\t")

## Now prepare some data.frames
fSym <- finch[,c(2,3,9)]
fSym <- fSym[fSym[,2]!="-",]
fSym <- fSym[fSym[,3]!="-",]
colnames(fSym) <- c("GID","SYMBOL","GENENAME")

fChr <- finch[,c(2,7)]
fChr <- fChr[fChr[,2]!="-",]
colnames(fChr) <- c("GID","CHROMOSOME")

finchGOFile <- system.file("extdata","GO_finch.txt",
               package="AnnotationForge")
fGO <- read.table(finchGOFile,sep="\t")
fGO <- fGO[fGO[,2]!="",]
fGO <- fGO[fGO[,3]!="",]
colnames(fGO) <- c("GID","GO","EVIDENCE")

## Then call the function
makeOrgPackage(gene_info=fSym, chromosome=fChr, go=fGO,
               version="0.1",
               maintainer="Some One <so@someplace.org>",
               author="Some One <so@someplace.org>",
               outputDir = ".",
               tax_id="59729",
               genus="Taeniopygia",
               species="guttata",
               goTable="go")

## then you can call install.packages based on the return value
install.packages("./org.Tguttata.eg.db", repos=NULL)
\\s\\S])";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(r,s){var p={};for(var q in r){p[q]=r[q]}if(s){for(var q in s){p[q]=s[q]}}return p}}();hljs.LANGUAGES.cpp=function(){var a={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1,restrict:1,_Bool:1,complex:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};return{dM:{k:a,i:"",k:a,r:10,c:["self"]}]}}}();hljs.LANGUAGES.r={dM:{c:[hljs.HCM,{cN:"number",b:"\\b0[xX][0-9a-fA-F]+[Li]?\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"number",b:"\\b\\d+(?:[eE][+\\-]?\\d*)?L\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"number",b:"\\b\\d+\\.(?!\\d)(?:i\\b)?",e:hljs.IMMEDIATE_RE,r:1},{cN:"number",b:"\\b\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",e:hljs.IMMEDIATE_RE,r:1},{cN:"keyword",b:"(?:tryCatch|library|setGeneric|setGroupGeneric)\\b",e:hljs.IMMEDIATE_RE,r:10},{cN:"keyword",b:"\\.\\.\\.",e:hljs.IMMEDIATE_RE,r:10},{cN:"keyword",b:"\\.\\.\\d+(?![\\w.])",e:hljs.IMMEDIATE_RE,r:10},{cN:"keyword",b:"\\b(?:function)",e:hljs.IMMEDIATE_RE,r:2},{cN:"keyword",b:"(?:if|in|break|next|repeat|else|for|return|switch|while|try|stop|warning|require|attach|detach|source|setMethod|setClass)\\b",e:hljs.IMMEDIATE_RE,r:1},{cN:"literal",b:"(?:NA|NA_integer_|NA_real_|NA_character_|NA_complex_)\\b",e:hljs.IMMEDIATE_RE,r:10},{cN:"literal",b:"(?:NULL|TRUE|FALSE|T|F|Inf|NaN)\\b",e:hljs.IMMEDIATE_RE,r:1},{cN:"identifier",b:"[a-zA-Z.][a-zA-Z0-9._]*\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"operator",b:"<\\-(?!\\s*\\d)",e:hljs.IMMEDIATE_RE,r:2},{cN:"operator",b:"\\->|<\\-",e:hljs.IMMEDIATE_RE,r:1},{cN:"operator",b:"%%|~",e:hljs.IMMEDIATE_RE},{cN:"operator",b:">=|<=|==|!=|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||\\$|:",e:hljs.IMMEDIATE_RE,r:0},{cN:"operator",b:"%",e:"%",i:"\\n",r:1},{cN:"identifier",b:"`",e:"`",r:0},{cN:"string",b:'"',e:'"',c:[hljs.BE],r:0},{cN:"string",b:"'",e:"'",c:[hljs.BE],r:0},{cN:"paren",b:"[[({\\])}]",e:hljs.IMMEDIATE_RE,r:0}]}}; hljs.initHighlightingOnLoad();

Making Organism packages

by Marc Carlson

Overview

Making Organism Packages is a straightforward process using the helper functions makeOrgPackageFromNCBI() and makeOrgPackage(). If your package is available at NCBI with an identifiable NCBI Taxonomy ID you can try makeOrgPackageFromNCBI(). However, even if this fails, the second and more general makeOrgPackage() function will allow you to make a database package using only data.frames of data.

Making use of makeOrgPackageFromNCBI()

The makeOrgPackageFromNCBI() function, will take several different arguments to help declare who made the package and what species it is for. But the most important arguement is the tax_id arguement. That arguement is uses to search for gene records from NCBI that go with that species. So when calling this function it is important to choose the correct NCBI taxonomny ID for this argument. You can look up information about the taconomy ID at NCBIs website. Here is an example of calling this function to make a package for zebrafinch.

library(AnnotationForge)
makeOrgPackageFromNCBI(version = "0.1",
                       author = "Some One <so@someplace.org>",
                       maintainer = "Some One <so@someplace.org>",
                       outputDir = ".",
                       tax_id = "59729",
                       genus = "Taeniopygia",
                       species = "guttata")

Making use of makeOrgPackage()

Sometimes you may not find what you need at NCBI, most commonly this is because they may just not have enough data about the organism you are interested in. But often other resources will have annotation data that you want to make into an organism package. When this happens you can use the much more general makeOrgPackage() function. This function takes more arguments, but it does not rely on NCBI in order to run. We do however still ask for you to provice a tax ID for the metadata (even though we are not using it to look up data from NCBI). Many of the other arguments are also the same as the makeOrgPackageFromNCBI() function. But a key difference is that the 1st argument for this function is (…). For that argument, we want you to provide named arguments corresponding to data.frames of data. Each named argument will become a table name in the resulting database, and each field name (for the data.frames) will become the field names of the database as well as the names looked up by the columns() and keytypes() methods. With the exception of any table that is named by the goTable argument (more on this below), there are not too many restrictions on what kind of data you can put into the data.frame. But one rule you must follow is that the 1st collumn of each data.frame has to correspond to a central gene ID and be labeled “GID”.

Finally, the goTable method is also new. That argument indicates when one of the data.frames contains GO information. If you choose to use this argument, makeOrgPackage() will post-process your GO data to 1) remove IDs that are too new and 2) create a second table to also represent the GOALL, EVIDENCEALL and ONTOLOGYALL fields for the select method etc. However to use the goTable argument, you have to follow a strict convention with the data. Such a data.frame must have three columns only and these must correspond to the gene id, GO id and evidence codes. These columns also have to be named as “GID”, “GO” and “EVIDENCE” Below is an example that parses an example file into three data.frame and that makes use of the goTable argument.

## Makes an organism package for Zebra Finch data.frames:
finchFile <- system.file("extdata","finch_info.txt",
                 package="AnnotationForge")
finch <- read.table(finchFile,sep="\t")

## Now prepare some data.frames
fSym <- finch[,c(2,3,9)]
fSym <- fSym[fSym[,2]!="-",]
fSym <- fSym[fSym[,3]!="-",]
colnames(fSym) <- c("GID","SYMBOL","GENENAME")

fChr <- finch[,c(2,7)]
fChr <- fChr[fChr[,2]!="-",]
colnames(fChr) <- c("GID","CHROMOSOME")

finchGOFile <- system.file("extdata","GO_finch.txt",
               package="AnnotationForge")
fGO <- read.table(finchGOFile,sep="\t")
fGO <- fGO[fGO[,2]!="",]
fGO <- fGO[fGO[,3]!="",]
colnames(fGO) <- c("GID","GO","EVIDENCE")

## Then call the function
makeOrgPackage(gene_info=fSym, chromosome=fChr, go=fGO,
               version="0.1",
               maintainer="Some One <so@someplace.org>",
               author="Some One <so@someplace.org>",
               outputDir = ".",
               tax_id="59729",
               genus="Taeniopygia",
               species="guttata",
               goTable="go")

## then you can call install.packages based on the return value
install.packages("./org.Tguttata.eg.db", repos=NULL)