I was trying to rename row.names
using a reference dataframe (the dataframe does have more rows and entries than the current dataframe).
My current attempt
x <- row.names(abundance)
copy <- pathways_ref$Name[match(x, pathways_ref$ID)]
row.names(abundance) <- c(copy)
row.names(abundance) <- pathways_ref$Name[match(x, pathways_ref$ID)]
issues
Error in
.rowNamesDF<-
(x, value = value) : duplicate 'row.names' are not allowed In addition: Warning message: non-unique values when setting 'row.names':
For reference, the original dataframe is like
head(abundance)
S230047s S230054s S230073s S230077s
ko05340 13.50 33.6 1.50 15.70
ko00564 166.50 387.6 22.50 196.70
ko00680 256.00 566.5 27.00 278.00
ko00562 28.25 59.9 2.25 38.55
ko03030 169.25 393.6 14.25 204.95
ko00561 93.50 193.9 10.50 107.30
The reference dataframe is like
head(pathways_ref)
ID Name
1 ko01100 Metabolic pathways
2 ko01110 Biosynthesis of secondary metabolites
3 ko01120 Microbial metabolism in diverse environments
4 ko01200 Carbon metabolism
5 ko01210 2-Oxocarboxylic acid metabolism
6 ko01212 Fatty acid metabolism
Reproducible Data such that others can copy and paste.
# dput(abundance) assigned
structure(list(S230047s = c(13.5, 166.5, 256, 28.25, 169.25,
93.5, 11.5, 282.5, 40.5, 25.25, 296, 71, 4, 137.75, 140.5, 0.75,
105, 66.25, 10.25, 18.75), S230054s = c(33.6, 387.6, 566.5, 59.9,
393.6, 193.9, 27.1, 607.5, 92.8, 51.8, 679.9, 168.4, 4, 291.8,
272.3, 2.5, 188.9, 114.9, 26.3, 40), S230073s = c(1.5, 22.5,
27, 2.25, 14.25, 10.5, 1.5, 22.5, 7.5, 2.25, 30, 6, 0, 12.75,
10.5, 0.75, 6, 5.25, 2.25, 0.75), S230077s = c(15.7, 196.7, 278,
38.55, 204.95, 107.3, 14.7, 299.5, 39.1, 24.35, 349.8, 87.8,
0, 136.85, 137.1, 1.25, 73.8, 43.55, 20.35, 17.25)), row.names = c("ko05340",
"ko00564", "ko00680", "ko00562", "ko03030", "ko00561", "ko00440",
"ko00250", "ko00740", "ko04940", "ko00010", "ko00195", "ko03450",
"ko00760", "ko00920", "ko00311", "ko00310", "ko04146", "ko00600",
"ko04141"), class = "data.frame")
# dput(pathways_ref) assigned
structure(list(ID = c("ko01100", "ko01110", "ko01120", "ko01200",
"ko01210", "ko01212", "ko01230", "ko01232", "ko01250", "ko01240",
"ko01220", "ko01310", "ko01320", "ko00010", "ko00020", "ko00030",
"ko00040", "ko00051", "ko00052", "ko00053", "ko00500", "ko00620",
"ko00630", "ko00640", "ko00650", "ko00660", "ko00562", "ko00190",
"ko00195", "ko00196", "ko00710", "ko00720", "ko00680", "ko00910",
"ko00920", "ko00061", "ko00062", "ko00071", "ko00073", "ko00074",
"ko00100", "ko00120", "ko00121", "ko00140", "ko00561", "ko00564",
"ko00565", "ko00600", "ko00590", "ko00591", "ko00592", "ko01040",
"ko00230", "ko00240", "ko00250", "ko00260", "ko00270", "ko00280",
"ko00290", "ko00300", "ko00310", "ko00220", "ko00330", "ko00340",
"ko00350", "ko00360", "ko00380", "ko00400", "ko00410", "ko00430",
"ko00440", "ko00450", "ko00460", "ko00470", "ko00480", "ko00520",
"ko00541", "ko00510", "ko00513", "ko00512", "ko00515", "ko00514",
"ko00532", "ko00534", "ko00533", "ko00531", "ko00563", "ko00601",
"ko00603", "ko00604", "ko00511", "ko00540", "ko00542", "ko00550",
"ko00552", "ko00571", "ko00572", "ko00543", "ko00730", "ko00740",
"ko00750", "ko00760", "ko00770", "ko00780", "ko00785", "ko00790",
"ko00670", "ko00830", "ko00860", "ko00130", "ko00900", "ko00902",
"ko00909", "ko00904", "ko00906", "ko00905", "ko00981", "ko00908",
"ko00903", "ko00907", "ko01052", "ko00522", "ko01051", "ko01059",
"ko01056", "ko01057", "ko00253", "ko00523", "ko01054", "ko01053",
"ko01055", "ko00940", "ko00945", "ko00941", "ko00944", "ko00942",
"ko00943", "ko00946", "ko00901", "ko00403", "ko00950", "ko00960",
"ko00996", "ko00232", "ko00965", "ko00966", "ko00402", "ko00311",
"ko00332", "ko00261", "ko00331", "ko00521", "ko00524", "ko00525",
"ko00401", "ko00404", "ko00405", "ko00333", "ko00254", "ko00998",
"ko00999", "ko00997", "ko00362", "ko00627", "ko00364", "ko00625",
"ko00361", "ko00623", "ko00622", "ko00633", "ko00642", "ko00643",
"ko00791", "ko00930", "ko00363", "ko00621", "ko00626", "ko00624",
"ko00365", "ko00984", "ko00980", "ko00982", "ko00983", "ko01010",
"ko01060", "ko01061", "ko01062", "ko01063", "ko01064", "ko01065",
"ko01066", "ko01070", "ko03020", "ko03022", "ko03040", "ko03010",
"ko00970", "ko03013", "ko03015", "ko03008", "ko03060", "ko04141",
"ko04130", "ko04120", "ko04122", "ko03050", "ko03018", "ko03030",
"ko03410", "ko03420", "ko03430", "ko03440", "ko03450", "ko03460",
"ko03082", "ko03083", "ko03230", "ko03240", "ko03250", "ko03260",
"ko03271", "ko03262", "ko03261", "ko03263", "ko03264", "ko03265",
"ko03273", "ko03272", "ko03266", "ko03268", "ko03267", "ko03259",
"ko03258", "ko02010", "ko02060", "ko03070", "ko02020", "ko04010",
"ko04013", "ko04016", "ko04011", "ko04012", "ko04014", "ko04015",
"ko04310", "ko04330", "ko04340", "ko04341", "ko04350", "ko04390",
"ko04391", "ko04392", "ko04370", "ko04371", "ko04630", "ko04064",
"ko04668", "ko04066", "ko04068", "ko04020", "ko04070", "ko04072",
"ko04071", "ko04024", "ko04022", "ko04151", "ko04152", "ko04150",
"ko04075", "ko04080", "ko04082", "ko04081", "ko04060", "ko04061",
"ko04512", "ko04514", "ko04144", "ko04145", "ko04142", "ko04146",
"ko04140", "ko04138", "ko04136", "ko04137", "ko04139", "ko04148",
"ko04110", "ko04111", "ko04112", "ko04113", "ko04114", "ko04210",
"ko04214", "ko04215", "ko04216", "ko04217", "ko04115", "ko04218",
"ko04510", "ko04520", "ko04530", "ko04540", "ko04550", "ko02024",
"ko05111", "ko02025", "ko02026", "ko02030", "ko02040", "ko04814",
"ko04820", "ko04810", "ko04640", "ko04610", "ko04611", "ko04613",
"ko04620", "ko04624", "ko04621", "ko04622", "ko04623", "ko04625",
"ko04650", "ko04612", "ko04660", "ko04658", "ko04659", "ko04657",
"ko04662", "ko04664", "ko04666", "ko04670", "ko04672", "ko04062",
"ko04911", "ko04910", "ko04922", "ko04923", "ko04920", "ko03320",
"ko04929", "ko04912", "ko04913", "ko04915", "ko04914", "ko04917",
"ko04921", "ko04926", "ko04935", "ko04918", "ko04919", "ko04928",
"ko04916", "ko04924", "ko04614", "ko04925", "ko04927", "ko04260",
"ko04261", "ko04270", "ko04970", "ko04971", "ko04972", "ko04976",
"ko04973", "ko04974", "ko04975", "ko04979", "ko04977", "ko04981",
"ko04980", "ko04978", "ko04962", "ko04960", "ko04961", "ko04964",
"ko04966", "ko04724", "ko04727", "ko04725", "ko04728", "ko04726",
"ko04720", "ko04730", "ko04723", "ko04721", "ko04722", "ko04744",
"ko04745", "ko04740", "ko04742", "ko04750", "ko04320", "ko04360",
"ko04361", "ko04380", "ko04211", "ko04212", "ko04213", "ko04710",
"ko04713", "ko04711", "ko04712", "ko04714", "ko04626", "ko05200",
"ko05202", "ko05206", "ko05205", "ko05204", "ko05207", "ko05208",
"ko05203", "ko05230", "ko05231", "ko05235", "ko05210", "ko05212",
"ko05225", "ko05226", "ko05214", "ko05216", "ko05221", "ko05220",
"ko05217", "ko05218", "ko05211", "ko05219", "ko05215", "ko05213",
"ko05224", "ko05222", "ko05223", "ko05166", "ko05170", "ko05161",
"ko05160", "ko05171", "ko05164", "ko05162", "ko05168", "ko05163",
"ko05167", "ko05169", "ko05165", "ko05110", "ko05120", "ko05130",
"ko05132", "ko05131", "ko05135", "ko05133", "ko05134", "ko05150",
"ko05152", "ko05100", "ko05146", "ko05144", "ko05145", "ko05140",
"ko05142", "ko05143", "ko05310", "ko05322", "ko05323", "ko05320",
"ko05321", "ko05330", "ko05332", "ko05340", "ko05010", "ko05012",
"ko05014", "ko05016", "ko05017", "ko05020", "ko05022", "ko05030",
"ko05031", "ko05032", "ko05033", "ko05034", "ko05417", "ko05418",
"ko05410", "ko05412", "ko05414", "ko05415", "ko05416", "ko04930",
"ko04940", "ko04950", "ko04936", "ko04932", "ko04931", "ko04933",
"ko04934", "ko01501", "ko01502", "ko01503", "ko01521", "ko01524",
"ko01523", "ko01522", "ko07011", "ko07012", "ko07013", "ko07021",
"ko07019", "ko07020", "ko07014", "ko07023", "ko07026", "ko07044",
"ko07053", "ko07040", "ko07041", "ko07042", "ko07043", "ko07045",
"ko07032", "ko07030", "ko07033", "ko07015", "ko07039", "ko07028",
"ko07029", "ko07031", "ko07027", "ko07056", "ko07057", "ko07055",
"ko07016", "ko07017", "ko07018", "ko07037", "ko07038", "ko07046",
"ko07047", "ko07048", "ko07049", "ko07050", "ko07051", "ko07052",
"ko07054", "ko07220", "ko07215", "ko07214", "ko07213", "ko07212",
"ko07227", "ko07211", "ko07228", "ko07224", "ko07229", "ko07225",
"ko07226", "ko07223", "ko07222", "ko07221", "ko07230", "ko07036",
"ko07231", "ko07232", "ko07235", "ko07233", "ko07234", "ko07216",
"ko07219", "ko07024", "ko07217", "ko07218", "ko07025", "ko07034",
"ko07035", "ko07110", "ko07112", "ko07114", "ko07117"), Name = c("Metabolic pathways",
"Biosynthesis of secondary metabolites", "Microbial metabolism in diverse environments",
"Carbon metabolism", "2-Oxocarboxylic acid metabolism", "Fatty acid metabolism",
"Biosynthesis of amino acids", "Nucleotide metabolism", "Biosynthesis of nucleotide sugars",
"Biosynthesis of cofactors", "Degradation of aromatic compounds",
"Nitrogen cycle", "Sulfur cycle", "Glycolysis / Gluconeogenesis",
"Citrate cycle (TCA cycle)", "Pentose phosphate pathway", "Pentose and glucuronate interconversions",
"Fructose and mannose metabolism", "Galactose metabolism", "Ascorbate and aldarate metabolism",
"Starch and sucrose metabolism", "Pyruvate metabolism", "Glyoxylate and dicarboxylate metabolism",
"Propanoate metabolism", "Butanoate metabolism", "C5-Branched dibasic acid metabolism",
"Inositol phosphate metabolism", "Oxidative phosphorylation",
"Photosynthesis", "Photosynthesis - antenna proteins", "Carbon fixation by Calvin cycle",
"Other carbon fixation pathways", "Methane metabolism", "Nitrogen metabolism",
"Sulfur metabolism", "Fatty acid biosynthesis", "Fatty acid elongation",
"Fatty acid degradation", "Cutin, suberine and wax biosynthesis",
"Mycolic acid biosynthesis", "Steroid biosynthesis", "Primary bile acid biosynthesis",
"Secondary bile acid biosynthesis", "Steroid hormone biosynthesis",
"Glycerolipid metabolism", "Glycerophospholipid metabolism",
"Ether lipid metabolism", "Sphingolipid metabolism", "Arachidonic acid metabolism",
"Linoleic acid metabolism", "alpha-Linolenic acid metabolism",
"Biosynthesis of unsaturated fatty acids", "Purine metabolism",
"Pyrimidine metabolism", "Alanine, aspartate and glutamate metabolism",
"Glycine, serine and threonine metabolism", "Cysteine and methionine metabolism",
"Valine, leucine and isoleucine degradation", "Valine, leucine and isoleucine biosynthesis",
"Lysine biosynthesis", "Lysine degradation", "Arginine biosynthesis",
"Arginine and proline metabolism", "Histidine metabolism", "Tyrosine metabolism",
"Phenylalanine metabolism", "Tryptophan metabolism", "Phenylalanine, tyrosine and tryptophan biosynthesis",
"beta-Alanine metabolism", "Taurine and hypotaurine metabolism",
"Phosphonate and phosphinate metabolism", "Selenocompound metabolism",
"Cyanoamino acid metabolism", "D-Amino acid metabolism", "Glutathione metabolism",
"Amino sugar and nucleotide sugar metabolism", "Biosynthesis of various nucleotide sugars",
"N-Glycan biosynthesis", "Various types of N-glycan biosynthesis",
"Mucin type O-glycan biosynthesis", "Mannose type O-glycan biosynthesis",
"Other types of O-glycan biosynthesis", "Glycosaminoglycan biosynthesis - chondroitin sulfate / dermatan sulfate",
"Glycosaminoglycan biosynthesis - heparan sulfate / heparin",
"Glycosaminoglycan biosynthesis - keratan sulfate", "Glycosaminoglycan degradation",
"Glycosylphosphatidylinositol (GPI)-anchor biosynthesis", "Glycosphingolipid biosynthesis - lacto and neolacto series",
"Glycosphingolipid biosynthesis - globo and isoglobo series",
"Glycosphingolipid biosynthesis - ganglio series", "Other glycan degradation",
"Lipopolysaccharide biosynthesis", "O-Antigen repeat unit biosynthesis",
"Peptidoglycan biosynthesis", "Teichoic acid biosynthesis", "Lipoarabinomannan (LAM) biosynthesis",
"Arabinogalactan biosynthesis - Mycobacterium", "Exopolysaccharide biosynthesis",
"Thiamine metabolism", "Riboflavin metabolism", "Vitamin B6 metabolism",
"Nicotinate and nicotinamide metabolism", "Pantothenate and CoA biosynthesis",
"Biotin metabolism", "Lipoic acid metabolism", "Folate biosynthesis",
"One carbon pool by folate", "Retinol metabolism", "Porphyrin metabolism",
"Ubiquinone and other terpenoid-quinone biosynthesis", "Terpenoid backbone biosynthesis",
"Monoterpenoid biosynthesis", "Sesquiterpenoid and triterpenoid biosynthesis",
"Diterpenoid biosynthesis", "Carotenoid biosynthesis", "Brassinosteroid biosynthesis",
"Insect hormone biosynthesis", "Zeatin biosynthesis", "Limonene degradation",
"Pinene, camphor and geraniol degradation", "Type I polyketide structures",
"Biosynthesis of 12-, 14- and 16-membered macrolides", "Biosynthesis of ansamycins",
"Biosynthesis of enediyne antibiotics", "Biosynthesis of type II polyketide backbone",
"Biosynthesis of type II polyketide products", "Tetracycline biosynthesis",
"Polyketide sugar unit biosynthesis", "Nonribosomal peptide structures",
"Biosynthesis of siderophore group nonribosomal peptides", "Biosynthesis of vancomycin group antibiotics",
"Phenylpropanoid biosynthesis", "Stilbenoid, diarylheptanoid and gingerol biosynthesis",
"Flavonoid biosynthesis", "Flavone and flavonol biosynthesis",
"Anthocyanin biosynthesis", "Isoflavonoid biosynthesis", "Degradation of flavonoids",
"Indole alkaloid biosynthesis", "Indole diterpene alkaloid biosynthesis",
"Isoquinoline alkaloid biosynthesis", "Tropane, piperidine and pyridine alkaloid biosynthesis",
"Biosynthesis of various alkaloids", "Caffeine metabolism", "Betalain biosynthesis",
"Glucosinolate biosynthesis", "Benzoxazinoid biosynthesis", "Penicillin and cephalosporin biosynthesis",
"Carbapenem biosynthesis", "Monobactam biosynthesis", "Clavulanic acid biosynthesis",
"Streptomycin biosynthesis", "Neomycin, kanamycin and gentamicin biosynthesis",
"Acarbose and validamycin biosynthesis", "Novobiocin biosynthesis",
"Staurosporine biosynthesis", "Phenazine biosynthesis", "Prodigiosin biosynthesis",
"Aflatoxin biosynthesis", "Biosynthesis of various antibiotics",
"Biosynthesis of various plant secondary metabolites", "Biosynthesis of various other secondary metabolites",
"Benzoate degradation", "Aminobenzoate degradation", "Fluorobenzoate degradation",
"Chloroalkane and chloroalkene degradation", "Chlorocyclohexane and chlorobenzene degradation",
"Toluene degradation", "Xylene degradation", "Nitrotoluene degradation",
"Ethylbenzene degradation", "Styrene degradation", "Atrazine degradation",
"Caprolactam degradation", "Bisphenol degradation", "Dioxin degradation",
"Naphthalene degradation", "Polycyclic aromatic hydrocarbon degradation",
"Furfural degradation", "Steroid degradation", "Metabolism of xenobiotics by cytochrome P450",
"Drug metabolism - cytochrome P450", "Drug metabolism - other enzymes",
"Overview of biosynthetic pathways", "Biosynthesis of plant secondary metabolites",
"Biosynthesis of phenylpropanoids", "Biosynthesis of terpenoids and steroids",
"Biosynthesis of alkaloids derived from shikimate pathway", "Biosynthesis of alkaloids derived from ornithine, lysine and nicotinic acid",
"Biosynthesis of alkaloids derived from histidine and purine",
"Biosynthesis of alkaloids derived from terpenoid and polyketide",
"Biosynthesis of plant hormones", "RNA polymerase", "Basal transcription factors",
"Spliceosome", "Ribosome", "Aminoacyl-tRNA biosynthesis", "Nucleocytoplasmic transport",
"mRNA surveillance pathway", "Ribosome biogenesis in eukaryotes",
"Protein export", "Protein processing in endoplasmic reticulum",
"SNARE interactions in vesicular transport", "Ubiquitin mediated proteolysis",
"Sulfur relay system", "Proteasome", "RNA degradation", "DNA replication",
"Base excision repair", "Nucleotide excision repair", "Mismatch repair",
"Homologous recombination", "Non-homologous end-joining", "Fanconi anemia pathway",
"ATP-dependent chromatin remodeling", "Polycomb repressive complex",
"Viral genome structure", "Viral replication", "Viral life cycle - HIV-1",
"Virion - Human immunodeficiency virus", "Virion - Rotavirus",
"Virion - Coronavirus", "Virion - Influenza virus", "Virion - Enterovirus",
"Virion - Flavivirus and Alphavirus", "Virion - Ebolavirus, Lyssavirus and Morbillivirus",
"Virion - Lassa virus and SFTS virus", "Virion - Hepatitis viruses",
"Virion - Herpesvirus", "Virion - Orthopoxvirus", "Virion - Adenovirus",
"Virion - Bacteriophages T4 and T7", "Virion - Bacteriophage lambda",
"ABC transporters", "Phosphotransferase system (PTS)", "Bacterial secretion system",
"Two-component system", "MAPK signaling pathway", "MAPK signaling pathway - fly",
"MAPK signaling pathway - plant", "MAPK signaling pathway - yeast",
"ErbB signaling pathway", "Ras signaling pathway", "Rap1 signaling pathway",
"Wnt signaling pathway", "Notch signaling pathway", "Hedgehog signaling pathway",
"Hedgehog signaling pathway - fly", "TGF-beta signaling pathway",
"Hippo signaling pathway", "Hippo signaling pathway - fly", "Hippo signaling pathway - multiple species",
"VEGF signaling pathway", "Apelin signaling pathway", "JAK-STAT signaling pathway",
"NF-kappa B signaling pathway", "TNF signaling pathway", "HIF-1 signaling pathway",
"FoxO signaling pathway", "Calcium signaling pathway", "Phosphatidylinositol signaling system",
"Phospholipase D signaling pathway", "Sphingolipid signaling pathway",
"cAMP signaling pathway", "cGMP-PKG signaling pathway", "PI3K-Akt signaling pathway",
"AMPK signaling pathway", "mTOR signaling pathway", "Plant hormone signal transduction",
"Neuroactive ligand-receptor interaction", "Neuroactive ligand signaling",
"Hormone signaling", "Cytokine-cytokine receptor interaction",
"Viral protein interaction with cytokine and cytokine receptor",
"ECM-receptor interaction", "Cell adhesion molecules", "Endocytosis",
"Phagosome", "Lysosome", "Peroxisome", "Autophagy - animal",
"Autophagy - yeast", "Autophagy - other", "Mitophagy - animal",
"Mitophagy - yeast", "Efferocytosis", "Cell cycle", "Cell cycle - yeast",
"Cell cycle - Caulobacter", "Meiosis - yeast", "Oocyte meiosis",
"Apoptosis", "Apoptosis - fly", "Apoptosis - multiple species",
"Ferroptosis", "Necroptosis", "p53 signaling pathway", "Cellular senescence",
"Focal adhesion", "Adherens junction", "Tight junction", "Gap junction",
"Signaling pathways regulating pluripotency of stem cells", "Quorum sensing",
"Biofilm formation - Vibrio cholerae", "Biofilm formation - Pseudomonas aeruginosa",
"Biofilm formation - Escherichia coli", "Bacterial chemotaxis",
"Flagellar assembly", "Motor proteins", "Cytoskeleton in muscle cells",
"Regulation of actin cytoskeleton", "Hematopoietic cell lineage",
"Complement and coagulation cascades", "Platelet activation",
"Neutrophil extracellular trap formation", "Toll-like receptor signaling pathway",
"Toll and Imd signaling pathway", "NOD-like receptor signaling pathway",
"RIG-I-like receptor signaling pathway", "Cytosolic DNA-sensing pathway",
"C-type lectin receptor signaling pathway", "Natural killer cell mediated cytotoxicity",
"Antigen processing and presentation", "T cell receptor signaling pathway",
"Th1 and Th2 cell differentiation", "Th17 cell differentiation",
"IL-17 signaling pathway", "B cell receptor signaling pathway",
"Fc epsilon RI signaling pathway", "Fc gamma R-mediated phagocytosis",
"Leukocyte transendothelial migration", "Intestinal immune network for IgA production",
"Chemokine signaling pathway", "Insulin secretion", "Insulin signaling pathway",
"Glucagon signaling pathway", "Regulation of lipolysis in adipocytes",
"Adipocytokine signaling pathway", "PPAR signaling pathway",
"GnRH secretion", "GnRH signaling pathway", "Ovarian steroidogenesis",
"Estrogen signaling pathway", "Progesterone-mediated oocyte maturation",
"Prolactin signaling pathway", "Oxytocin signaling pathway",
"Relaxin signaling pathway", "Growth hormone synthesis, secretion and action",
"Thyroid hormone synthesis", "Thyroid hormone signaling pathway",
"Parathyroid hormone synthesis, secretion and action", "Melanogenesis",
"Renin secretion", "Renin-angiotensin system", "Aldosterone synthesis and secretion",
"Cortisol synthesis and secretion", "Cardiac muscle contraction",
"Adrenergic signaling in cardiomyocytes", "Vascular smooth muscle contraction",
"Salivary secretion", "Gastric acid secretion", "Pancreatic secretion",
"Bile secretion", "Carbohydrate digestion and absorption", "Protein digestion and absorption",
"Fat digestion and absorption", "Cholesterol metabolism", "Vitamin digestion and absorption",
"Folate transport and metabolism", "Cobalamin transport and metabolism",
"Mineral absorption", "Vasopressin-regulated water reabsorption",
"Aldosterone-regulated sodium reabsorption", "Endocrine and other factor-regulated calcium reabsorption",
"Proximal tubule bicarbonate reclamation", "Collecting duct acid secretion",
"Glutamatergic synapse", "GABAergic synapse", "Cholinergic synapse",
"Dopaminergic synapse", "Serotonergic synapse", "Long-term potentiation",
"Long-term depression", "Retrograde endocannabinoid signaling",
"Synaptic vesicle cycle", "Neurotrophin signaling pathway", "Phototransduction",
"Phototransduction - fly", "Olfactory transduction", "Taste transduction",
"Inflammatory mediator regulation of TRP channels", "Dorso-ventral axis formation",
"Axon guidance", "Axon regeneration", "Osteoclast differentiation",
"Longevity regulating pathway", "Longevity regulating pathway - worm",
"Longevity regulating pathway - multiple species", "Circadian rhythm",
"Circadian entrainment", "Circadian rhythm - fly", "Circadian rhythm - plant",
"Thermogenesis", "Plant-pathogen interaction", "Pathways in cancer",
"Transcriptional misregulation in cancer", "MicroRNAs in cancer",
"Proteoglycans in cancer", "Chemical carcinogenesis - DNA adducts",
"Chemical carcinogenesis - receptor activation", "Chemical carcinogenesis - reactive oxygen species",
"Viral carcinogenesis", "Central carbon metabolism in cancer",
"Choline metabolism in cancer", "PD-L1 expression and PD-1 checkpoint pathway in cancer",
"Colorectal cancer", "Pancreatic cancer", "Hepatocellular carcinoma",
"Gastric cancer", "Glioma", "Thyroid cancer", "Acute myeloid leukemia",
"Chronic myeloid leukemia", "Basal cell carcinoma", "Melanoma",
"Renal cell carcinoma", "Bladder cancer", "Prostate cancer",
"Endometrial cancer", "Breast cancer", "Small cell lung cancer",
"Non-small cell lung cancer", "Human T-cell leukemia virus 1 infection",
"Human immunodeficiency virus 1 infection", "Hepatitis B", "Hepatitis C",
"Coronavirus disease - COVID-19", "Influenza A", "Measles", "Herpes simplex virus 1 infection",
"Human cytomegalovirus infection", "Kaposi sarcoma-associated herpesvirus infection",
"Epstein-Barr virus infection", "Human papillomavirus infection",
"Vibrio cholerae infection", "Epithelial cell signaling in Helicobacter pylori infection",
"Pathogenic Escherichia coli infection", "Salmonella infection",
"Shigellosis", "Yersinia infection", "Pertussis", "Legionellosis",
"Staphylococcus aureus infection", "Tuberculosis", "Bacterial invasion of epithelial cells",
"Amoebiasis", "Malaria", "Toxoplasmosis", "Leishmaniasis", "Chagas disease",
"African trypanosomiasis", "Asthma", "Systemic lupus erythematosus",
"Rheumatoid arthritis", "Autoimmune thyroid disease", "Inflammatory bowel disease",
"Allograft rejection", "Graft-versus-host disease", "Primary immunodeficiency",
"Alzheimer disease", "Parkinson disease", "Amyotrophic lateral sclerosis",
"Huntington disease", "Spinocerebellar ataxia", "Prion disease",
"Pathways of neurodegeneration - multiple diseases", "Cocaine addiction",
"Amphetamine addiction", "Morphine addiction", "Nicotine addiction",
"Alcoholism", "Lipid and atherosclerosis", "Fluid shear stress and atherosclerosis",
"Hypertrophic cardiomyopathy", "Arrhythmogenic right ventricular cardiomyopathy",
"Dilated cardiomyopathy", "Diabetic cardiomyopathy", "Viral myocarditis",
"Type II diabetes mellitus", "Type I diabetes mellitus", "Maturity onset diabetes of the young",
"Alcoholic liver disease", "Non-alcoholic fatty liver disease",
"Insulin resistance", "AGE-RAGE signaling pathway in diabetic complications",
"Cushing syndrome", "beta-Lactam resistance", "Vancomycin resistance",
"Cationic antimicrobial peptide (CAMP) resistance", "EGFR tyrosine kinase inhibitor resistance",
"Platinum drug resistance", "Antifolate resistance", "Endocrine resistance",
"Penicillins", "Cephalosporins - parenteral agents", "Cephalosporins - oral agents",
"Aminoglycosides", "Tetracyclines", "Macrolides and ketolides",
"Quinolones", "Rifamycins", "Antifungal agents", "Antiviral agents",
"Anti-HIV agents", "Antineoplastics - alkylating agents", "Antineoplastics - antimetabolic agents",
"Antineoplastics - agents from natural products", "Antineoplastics - hormones",
"Antineoplastics - protein kinase inhibitors", "Hypnotics", "Anxiolytics",
"Anticonvulsants", "Local analgesics", "Opioid analgesics", "Antipsychotics",
"Antipsychotics - phenothiazines", "Antipsychotics - butyrophenones",
"Antidepressants", "Agents for Alzheimer-type dementia", "Antiparkinsonian agents",
"Sulfonamide derivatives - overview", "Sulfonamide derivatives - sulfa drugs",
"Sulfonamide derivatives - diuretics", "Sulfonamide derivatives - hypoglycemic agents",
"Antiarrhythmic drugs", "Antiulcer drugs", "Immunosuppressive agents",
"Osteoporosis drugs", "Antimigraines", "Antithrombosis agents",
"Antirheumatics - DMARDs and biological agents", "Antidiabetics",
"Antidyslipidemic agents", "Antiglaucoma agents", "Cholinergic and anticholinergic drugs",
"alpha-Adrenergic receptor agonists/antagonists", "beta-Adrenergic receptor agonists/antagonists",
"Dopamine receptor agonists/antagonists", "Histamine H1 receptor antagonists",
"Histamine H2/H3 receptor agonists/antagonists", "Serotonin receptor agonists/antagonists",
"Eicosanoid receptor agonists/antagonists", "Opioid receptor agonists/antagonists",
"Angiotensin receptor and endothelin receptor antagonists", "Glucocorticoid and mineralocorticoid receptor agonists/antagonists",
"Progesterone, androgen and estrogen receptor agonists/antagonists",
"Retinoic acid receptor (RAR) and retinoid X receptor (RXR) agonists/antagonists",
"Peroxisome proliferator-activated receptor (PPAR) agonists",
"Nicotinic cholinergic receptor antagonists", "GABA-A receptor agonists/antagonists",
"Calcium channel blocking drugs", "Sodium channel blocking drugs",
"Potassium channel blocking and opening drugs", "N-Methyl-D-aspartic acid (NMDA) receptor antagonists",
"Ion transporter inhibitors", "Neurotransmitter transporter inhibitors",
"Catecholamine transferase inhibitors", "Cyclooxygenase inhibitors",
"HMG-CoA reductase inhibitors", "Renin-angiotensin system inhibitors",
"HIV protease inhibitors", "Quinolines", "Eicosanoids", "Prostaglandins",
"Benzoic acid family", "1,2-Diphenyl substitution family", "Naphthalene family",
"Benzodiazepine family")), row.names = c(NA, -579L), class = "data.frame")
Two rather cool tricks will help.
nomatch
-argument in match()
and temporarily appending to the end of pathways_ref$ID
an additional element 'unknown'
, such that the index of 'unknown'
gets matched if there is no match
between row.names(abundance)
and pathways_ref$ID
. This avoids NA
's.make.unique()
if necessary. make.unique()
isn't costly, so the conditional statement isn't really needed. If you like to avoid it, then simply do row.names(abundance) = make.unique(n)
to be on the safe side.m = match(row.names(abundance), pathways_ref$ID, nomatch=nrow(pathways_ref)+1L)
n = c(pathways_ref$Name, 'unknown')[m]
# each nomatch=nrow(pathways_ref)+1L will be 'unknown'
row.names(abundance) = if (length(unique(n)) < length(n)) make.unique(n) else n
Note
Carrying important information in row names is debatable. Often extra work is needed to set-up tools, software, functions, ... to make use of row names. A simple alternative is to add a column, i.e.,
abundance$matches = make.unique(n) # or n
# if unique is only used to meet what `row.names()` requires for data frames