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

Fix some TODOs #150

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions R/annotate_masses.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@
#'
#' @examples NULL
annotate_masses <-
function(features = get_params(step = "annotate_masses")$files$features$prepared,

Check warning on line 38 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=38,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 83 characters.

Check warning on line 38 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=38,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 83 characters.
filter_nitro = get_params(step = "annotate_masses")$options$nitrogen_rule,

Check warning on line 39 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=39,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 85 characters.

Check warning on line 39 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=39,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 85 characters.
output_annotations = get_params(step = "annotate_masses")$files$annotations$prepared$structural$ms1,

Check warning on line 40 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=40,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 111 characters.

Check warning on line 40 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=40,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 111 characters.
output_edges = get_params(step = "annotate_masses")$files$networks$spectral$edges$raw,

Check warning on line 41 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=41,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 97 characters.

Check warning on line 41 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=41,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 97 characters.
name_source = get_params(step = "annotate_masses")$names$source,
name_target = get_params(step = "annotate_masses")$names$target,
library = get_params(step = "annotate_masses")$files$libraries$sop$merged$keys,

Check warning on line 44 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=44,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 90 characters.

Check warning on line 44 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=44,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 90 characters.
str_stereo = get_params(step = "annotate_masses")$files$libraries$sop$merged$structures$stereo,

Check warning on line 45 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=45,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 106 characters.

Check warning on line 45 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=45,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 106 characters.
str_met = get_params(step = "annotate_masses")$files$libraries$sop$merged$structures$metadata,

Check warning on line 46 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=46,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 105 characters.

Check warning on line 46 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=46,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 105 characters.
str_nam = get_params(step = "annotate_masses")$files$libraries$sop$merged$structures$names,

Check warning on line 47 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=47,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 102 characters.

Check warning on line 47 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=47,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 102 characters.
str_tax_cla = get_params(step = "annotate_masses")$files$libraries$sop$merged$structures$taxonomies$cla,

Check warning on line 48 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=48,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 115 characters.

Check warning on line 48 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=48,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 115 characters.
str_tax_npc = get_params(step = "annotate_masses")$files$libraries$sop$merged$structures$taxonomies$npc,

Check warning on line 49 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=49,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 115 characters.

Check warning on line 49 in R/annotate_masses.R

View workflow job for this annotation

GitHub Actions / MegaLinter

file=/github/workspace/R/annotate_masses.R,line=49,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 115 characters.
adducts_list = get_params(step = "annotate_masses")$ms$adducts,
adducts_masses_list = system.file("extdata",
"adducts.tsv",
Expand Down Expand Up @@ -437,7 +437,7 @@
)
rm(df_adducted, df_nl_min)

# TODO dictionary of adducts (example 2H2O in mzmine)
# ISSUE see #141 dictionary of adducts (example 2H2O in mzmine)

df_addlossed_min <- df_addlossed |>
tidytable::rowwise() |>
Expand Down Expand Up @@ -466,8 +466,6 @@
df_addlossed_rdy <- df_addlossed_min_1 |>
tidytable::bind_rows(df_addlossed_min_2)

# TODO if same, say unrecognized and switch to M+H or M-H by default

log_debug("joining within given mz tol to exact mass library \n")
df_addlossed_em <- df_addlossed_rdy |>
dplyr::inner_join(df_add_em,
Expand Down Expand Up @@ -520,7 +518,7 @@
)
)

## TODO This will then be externalized somehow
## TODO This should be externalized somehow
forbidden_adducts <- c(
"[M-H2O (water)+H2O-H]-",
"[M-H3O4P (phosphoric)+H3O4P-H]-",
Expand Down
2 changes: 1 addition & 1 deletion R/annotate_spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ annotate_spectra <- function(input = get_params(step = "annotate_spectra")$files

query_precursors <- spectra@backend@spectraData$precursorMz
query_spectra <- spectra@backend@peaksData
## TODO find a way to have consistency in spectrum IDs
## ISSUE see #148 find a way to have consistency in spectrum IDs
query_ids <- spectra@backend@spectraData$acquisitionNum
if (is.null(query_ids)) {
query_ids <- spectra@backend@spectraData$spectrum_id
Expand Down
3 changes: 2 additions & 1 deletion R/complement_metadata_structures.R
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ complement_metadata_structures <- function(
)
rm(met_i, met_s, nam_i, nam_s, stereo_i, stereo_s, tax_cla, tax_npc)

## TODO if (quickmode == FALSE){...}
## ISSUE see #19
# if (quickmode == FALSE){...}

return(table_final)
}
2 changes: 1 addition & 1 deletion R/create_edges_spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ create_edges_spectra <- function(
tidytable::everything()
)

## TODO find a way to have consistency in spectrum IDs
## ISSUE see #148 find a way to have consistency in spectrum IDs
idz <- spectra@backend@spectraData$acquisitionNum
rm(spectra)
edges <- edges |>
Expand Down
2 changes: 1 addition & 1 deletion R/filter_annotations.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ filter_annotations <-
tidytable::distinct(-candidate_structure_error_rt, -rt_target,
.keep_all = TRUE
) |>
## TODO adapt for types and improve the * 3
## ISSUE see #149 adapt for types and improve the * 3
tidytable::filter(abs(candidate_structure_error_rt) <= abs(tolerance_rt * 3) | is.na(candidate_structure_error_rt)) |>
tidytable::select(-rt_target, -type)
} else {
Expand Down
1 change: 0 additions & 1 deletion R/install_latest_version.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ install_latest_version <- function() {
} else {
local_version <- pak::pkg_status("timaR")$version[1]
}
# TODO not ideal
remote_version <- readLines(
paste0(
"https://raw.githubusercontent.com/taxonomicallyinformedannotation/tima-r/",
Expand Down
2 changes: 1 addition & 1 deletion R/prepare_annotations_sirius.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ prepare_annotations_sirius <-
tidytable::left_join(formulas_prepared) |>
tidytable::left_join(canopus_prepared) |>
tidytable::left_join(denovo_prepared) |>
# TODO add de novo and spectral
# TODO add spectral
tidytable::distinct() |>
tidytable::mutate(
candidate_structure_tax_cla_chemontid = NA,
Expand Down
2 changes: 1 addition & 1 deletion R/prepare_libraries_rt.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ prepare_libraries_rt <-
"We would recommend you adding them but will try completing.",
"We will query them on the fly, this might take some time."
)
## TODO change with a small dependency
## ISSUE see #19
smiles <- unique(df_missing$smiles)

get_inchikey <- function(smiles, toolkit = "rdkit") {
Expand Down
2 changes: 1 addition & 1 deletion R/prepare_libraries_sop_ecmdb.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ prepare_libraries_sop_ecmdb <-
from = 1,
to = 14
),
## TODO compute it
## ISSUE see #19
structure_smiles_2D = NA_character_
) |>
tidytable::rename(
Expand Down
2 changes: 1 addition & 1 deletion R/prepare_libraries_sop_hmdb.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ prepare_libraries_sop_hmdb <-
from = 1,
to = 14
),
## TODO compute it
## ISSUE see #19
structure_smiles_2D = NA_character_,
structure_exact_mass = NA_real_
) |>
Expand Down
16 changes: 5 additions & 11 deletions R/prepare_libraries_sop_merged.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,11 @@ prepare_libraries_sop_merged <-
table_structures_taxonomy_cla <- tables$str_tax_cla
table_structures_taxonomy_npc <- tables$str_tax_npc

log_debug(x = "Completing structures metadata")
log_debug(x = "TODO")

log_debug(x = "Completing structures names")
log_debug(x = "TODO")

log_debug(x = "Completing structures taxonomy (classyfire)")
log_debug(x = "TODO")

log_debug(x = "Completing structures taxonomy (NPC)")
log_debug(x = "TODO")
## ISSUE see #19
# log_debug(x = "Completing structures metadata")
# log_debug(x = "Completing structures names")
# log_debug(x = "Completing structures taxonomy (classyfire)")
# log_debug(x = "Completing structures taxonomy (NPC)")

## If filter is TRUE,
## filter the library based on the specified level and value
Expand Down
3 changes: 0 additions & 3 deletions R/prepare_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ prepare_params <- function(params_small = get_params(step = "prepare_params"),
fil_lib_sop_pre_hmd <- params_advanced$files$libraries$sop$prepared$hmdb
fil_lib_sop_pre_lot <- params_advanced$files$libraries$sop$prepared$lotus
fil_lib_sop_pre_rt <- params_advanced$files$libraries$sop$prepared$rt
# TODO Docopt
fil_lib_sop_mer_key <- params_advanced$files$libraries$sop$merged$keys
fil_lib_sop_mer_org_nam <- params_advanced$files$libraries$sop$merged$organisms$names
fil_lib_sop_mer_org_tax_ott <- params_advanced$files$libraries$sop$merged$organisms$taxonomies$ott
Expand All @@ -66,7 +65,6 @@ prepare_params <- function(params_small = get_params(step = "prepare_params"),
fil_lib_sop_mer_str_nam <- params_advanced$files$libraries$sop$merged$structures$names
fil_lib_sop_mer_str_tax_cla <- params_advanced$files$libraries$sop$merged$structures$taxonomies$cla
fil_lib_sop_mer_str_tax_npc <- params_advanced$files$libraries$sop$merged$structures$taxonomies$npc
# TODO Docopt
fil_lib_spe_exp_neg <- params_advanced$files$libraries$spectral$exp$neg
fil_lib_spe_exp_pos <- params_advanced$files$libraries$spectral$exp$pos
fil_lib_spe_exp_raw <- params_advanced$files$libraries$spectral$exp$raw
Expand Down Expand Up @@ -472,7 +470,6 @@ prepare_params <- function(params_small = get_params(step = "prepare_params"),
org_fil_val
},
prepare_libraries_spectra = {
# TODO see layers
yamls_params$prepare_libraries_spectra$files$libraries$spectral$exp$neg <-
fil_lib_spe_exp_neg
yamls_params$prepare_libraries_spectra$files$libraries$spectral$exp$pos <-
Expand Down
2 changes: 1 addition & 1 deletion R/select_sirius_columns.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ select_sirius_columns_structures <- function(df, sirius_version) {
"candidate_structure_inchikey_no_stereo" = "InChIkey2D",
"candidate_structure_molecular_formula" = "molecularFormula",
"candidate_structure_xlogp" = "xlogp",
# TODO DOC
# ISSUE see #147
"candidate_score_sirius_confidence" = switch(sirius_version,
"5" = "ConfidenceScore",
"6" = "ConfidenceScoreApproximate"
Expand Down
2 changes: 1 addition & 1 deletion R/weight_bio.R
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ weight_bio <-
) |>
tidytable::left_join(df0) |>
log_pipe("... calculating weighted biological score \n") |>
## TODO suboptimal
## ISSUE see #146
tidytable::mutate(interim = -10 / as.numeric(candidate_score_sirius_csi)) |>
tidytable::mutate(interim_2 = ifelse(test = interim > 1,
yes = 1,
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
"SystemRequirements": null
},
"keywords": ["metaboliteannotation", "chemotaxonomy", "scoringsystem", "naturalproducts", "computationalmetabolomics", "taxonomicdistance", "specializedmetabolome"],
"fileSize": "4379.259KB",
"fileSize": "4379.057KB",
"citation": [
{
"@type": "ScholarlyArticle",
Expand Down
2 changes: 1 addition & 1 deletion inst/pipelines/_targets.R
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ list(
)
}
),
## TODO ADD GET HMDB
## TODO ADD GET HMDB
tar_target(
name = lib_sop_lot,
format = "file",
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ test_that(desc = "Test functions", code = {
prepare_features_tables()

## Performing MS1 annotation
## TODO improve this
## TODO check values later on
calculate_mass_from_adduct(adduct_string = "[2M1-2H2O+NaCl+H]2+", mass = 123.456)
calculate_mass_from_adduct(adduct_string = "[M+Na]+", mass = 123.456)
calculate_mass_from_adduct(adduct_string = "[M+H]+", mass = 123.456)
Expand Down
Loading