assign-taxa_names: Replace OTU identifier names

Description Usage Arguments Examples

Description

Replace OTU identifier names

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
taxa_names(x) <- value

## S4 replacement method for signature 'ANY,ANY'
taxa_names(x) <- value

## S4 replacement method for signature 'ANY,character'
taxa_names(x) <- value

## S4 replacement method for signature 'otu_table,character'
taxa_names(x) <- value

## S4 replacement method for signature 'taxonomyTable,character'
taxa_names(x) <- value

## S4 replacement method for signature 'phylo,character'
taxa_names(x) <- value

## S4 replacement method for signature 'XStringSet,character'
taxa_names(x) <- value

## S4 replacement method for signature 'phyloseq,character'
taxa_names(x) <- value

Arguments

x

(Required). An object defined by the phyloseq-package that describes OTUs in some way.

value

(Required). A character vector to replace the current taxa_names.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data("esophagus")
taxa_names(esophagus)
# plot_tree(esophagus, label.tips="taxa_names", ladderize="left")
taxa_names(esophagus) <- paste("OTU-", taxa_names(esophagus), sep="")
taxa_names(esophagus)
# plot_tree(esophagus, label.tips="taxa_names", ladderize="left")
## non-characters are first coerced to characters.
taxa_names(esophagus) <- 1:ntaxa(esophagus)
taxa_names(esophagus)
# plot_tree(esophagus, label.tips="taxa_names", ladderize="left")
## Cannot assign non-unique or differently-lengthed name vectors. Error.
# taxa_names(esophagus) <- sample(c(TRUE, FALSE), ntaxa(esophagus), TRUE)
# taxa_names(esophagus) <- sample(taxa_names(esophagus), ntaxa(esophagus)-5, FALSE)

Example output

 [1] "59_8_22" "59_5_13" "59_8_12" "65_3_22" "65_5_1"  "65_1_10" "65_7_12"
 [8] "59_6_1"  "65_2_17" "65_9_26" "65_5_18" "65_7_5"  "65_8_12" "65_9_1" 
[15] "59_9_26" "9_6_28"  "65_7_4"  "65_4_26" "9_2_24"  "65_1_17" "65_6_7" 
[22] "9_4_3"   "65_7_18" "65_8_7"  "59_4_5"  "59_5_2"  "65_6_2"  "65_4_10"
[29] "9_7_25"  "9_4_5"   "65_1_8"  "65_2_5"  "59_7_6"  "59_9_31" "9_1_7"  
[36] "9_4_13"  "9_6_3"   "65_4_5"  "59_9_18" "65_9_13" "65_3_18" "65_6_10"
[43] "9_7_18"  "65_8_25" "59_3_5"  "65_8_29" "65_4_20" "59_6_11" "59_9_17"
[50] "9_4_6"   "59_4_25" "59_3_21" "59_3_19" "59_4_16" "59_8_3"  "59_5_19"
[57] "65_9_9"  "59_2_6" 
 [1] "OTU-59_8_22" "OTU-59_5_13" "OTU-59_8_12" "OTU-65_3_22" "OTU-65_5_1" 
 [6] "OTU-65_1_10" "OTU-65_7_12" "OTU-59_6_1"  "OTU-65_2_17" "OTU-65_9_26"
[11] "OTU-65_5_18" "OTU-65_7_5"  "OTU-65_8_12" "OTU-65_9_1"  "OTU-59_9_26"
[16] "OTU-9_6_28"  "OTU-65_7_4"  "OTU-65_4_26" "OTU-9_2_24"  "OTU-65_1_17"
[21] "OTU-65_6_7"  "OTU-9_4_3"   "OTU-65_7_18" "OTU-65_8_7"  "OTU-59_4_5" 
[26] "OTU-59_5_2"  "OTU-65_6_2"  "OTU-65_4_10" "OTU-9_7_25"  "OTU-9_4_5"  
[31] "OTU-65_1_8"  "OTU-65_2_5"  "OTU-59_7_6"  "OTU-59_9_31" "OTU-9_1_7"  
[36] "OTU-9_4_13"  "OTU-9_6_3"   "OTU-65_4_5"  "OTU-59_9_18" "OTU-65_9_13"
[41] "OTU-65_3_18" "OTU-65_6_10" "OTU-9_7_18"  "OTU-65_8_25" "OTU-59_3_5" 
[46] "OTU-65_8_29" "OTU-65_4_20" "OTU-59_6_11" "OTU-59_9_17" "OTU-9_4_6"  
[51] "OTU-59_4_25" "OTU-59_3_21" "OTU-59_3_19" "OTU-59_4_16" "OTU-59_8_3" 
[56] "OTU-59_5_19" "OTU-65_9_9"  "OTU-59_2_6" 
 [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" "14" "15"
[16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30"
[31] "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45"
[46] "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" "58"

phyloseq documentation built on Nov. 8, 2020, 6:41 p.m.