Skip to content

To have in input a vector of string of NMRExperiments #62

@philibe

Description

@philibe

Hello.

Thank you very much for your powerful Nmr package, well documented with examples, integrated, and not too complex to use.

I saw that you have implemented Ensure unique exp names pull #48, it's useful, but when we have >100 experiments for a PCA, for example, it's not easy to analyze "10...54" experiment name and not the real name of experiment.

Here is my workaround :) (written before the pull #48 fix, but still useful for renaming duplicate names)

# my analyses (my_dir_of_NMR_analysis)
#   analysis L1 bla bla
#     10 : my_experiments[[1]]
#   analysis L2 bla bla
#     10 : my_experiments[[2]]
#     20 : my_experiments[[3]]

my_experiments<- fs::dir_ls( 
  my_dir_of_NMR_analysis   , 
  type="directory", 
  recurse=TRUE, 
  glob="*0"
)

dataset<- AlpsNMR::nmr_read_samples(my_experiments) 

dataset$NMRExperiment<-paste0(
  basename(dirname(dataset$metadata$info$info_sample_path)),
  "_exp_", 
  basename(dataset$metadata$info$info_sample_path) 
)

for (metadata_name_niv1 in names(dataset$metadata)) {
  for (metadata_name_niv2 in names(dataset$metadata[[metadata_name_niv1]])) {
    if (DescTools::Coalesce(dplyr::contains ("NMRExperiment", ignore.case = TRUE,metadata_name_niv2),0)==1) { 
      dataset$metadata[[metadata_name_niv1]][[metadata_name_niv2]]<- dataset$NMRExperiment
    }
  } 
}    

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions