Skip to content

Commit

Permalink
correction to DESCRIPTION file (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
ake123 authored Aug 10, 2024
1 parent ae08191 commit f819e7d
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 37 deletions.
54 changes: 27 additions & 27 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,49 +27,58 @@ biocViews:
Depends:
R (>= 4.0.0)
Imports:
ape,
BiocManager,
BiocParallel,
Biostrings,
ComplexHeatmap,
dplyr,
ggplot2,
glue,
grid,
igraph,
knitr,
Maaslin2,
mia,
miaTime,
miaViz,
microbiome,
microbiomeDataSets,
phyloseq,
purrr,
reshape2,
scales,
sessioninfo,
stringr,
tidyverse,
vegan,
xgboost
Suggests:
ALDEx2,
ANCOMBC,
ape,
biclust,
BiocBook,
BiocManager,
BiocParallel,
Biostrings,
bluster,
caret,
circlize,
cluster,
cobiclust,
ComplexHeatmap,
corpcor,
curatedMetagenomicData,
dada2,
dendextend,
devtools,
DirichletMultinomial,
dplyr,
DT,
factoextra,
forcats,
fido,
ggplot2,
ggpubr,
ggtree,
glmnet,
glue,
grid,
gtools,
gsEasy,
igraph,
kableExtra,
knitr,
Maaslin2,
mia,
miaTime,
miaViz,
microbiome,
microbiomeDataSets,
MicrobiomeStat,
mikropml,
MMUPHin,
Expand All @@ -79,31 +88,22 @@ Suggests:
NbClust,
NMF,
patchwork,
phyloseq,
plotly,
purrr,
qgraph,
RColorBrewer,
rebook,
reshape2,
reticulate,
rgl,
ROCR,
scales,
scater,
sechm,
sessioninfo,
shadowtext,
SpiecEasi,
SPRING,
stats,
stringr,
SuperLearner,
tidyverse,
topGO,
vegan,
WGCNA,
xgboost
WGCNA
Remotes:
github::microbiome/mia,
github::microbiome/miaViz,
Expand Down
2 changes: 1 addition & 1 deletion inst/assets/bibliography.bib
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ @Article{Deng2024
year = {2024},
volume = 18,
number = {1},
pages = {wrae106}
pages = {wrae106},
doi = {10.1093/ismejo/wrae106}
}

Expand Down
38 changes: 32 additions & 6 deletions oma_packages/extract_packages.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
packages <- function() {
lines <- readLines("../DESCRIPTION")
extract_packages <- function(description_file_path = "~/OMA/DESCRIPTION", output_file_path = "~/OMA/oma_packages/oma_packages.csv") {
# Check if the DESCRIPTION file exists
if (!file.exists(description_file_path)) {
stop(paste("DESCRIPTION file not found at path:", description_file_path))
}

# Read the DESCRIPTION file
lines <- tryCatch(readLines(description_file_path), error = function(e) {
message("Error reading DESCRIPTION file: ", e$message)
return(NULL)
})

if (is.null(lines)) return() # Exit if file could not be read

extract_packages <- function(lines, section_name) {
# Function to extract packages from a given section
extract_packages_from_section <- function(lines, section_name) {
section_index <- grep(paste0("^", section_name, ":"), lines)
if (length(section_index) > 0) {
start_index <- section_index + 1
Expand All @@ -14,12 +26,26 @@ packages <- function() {
packages <- trimws(packages)
return(packages[packages != ""])
} else {
message("Section '", section_name, "' not found in DESCRIPTION file.")
return(character(0))
}
}

suggests_packages <- extract_packages(lines, "Suggests")
write.table(suggests_packages, "oma_packages.csv", row.names = FALSE, col.names = FALSE, sep = ",", quote = FALSE)
# Extract packages from the Imports and Suggests sections
imports_packages <- extract_packages_from_section(lines, "Imports")
suggests_packages <- extract_packages_from_section(lines, "Suggests")

# Combine the packages into a single vector and sort alphabetically
combined_packages <- sort(c(imports_packages, suggests_packages))

# Write the combined packages to a CSV file without headers
tryCatch({
write.table(combined_packages, output_file_path, row.names = FALSE, col.names = FALSE, sep = ",", quote = FALSE)
message("Combined packages written to ", output_file_path)
}, error = function(e) {
message("Error writing combined packages to CSV file: ", e$message)
})
}

packages()
# Call the function with the default path to the DESCRIPTION file and output file path
extract_packages()
6 changes: 3 additions & 3 deletions oma_packages/oma_packages.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ DirichletMultinomial
dplyr
DT
factoextra
forcats
fido
forcats
ggplot2
ggpubr
ggtree
glmnet
glue
grid
gtools
gsEasy
gtools
igraph
kableExtra
knitr
Expand All @@ -45,8 +45,8 @@ mikropml
MMUPHin
MOFA2
multiview
NetCoMi
NbClust
NetCoMi
NMF
patchwork
phyloseq
Expand Down

0 comments on commit f819e7d

Please sign in to comment.