Initial commit
This commit is contained in:
45
R/bibliography.R
Normal file
45
R/bibliography.R
Normal file
@@ -0,0 +1,45 @@
|
||||
#'@include xmlMods.R
|
||||
#'@import XML
|
||||
#'
|
||||
NULL
|
||||
|
||||
#' Tests if the metabarcode database has at least one bibliography reference
|
||||
#'
|
||||
#' @export
|
||||
has.bibliography = function(barcodedb) {
|
||||
length(getNodeSet(barcodedb,
|
||||
path='/obi:obimetabarcodedb/obi:bibliography',
|
||||
c(obi="http://metabarcoding.org/OBIMetabarcodes")))>0
|
||||
}
|
||||
|
||||
#' @export
|
||||
add.reference.barcodedb = function(barcodedb,bibfile,bibutils='bib2xml') {
|
||||
|
||||
if (! has.bibliography(barcodedb)) {
|
||||
# We create the bibliography node
|
||||
|
||||
metabarcode = getNodeSet(barcodedb,
|
||||
path='/obi:obimetabarcodedb',
|
||||
c(obi="http://metabarcoding.org/OBIMetabarcodes"))[[1]]
|
||||
|
||||
spare = sparexmltree()
|
||||
|
||||
bibliography = getNodeSet(spare,
|
||||
path='/obi:obimetabarcodedb/obi:bibliography',
|
||||
c(obi="http://metabarcoding.org/OBIMetabarcodes"))[[1]]
|
||||
|
||||
bibliography = xmlClone(bibliography)
|
||||
|
||||
addChildren(metadata,bibliography,
|
||||
at = NA)
|
||||
|
||||
|
||||
}
|
||||
|
||||
bibliography=getNodeSet(barcodedb,
|
||||
path='/obi:obimetabarcodedb/obi:bibliography',
|
||||
c(obi="http://metabarcoding.org/OBIMetabarcodes"))
|
||||
|
||||
ref = bib2mods(bibfile,bibutils)
|
||||
hidden=addChildren(bibliography[[1]],kids=ref)
|
||||
}
|
Reference in New Issue
Block a user