Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor code cleanups #165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion R/api_keys.r
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ set_entrez_key <- function(key){
is_entrez_key_set <- function(){
!identical(Sys.getenv('ENTREZ_KEY'), "")
}

6 changes: 2 additions & 4 deletions R/base.r
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ entrez_tool <- function() 'rentrez'
#
# This function is used by all the API-querying functions in rentrez to build
# the appropriate url. Required arguments for each endpoint are handled by
# specific funcitons. All of these functions can use the id_or_webenv() function
# specific functions. All of these functions can use the id_or_webenv() function
# (below) to ensure that at least on of these arguments are provided and the
# sleep_time() function to set the approrate time to wait between requests.
#
Expand Down Expand Up @@ -156,7 +156,7 @@ parse_response <- function(x, type=NULL){
return(res)
}

#contsructor for web history objects
#constructor for web history objects
web_history <- function(WebEnv, QueryKey){
res <- list(WebEnv=WebEnv, QueryKey=QueryKey)
class(res) <- list("web_history", "list")
Expand All @@ -169,8 +169,6 @@ print.web_history <- function(x, ...){
", WebEnv = ", substr(x$WebEnv, 1, 12), "...", ")\n",sep="")
}



add_class <- function(x, new_class){
class(x) <- c(new_class, class(x))
x
Expand Down
2 changes: 1 addition & 1 deletion R/entrez_fetch.r
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ entrez_fetch <- function(db, id=NULL, web_history=NULL, rettype, retmode="", par
if(parsed){
#At the moment, this is just a long-winded way to call
#XML::xmlTreeParse, but we already use this approach to parse
#esummaries,and this is more flexible if NCBI starts sharing more
#esummaries, and this is more flexible if NCBI starts sharing more
#records in JSON.
return(parse_response(records, rettype))
}
Expand Down
2 changes: 1 addition & 1 deletion R/entrez_info.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Get information about EUtils databases
#'
#' Gather information about EUtils generally, or a given Eutils database.
#'Note: The most common uses-cases for the einfo util are finding the list of
#' Note: The most common uses-cases for the einfo util are finding the list of
#' search fields available for a given database or the other NCBI databases to
#' which records in a given database might be linked. Both these use cases
#' are implemented in higher-level functions that return just this information
Expand Down
15 changes: 5 additions & 10 deletions R/entrez_link.r
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#' Get links to datasets related to records from an NCBI database
#'
#' Discover records related to a set of unique identifiers from
#' an NCBI database. The object returned by this function depends on the value
#' set for the \code{cmd} argument. Printing the returned object lists the names
#' , and provides a brief description, of the elements included in the object.
#' Discover records related to a set of unique identifiers from an NCBI
#' database. The object returned by this function depends on the value set for
#' the \code{cmd} argument. Printing the returned object lists the names, and
#' provides a brief description, of the elements included in the object.
#'
#'@export
#'@param db character Name of the database to search for links (or use "all" to
#' search all databases available for \code{db}. \code{entrez_db_links} allows you
#' to discover databases that might have linked information (see examples).
Expand Down Expand Up @@ -53,9 +52,7 @@
#' res <- entrez_link(dbfrom="pubmed", db="", cmd="llinks", id=pubmed_search$ids)
#' linkout_urls(res)
#'}
#'


#'@export
entrez_link <- function(dbfrom, web_history=NULL, id=NULL, db=NULL, cmd='neighbor', by_id=FALSE, config=NULL, ...){
identifiers <- id_or_webenv()
args <- c(list("elink", db=db, dbfrom=dbfrom, cmd=cmd, config=config, by_id=by_id, ...), identifiers)
Expand Down Expand Up @@ -202,7 +199,6 @@ parse_linkouts <- function(x){


#' @export

print.elink_list <- function(x, ...){
payload <- attr(x[[1]], "content")
cat("List of", length(x), "elink objects,each containing\n", payload)
Expand All @@ -214,7 +210,6 @@ print.elink <- function(x, ...){
cat("elink object with contents:\n", payload, "\n",sep="")
}


#' @export
print.linkout <- function(x,...){
cat("Linkout from", x$Provider$Name, "\n $Url:", substr(x$Url, 1, 26), "...\n")
Expand Down
1 change: 0 additions & 1 deletion R/entrez_post.r
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ entrez_post <- function(db, id=NULL, web_history=NULL, config=NULL, ...){
return(result)
}


4 changes: 0 additions & 4 deletions R/entrez_search.r
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ entrez_search <- function(db, term, config=NULL, retmode="xml", use_history=FALS
parse_esearch(parsed, history=use_history)
}


parse_esearch <- function(x, history) UseMethod("parse_esearch")

parse_esearch.XMLInternalDocument <- function(x, history){
Expand Down Expand Up @@ -125,6 +124,3 @@ print.esearch <- function(x, ...){
"web_history object)\n Search term (as translated): " , display_term, "\n")
cat(msg)
}


c("//IdList/Id", "/eSearchResult/Count", "/eSearchResult/RetMax", "/eSearchResult/QueryTranslation")
4 changes: 1 addition & 3 deletions R/entrez_summary.r
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,14 @@ parse_esummary.list <- function(x, version, always_return_list){
res
}

# Prase a summary XML
# Parse a summary XML
#
# Logic goes like this
# 1. Define functions parse_esumm_* to handle all data types
# 2. For each node detect type, parse accordingly
# 3. wrap it all up in function parse_summary that
#

#
#@export
parse_esummary.XMLInternalDocument <- function(x, version, always_return_list){
check_xml_errors(x)
#Version 2.0 records have no type information (int, list etc) so we
Expand Down
9 changes: 4 additions & 5 deletions man/entrez_link.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.