I was doing network analysis with metaboanalystR 4.0, with following code:
mSet<-InitDataObjects(“conc”, “network”, FALSE)
mSet ← SetOrganism(mSet, “hsa”)
2. Load data as data frame
input_file ← “C:/Users/timothy/Documents/GitHub/timeline_series/timepoint 2 vs 1.csv”
cmpd_data ← read.csv(input_file, header = FALSE, stringsAsFactors = FALSE)
3. Extract compounds and values separately
cmpdList ← cmpd_data[, 1] # First column = compound IDs
values ← cmpd_data[, 2] # Second column = values (e.g., concentrations)
4. Clean compounds (remove NA/empty)
cmpdList ← cmpdList[!is.na(cmpdList) & cmpdList != “”]
5. Map compounds
mSet ← PerformCmpdMapping(mSet, cmpdList, “hsa”, “kegg”)
cmpd_data ← read.delim(“your_file.txt”, comment.char = “#”, header = TRUE, stringsAsFactors = FALSE)
6. Add values to mapped compounds
mSet ← CreateMappingResultTable(mSet)
mSet$dataSet$map.table$Value ← values[match(mSet$dataSet$map.table$Query, cmpdList)]
mSet<-GetNetworkGeneMappingResultTable(mSet)
7. Verify
print(head(mSet$dataSet$map.table))
8. Proceed only if mappings exist
if(nrow(mSet$dataSet$map.table) > 0){
mSet ← PrepareNetworkData(mSet)
mSet ← PrepareKeggQueryJson(mSet)
mSet ← PerformKOEnrichAnalysis_KO01100(mSet, “pathway”, “network_enrichment_pathway_0”)
mSet ← CreateGraph(mSet)
} else {
stop(“No compounds mapped! Check your IDs.”)
}
but i keep getting the following error:
Error in qs::qread(“…/…/libs/ko.qs”) :
For file …/…/libs/ko.qs: Failed to open for reading. Does the file exist? Do you have file permissions? Is the file name long? (>255 chars)
In addition: Warning message:
call dbDisconnect() when finished working with a connection