Repository navigation
Expand file tree
/
Copy pathLPSN_API_Process_Walkthrough.Rmd
More file actions
4318 lines (3735 loc) · 109 KB
/
Copy pathLPSN_API_Process_Walkthrough.Rmd
File metadata and controls
4318 lines (3735 loc) · 109 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Combined taxonomy files - LPSN taxa check"
author: "Rachele Gore"
date: "2026-09-30"
output:
html_document:
theme: sandstone
toc: TRUE
toc_float: TRUE
toc_depth: 6
highlight: tango
fig_retina: 1
fig_caption: yes
table_caption: yes
keep_md: yes
df_print: paged
self_contained: true
html_notebook:
theme: sandstone
toc_depth: 6
highlight: tango
fig_caption: yes
table_caption: yes
pdf_document:
dev: cairo_pdf
always_allow_html: true
---
Please run the 'setup' code block first.
It will ensure that the function file is uploaded as a global variable and
will allow you to directly call any functions in the function R script directly:
Any functions can be directly called using 'lpsn_utils$<function name>',
e.g.,
```{r setup, include=FALSE}
# Global set up: Show code blocks but don't run them by default when knitting
knitr::opts_chunk$set(echo = TRUE, eval = FALSE)
# Override: This specific chunk MUST run to load utility and API call functions
# Use 'include = FALSE' so the loading logic doesn't clutter the PDF/HTML with unnecessary information
## The code below is an alternative to calling the utilities/function file, e.g.,
## source("LPSN_API_functions.R", needed to load functions for this script
## Instead of running source("LPSN_API_functions.R") to load functions,
## call the function using directly with 'lpsn_utils$'
## e.g. lpsn_utils$page_data(raw_taxonomy, chunk_size = 10)
if (file.exists("LPSN_API_functions.R")) {
lpsn_utils <- new.env()
sys.source("LPSN_API_functions.R", envir = lpsn_utils)
}
```
R Language version
```{r, eval=TRUE}
cat("Current version: ", version$version.string, "\n")
```
Current working directory
```{r}
## check wd - file paths relative to wd
getwd()
```
# Prepare data for LPSN API
__Install LPSN package and load library__
```{r}
# Install LPSN package if needed and load LPSN API library
# install.packages("LPSN", repos="http://R-Forge.R-project.org")
library(LPSN)
```
## Import and split combined taxa tables
_Check file formats_
Import file and check data structure (eg Best_taxonomy.csv from AGRF). Split any combined columns and eliminate unwanted columns.
```{r}
# check column name and first row before importing
readr::read_delim(
file = "./data/Test_taxonomy.csv", # path where taxonomy file is located
n_max = 1)
# ── Column specification ────────────────────────
# Delimiter: ","
# chr (3): Feature ID, Taxon, Assignment Database
# dbl (1): Confidence
#
# ℹ Use `spec()` to retrieve the full column specification for this data.
# ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# # A tibble: 1 × 4
# `Feature ID` Taxon Confidence `Assignment Database`
# <chr> <chr> <dbl> <chr>
# 1 0005978dc14cfa9fd7b559b7721bf193 d__Bacteria; p__Bacteroidota; c__Bacteroid… 95 GTDB r207
# import file - only import wanted columns (`Feature ID`& Taxon)
raw_taxa <- readr::read_delim(
file = "./data/Test_taxonomy.csv", # path to where AGRF taxonomy file is
delim = ",", # columns are separated by commas
# select only Feature ID and Taxon columns
col_select = c("Feature ID", "Taxon"),
trim_ws = TRUE # get rid of preceding and trailing white spaces
) |>
## Set the first column containing ASVs as row names
tibble::column_to_rownames(var = "Feature ID")
nrow(raw_taxa)
# [1] 1080
## view data - truncated to max of 20 characters
subset <- utils::head(raw_taxa)
# Function: Truncate each cell to 10 characters
subset[] <- lapply(subset, function(col) {
# Convert to character, then truncate to 20 characters
substr(as.character(col), 1, 20)
})
# Print result
print(subset, quote = FALSE, right = FALSE)
# Taxonony in Taxon column separated by semicolons
Taxon
# 0005978dc14cfa9fd7b559b7721bf193 d__Bacteria; p__Bact
# 000a91f2e03d19b50ee4c7b2671054b6 d__Bacteria; p__Plan
# 000a95ae83d53c8a196b707c5e1dcfa6 d__Bacteria; p__Plan
# 000c1766c74a33f3cf38892dec91d664 d__Bacteria; p__Firm
# 001a898130b235a2d574339155c929e7 d__Bacteria; p__Firm
# 001dc02a5297ea9c762ef03546a4a6f4 d__Bacteria; p__Acti
# separate taxa into individual columns
taxtable <- raw_taxa |>
tibble::rownames_to_column("ASV") |> # keep ASVs as a column
tibble::as_tibble() |>
tidyr::separate(taxonomy,
sep = ";",
c("Domain",
"Phylum",
"Class",
"Order",
"Family",
"Genus",
"Species")
) |>
# remove preceding and trailing white spaces
dplyr::mutate(dplyr::across(dplyr::where(is.character), stringr::str_trim)) |>
# restore ASVs as rownames
tibble::column_to_rownames("ASV") |>
as.matrix()
# check variable names
colnames(taxtable)
# [1] "Domain" "Phylum" "Class" "Order" "Family" "Genus" "Species"
# check what the prefixes look like
# Show rows 1 to 3 and columns 1 and 3
utils::head(taxtable)[1:3,1:2]
## remove prefix for taxa names with functions saved in:
# LPSN_API_functions.R
taxtable_df <- lpsn_utils$remove_taxa_prefix(taxtable)
colnames(taxtable_df)
# [1] "Domain" "Phylum" "Class" "Order" "Family" "Genus" "Species"
# check data
subset <- utils::head(taxtable_df)
# Truncate each cell to 10 characters
subset[] <- lapply(subset, function(col) {
# Convert to character, then truncate
substr(as.character(col), 1, 20)
})
# check prefixes are gone
utils::head(subset)[1:3,1:2] # print out row 1:3 and col 1:2
# remove excess white spaces
df_clean <- taxtable_df |>
dplyr::mutate(dplyr::across(dplyr::where(is.character), stringr::str_trim))
# save objects
## save taxonomy with prefixes removed
saveRDS(df_clean, file = "./objects/taxa.dataframes.precleaned.noprefix.rds") # path to save objects
```
_Prepare data for taxonomy assignment_
Check for mitochondria and chloroplasts.
If found, remove from data
```{r}
### load object to be checked
df_clean <- readRDS(file = "./objects/taxa.dataframes.precleaned.noprefix.rds")
# Count occurrences of chloroplast or mitochondria in each column
counts <- df_clean |>
dplyr::mutate(
dplyr::across(
dplyr::everything(),
as.character
)
) |>
dplyr::summarise(
dplyr::across(
dplyr::everything(),
~ sum(
stringr::str_detect(
.,
stringr::regex(
"chloroplast|mitochondri",
ignore_case = TRUE)
),
na.rm = TRUE
)
)
) |>
tidyr::pivot_longer(
cols = dplyr::everything(),
names_to = "Taxonomic_level",
values_to = "Count"
)
print(counts)
# Taxonomic_level Count
# <chr> <int>
# 1 Domain 0
# 2 Phylum 0
# 3 Class 0
# 4 Order 0
# 5 Family 0
# 6 Genus 0
# 7 Species 0
# no mitochondrion or chloroplasts - no need for modification
```
_Removing unwanted ASVs_
Remove chloroplasts and mitochondria if present
```{r}
# Set search criteria
pattern <- "chloroplast|mitochondri"
# # select rows that match criteria
mito_chloro <- df_clean %>%
tibble::rownames_to_column("row_name") |>
dplyr::filter(dplyr::if_any(
dplyr::everything(), ~ base::grepl(pattern, .x, ignore.case = TRUE)))
utils::head(mito_chloro)
# remove the mito/chloroplast ASVs from df_clean dataframe
df_filtered <- df_clean[!base::rownames(df_clean) %in% mito_chloro$row_name, ]
# check that you only removed the required
base::nrow(df_clean)
base::nrow(df_filtered)
base::nrow(mito_chloro)
base::nrow(df_clean) - base::nrow(df_filtered)
## save taxonomy with prefixes removed
saveRDS(df_filtered, file = "./objects/taxa.dataframes.precleaned.noprefix.rds")
```
_Check data structure_
```{r}
# load data if starting in this block:
df_clean <- readRDS(file = "./objects/taxa.dataframes.precleaned.noprefix.rds")
# number of empty cells for each taxonomic level
df_clean |>
dplyr::summarise(across(everything(), ~ sum(is.na(.x) | .x == "")))
# Domain Phylum Class Order Family Genus Species
# 1 0 4 19 12 17 10 0
```
## Clean taxa names
LPSN does not contain place holder names (numbers and letters). Need to clean up the taxa names that are only made up of letters and remove suffixes added by AGRF.
Any taxa names with numbers will need manual curation, so you will need to decide how you want to clean your data - the LPSN API call will result in a record in the log for failed searches.
__Load Data__
```{r}
df_clean <- readRDS(file = "./objects/taxa.dataframes.precleaned.noprefix.rds")
```
### STEP 1: Remove underscores and initial orphaned letter codes
Check all columns and remove underscores, and any resulting single and double orphaned letters in columns with no numbers - means that the majority of the Species column will not be changed
```{r}
# Remove underscores and orphaned letters but it ignores anything with numbers
## will not clean all orphans - need to do a column by column check after this
df_trimmed <- df_clean |>
dplyr::mutate(dplyr::across(
c(Domain, Phylum, Class, Order, Family, Genus, Species),
~ ifelse(
stringr::str_detect(.x, "^[^0-9]+$"), # TRUE only if NO numbers anywhere
.x |>
stringr::str_replace_all("_", " ") |>
stringr::str_remove_all("\\b[A-Za-z]{1,2}\\b") |>
stringr::str_squish(),
.x # leave untouched if ANY number is present
)
))
head(df_trimmed)
# Domain Phylum Class Order
# 1 Bacteria Bacteroidota Bacteroidia Chitinophagales
# 2 Bacteria Planctomycetota Planctomycetia Isosphaerales
# 3 Bacteria Planctomycetota Planctomycetia Isosphaerales
# 4 Bacteria Firmicutes Bacilli Bacillales
# 5 Bacteria Firmicutes Bacilli Bacillales
# 6 Bacteria Actinobacteria Thermoleophilia Solirubrobacterales
# Family Genus
# 1 Chitinophagaceae Segetibacter
# 2 Isosphaeraceae Unclassified
# 3 Isosphaeraceae Tautonia
# 4 Bacillaceae Bacillus
# 5 Amphibacillaceae Unclassified
# 6 Solirubrobacteraceae Solirubrobacter
# Species
# 1 Segetibacter aerophilus
# 2 Unclassified
# 3 Tautonia rosea
# 4 Bacillus foraminis
# 5 Unclassified
# 6 Solirubrobacter ginsenosidimutans
# the number of rows should remain the same
sprintf("%d : %d", nrow(df_clean), nrow(df_trimmed))
# [1] "1080 : 1080"
## check row changes for record 705
# Transpose the combined rows
comparison <- t(rbind(df_clean[705, ], df_trimmed[705, ]))
colnames(comparison) <- c("Original", "Trimmed")
comparison
# Original Trimmed
# Domain "Bacteria" "Bacteria"
# Phylum "Proteobacteria" "Proteobacteria"
# Class "Alphaproteobacteria" "Alphaproteobacteria"
# Order "Sphingomonadales" "Sphingomonadales"
# Family "Sphingomonadaceae" "Sphingomonadaceae"
# Genus "Sphingoaurantiacus" "Sphingoaurantiacus"
# Species "Sphingoaurantiacus polygranulatus" "Sphingoaurantiacus polygranulatus"
# save trimmed object
saveRDS(df_trimmed, file = "./objects/taxa.dataframes.precleaned.trimmed.rds")
```
### STEP 2: Clean Species column (if populated)
Check if any single, double or triple string in species column.
Look for a space, exactly one uppercase letter, followed by a space or the end of the string.
Species that have not yet been give a species name can have a temporary species name beginning with "sp" and followed by a list of numbers, e.g, Massilia sp900129765. Remove the spXXXXX
To speed up the search, it is recommended that these temporary species names are removed.
```{r}
# load trimmed object
df_trimmed <- readRDS(file = "./objects/taxa.dataframes.precleaned.trimmed.rds")
# find taxa with orphans
matches <- df_trimmed[grepl("(^| )[A-Z]{1,3}( |$)", df_trimmed$Species), ]
# View the first few hits
head(matches)
# Domain Phylum Class Order Family Genus
# 61 Bacteria Proteobacteria Alphaproteobacteria Rhizobiales Rhizobiaceae Aureimonas
# 114 Bacteria Firmicutes Bacilli Paenibacillales NBRC-103111 Paenibacillus
# 314 Bacteria Cyanobacteria Cyanobacteriia Cyanobacteriales Nostocaceae Tolypothrix
# 408 Bacteria Proteobacteria Gammaproteobacteria Pseudomonadales Halomonadaceae Halomonas
# 419 Bacteria Firmicutes Bacilli Bacillales DSM-18226 Bacillus
# 420 Bacteria Firmicutes Bacilli Bacillales DSM-18226 Bacillus
# Species
# 61 Aureimonas A sp001425485
# 114 Paenibacillus E sp008017805
# 314 Tolypothrix B sp002368435
# 408 Halomonas C sp900961225
# 419 Bacillus BU sp000242895
# 420 Bacillus BU sp000242895
## Run the function to clean orphaned letters from species
# arguments: df, target_col, max_letters = 3
# Regex components:
# (^| ) specifies the start of the string OR a space before the letters.
# [A-Z]{1,3} Matches: one, two or 3 UPPERCASE letters
# ( |$) Requires the letters to be followed by either a space or end of string
#### Detection example
# | Text | Detected? |
# | ----------------- | --------- |
# | `"Bacteria A"` | Yes |
# | `"A Bacteria"` | Yes |
# | `"Bacteria AB"` | Yes |
# | `"Bacteria ABC"` | Yes |
# | `"Bacteria ABCD"` | No |
# | `"Bacteria abc"` | No |
results <- lpsn_utils$clean_orphaned_letters(
df_trimmed, # data frame
"Species", # column name
max_letters = 3 # max number of sequential UPPERCASE letters
)
# message
# Cleaning complete. 13 rows modified.
# Report of changes
report_species <- results$report
# Check the first 6 changes
head(report_species)
# Row_Index Original Cleaned
# 1 61 Aureimonas A sp001425485 Aureimonas sp001425485
# 2 114 Paenibacillus E sp008017805 Paenibacillus sp008017805
# 3 314 Tolypothrix B sp002368435 Tolypothrix sp002368435
# 4 408 Halomonas C sp900961225 Halomonas sp900961225
# 5 419 Bacillus BU sp000242895 Bacillus sp000242895
# 6 420 Bacillus BU sp000242895 Bacillus sp000242895
# assign the updated data to the original dataframe
df_trimmed <- results$data
# check specific row number to confirm change. eg row index 23
print(df_trimmed)[23,]
# Domain Phylum Class Order Family Genus
# 23 Bacteria Actinobacteriota Actinomycetia Propionibacteriales Nocardioidaceae Unclassified
# Species
# 23 Unclassified
# save report as csv if needed - as a log of changes from function
utils::write.csv(
report_species,
file = "species_cleaning_report.csv",
row.names = FALSE
)
# check for short taxa names and taxa with numbers
species_check <- lpsn_utils$find_suspicious_taxa(
df = df_trimmed,
target_col = "Species",
min_letters = 6,
export_csv = TRUE,
file = "species_suspicious_taxa.csv"
)
# 225 suspicious unique taxa identified in 'Species'.
### If you need to change it do the following:
# list unique instances of suspicious taxa
# Please NOTE: valid taxa can be prefixed with Candidatus,
# so the list returned should be checked before taxa names are changed
unique_spp <- unique(species_check$report$Taxon)
# I want the list printed with no row index:
cat(unique_spp, sep = "\n")
# 45385 sp002797395
# G192 sp019084075
# R267 sp013340205
# AC-14 sp005888325
# AC-51 sp005883885
# AG11 sp002215645
# AR9 sp003221455
# AV80 sp003218305
# BD2-11 sp002238605
# DP-1 sp005879605
# ER46 sp003054705
# Ga0077545 sp003347645
# Ga0077545 sp014191545
# R-H-3 sp002198675
# SB21 sp008933615
# Bin16 sp002238425
# DYL19 sp019008365
# FEB-7 sp016708825
# GCA-016699535 sp016699535
# Iso899 sp000421445
# JKG1 sp000526415
# KBS-96 sp000381625
# OLB15 sp016713325
# OLB17 sp003223025
# OLB7 sp016788565
# PCC7113 sp014695895
# SCN-69-37 sp001724025
# SCN-69-89 sp008039575
# SCN-70-22 sp016719105
# SDU3-3 sp009268125
# UBA1941 sp018267385
# UBA2466 sp016875135
# UBA3254 sp011328975
# UBA4093 sp002083825
# UBA4720 sp003134685
# UBA4720 sp017881465
# UBA5189 sp013822395
# UBA6163 sp007694185
# UBA668 sp002299395
# UBA8639 sp009377845
# Z2-YC6860 sp001579845
# 2-12-FULL-64-23 sp001770575
# DB6-IX sp003612895
# DSGV01 sp011057325
# DSJA01 sp011054185
# IMCC26207 sp001025035
# LNNU-3342 sp008711135
# MPNL01 sp002239005
# PSRF01 sp013817595
# QHVH01 sp003222245
# QHXM01 sp003222945
# SCUB01 sp004297465
# SHVA01 sp009691195
# SIAJ01 sp009691845
# SIRX01 sp004563715
# SKVR01 sp007693555
# SOKP01 sp013375475
# SYFT01 sp016871335
# SZAS-1 sp018266075
# SZUA-540 sp009731355
# VAZQ01 sp005883115
# VBCG01 sp016716425
# VBDL01 sp014873965
# VFZN01 sp016871195
# VGSZ01 sp016874845
# WHTC01 sp009379795
# WHTI01 sp009377815
# WHTX01 sp009377505
# WYBL01 sp011526565
# 12-FULL-67-14b sp016871275
# CSBr16-57R1 sp007116505
# CSBr16-57R1 sp018401275
# PALSA-647 sp003132585
# Palsa-739 sp003139545
# SCSIO-52909 sp011492945
# SCSIO-52909 sp902805985
# SCSIO-52909 sp902812425
# SEOHO-28 sp003044185
# CADCWI01 sp902806355
# CADEDH01 sp902826025
# CAHJWH01 sp009765965
# CAIKUF01 sp016702655
# CAIPTA01 sp903867855
# CAIQIQ01 sp903871935
# CAIVZM01 sp903910385
# CAIXZV01 sp903930745
# CAIYRB01 sp016874735
# CAIZPE01 sp016710525
# CAIZWU01 sp903936775
# Dongia sp000620685
# HGW-BRC1-1 sp002842095
# JAAUTJ01 sp014696105
# JAAUTN01 sp014695345
# JAAYLR01 sp016699405
# JABDFB01 sp013286765
# JABFSC01 sp009692435
# JABFXX01 sp016720595
# JACCTI01 sp902805675
# JACCZE01 sp013816415
# JACDCA01 sp013817065
# JACQFH01 sp016200145
# JACVSF01 sp014534085
# JADGQX01 sp017881445
# JADJHU01 sp016707425
# JADJOM01 sp016713435
# JADKFS01 sp016717335
# JAGNHS01 sp018001635
# JAGNWK01 sp017985985
# MEBICO9517 sp003285105
# Naasia sp017916505
# Devosia sp016698645
# SCGC-AG-212-J23 sp005881595
# Bacillus sp000242895
# Baekduia sp000688095
# Belnapia sp016773205
# Belnapia sp902805545
# FACHB-SPT15 sp014849525
# Massilia sp001412595
# Massilia sp012927275
# Massilia sp018119395
# Massilia sp900129765
# Massilia sp902506415
# UM-FILTER-63-12 sp002789955
# Halomonas sp900961225
# Hassallia sp002218085
# Nodularia sp015207155
# Pirellula sp001610875
# Rhodopila sp009765975
# Aliterella sp000332075
# Aureimonas sp001425485
# Flavitalea sp014873345
# Luteimonas sp902506295
# Luteitalea sp016865485
# Microvirga sp018069605
# Nafulsella sp017948555
# Nonomuraea sp003236395
# Paracoccus sp002732665
# Paracoccus sp004335005
# Pedococcus sp009707485
# Roseomonas sp003173615
# Roseomonas sp016107305
# Roseomonas sp017355405
# Rubrivivax sp016790225
# Stenomitos sp014695975
# Tannerella sp002890585
# Trichormus sp001548375
# Variovorax sp001541225
# Variovorax sp902506565
# Actinotalea sp014042015
# Caulobacter sp016467375
# Cupriavidus sp001725945
# Kouleothrix sp016722075
# Neobacillus sp004341175
# Planococcus sp000775575
# Pontibacter sp006385705
# Pontibacter sp014297265
# Ramlibacter sp013087525
# Rhizobacter sp001425785
# Rhodococcus sp005938745
# Roseococcus sp017355885
# Skermanella sp016653635
# Tolypothrix sp002368435
# Aquihabitans sp019048865
# Arthrobacter sp016405885
# Blastococcus sp000620185
# Blastococcus sp004570385
# Blastococcus sp900102425
# Blastococcus sp900188025
# Blastococcus sp900230285
# Cesiribacter sp000597885
# Gemmatimonas sp013004105
# Gemmatimonas sp016720905
# Hymenobacter sp012273015
# Nitrosomonas sp900112825
# Nitrosospira sp003050965
# Nocardioides sp013155375
# Nocardioides sp014360585
# Nocardioides sp016735675
# Nocardioides sp017916425
# Propylenella sp900110915
# Segetibacter sp017355875
# Streptomyces sp000527195
# Streptomyces sp008042155
# Modestobacter sp013408865
# Modestobacter sp019112525
# Paenibacillus sp000023585
# Paenibacillus sp008017805
# Paludisphaera sp001610895
# Salinisphaera sp003177035
# Salinisphaera sp017744135
# Bradyrhizobium sp018596315
# Ginsengibacter sp003721595
# Longimicrobium sp902805735
# Microterricola sp003610585
# Nostoc PCC-73102 commune
# Pseudonocardia sp001942185
# Pseudonocardia sp012911935
# Rhodomicrobium sp018619475
# Steroidobacter sp016801985
# Croceibacterium sp003569745
# Croceimicrobium sp018401735
# Flavisolibacter sp014163555
# Phyllobacterium sp000282595
# Salinimicrobium sp012038135
# Solirubrobacter sp000425945
# Anaeromyxobacter sp000964525
# Calycomorphotria sp007744515
# Geodermatophilus sp000701365
# Methylobacterium sp001422985
# Methylobacterium sp003217615
# Paracraurococcus sp004343615
# Sphingomicrobium sp000620665
# Sphingomicrobium sp014873475
# Sphingomicrobium sp016924655
# Crinalium 22.89 epipsammum
# Pseudarthrobacter sp002953935
# Pseudarthrobacter sp018613805
# Flavipsychrobacter sp004144175
# Noviherbaspirillum sp001428545
# Noviherbaspirillum sp003590875
# Noviherbaspirillum sp019052805
# Marinilactibacillus sp017599325
# Allosphingosinicella sp003347635
# Ellin5102
# soil
# Select the original taxa names from above list and type corrected name, add these to
# species_map vector and run function clean names. I am removing spXXXXXXXXX as these
# are not valid species names
# have chosen to clean the following species names
species_map <- c(
# format to use "original_name" = "correct_name"
# to remove that entry use "original_name" = "" [1] "45385 sp002797395"
"G192 sp019084075" = "",
"R267 sp013340205" = "",
"AC-14 sp005888325" = "",
"AC-51 sp005883885" = "",
"AG11 sp002215645" = "",
"AR9 sp003221455" = "",
"AV80 sp003218305" = "",
"BD2-11 sp002238605" = "",
"DP-1 sp005879605" = "",
"ER46 sp003054705" = "",
"Ga0077545 sp003347645" = "",
"Ga0077545 sp014191545" = "",
"R-H-3 sp002198675" = "",
"SB21 sp008933615" = "",
"Bin16 sp002238425" = "",
"DYL19 sp019008365" = "",
"FEB-7 sp016708825" = "",
"GCA-016699535 sp016699535" = "",
"Iso899 sp000421445" = "",
"JKG1 sp000526415" = "",
"KBS-96 sp000381625" = "",
"OLB15 sp016713325" = "",
"OLB17 sp003223025" = "",
"OLB7 sp016788565" = "",
"PCC7113 sp014695895" = "",
"SCN-69-37 sp001724025" = "",
"SCN-69-89 sp008039575" = "",
"SCN-70-22 sp016719105" = "",
"SDU3-3 sp009268125" = "",
"UBA1941 sp018267385" = "",
"UBA2466 sp016875135" = "",
"UBA3254 sp011328975" = "",
"UBA4093 sp002083825" = "",
"UBA4720 sp003134685" = "",
"UBA4720 sp017881465" = "",
"UBA5189 sp013822395" = "",
"UBA6163 sp007694185" = "",
"UBA668 sp002299395" = "",
"UBA8639 sp009377845" = "",
"Z2-YC6860 sp001579845" = "",
"2-12-FULL-64-23 sp001770575" = "",
"DB6-IX sp003612895" = "",
"DSGV01 sp011057325" = "",
"DSJA01 sp011054185" = "",
"IMCC26207 sp001025035" = "",
"LNNU-3342 sp008711135" = "",
"MPNL01 sp002239005" = "",
"PSRF01 sp013817595" = "",
"QHVH01 sp003222245" = "",
"QHXM01 sp003222945" = "",
"SCUB01 sp004297465" = "",
"SHVA01 sp009691195" = "",
"SIAJ01 sp009691845" = "",
"SIRX01 sp004563715" = "",
"SKVR01 sp007693555" = "",
"SOKP01 sp013375475" = "",
"SYFT01 sp016871335" = "",
"SZAS-1 sp018266075" = "",
"SZUA-540 sp009731355" = "",
"VAZQ01 sp005883115" = "",
"VBCG01 sp016716425" = "",
"VBDL01 sp014873965" = "",
"VFZN01 sp016871195" = "",
"VGSZ01 sp016874845" = "",
"WHTC01 sp009379795" = "",
"WHTI01 sp009377815" = "",
"WHTX01 sp009377505" = "",
"WYBL01 sp011526565" = "",
"12-FULL-67-14b sp016871275" = "",
"CSBr16-57R1 sp007116505" = "",
"CSBr16-57R1 sp018401275" = "",
"PALSA-647 sp003132585" = "",
"Palsa-739 sp003139545" = "",
"SCSIO-52909 sp011492945" = "",
"SCSIO-52909 sp902805985" = "",
"SCSIO-52909 sp902812425" = "",
"SEOHO-28 sp003044185" = "",
"CADCWI01 sp902806355" = "",
"CADEDH01 sp902826025" = "",
"CAHJWH01 sp009765965" = "",
"CAIKUF01 sp016702655" = "",
"CAIPTA01 sp903867855" = "",
"CAIQIQ01 sp903871935" = "",
"CAIVZM01 sp903910385" = "",
"CAIXZV01 sp903930745" = "",
"CAIYRB01 sp016874735" = "",
"CAIZPE01 sp016710525" = "",
"CAIZWU01 sp903936775" = "",
"Dongia sp000620685" = "Dongia",
"HGW-BRC1-1 sp002842095" = "",
"JAAUTJ01 sp014696105" = "",
"JAAUTN01 sp014695345" = "",
"JAAYLR01 sp016699405" = "",
"JABDFB01 sp013286765" = "",
"JABFSC01 sp009692435" = "",
"JABFXX01 sp016720595" = "",
"JACCTI01 sp902805675" = "",
"JACCZE01 sp013816415" = "",
"JACDCA01 sp013817065" = "",
"JACQFH01 sp016200145" = "",
"JACVSF01 sp014534085" = "",
"JADGQX01 sp017881445" = "",
"JADJHU01 sp016707425" = "",
"JADJOM01 sp016713435" = "",
"JADKFS01 sp016717335" = "",
"JAGNHS01 sp018001635" = "",
"JAGNWK01 sp017985985" = "",
"MEBICO9517 sp003285105" = "",
"Naasia sp017916505" = "Naasia",
"Devosia sp016698645" = "Devosia",
"SCGC-AG-212-J23 sp005881595" = "",
"Bacillus sp000242895" = "Bacillus",
"Baekduia sp000688095" = "Baekduia",
"Belnapia sp016773205" = "Belnapia",
"Belnapia sp902805545" = "Belnapia",
"FACHB-SPT15 sp014849525" = "",
"Massilia sp001412595" = "Massilia",
"Massilia sp012927275" = "Massilia",
"Massilia sp018119395" = "Massilia",
"Massilia sp900129765" = "Massilia",
"Massilia sp902506415" = "Massilia",
"UM-FILTER-63-12 sp002789955" = "",
"Halomonas sp900961225" = "Halomonas",
"Hassallia sp002218085" = "Hassallia",
"Nodularia sp015207155" = "Nodularia",
"Pirellula sp001610875" = "Pirellula",
"Rhodopila sp009765975" = "Rhodopila",
"Aliterella sp000332075" = "Aliterella",
"Aureimonas sp001425485" = "Aureimonas",
"Flavitalea sp014873345" = "Flavitalea",
"Luteimonas sp902506295" = "Luteimonas",
"Luteitalea sp016865485" = "Luteitalea",
"Microvirga sp018069605" = "Microvirga",
"Nafulsella sp017948555" = "Nafulsella",
"Nonomuraea sp003236395" = "Nonomuraea",
"Paracoccus sp002732665" = "Paracoccus",
"Paracoccus sp004335005" = "Paracoccus",
"Pedococcus sp009707485" = "Pedococcus",
"Roseomonas sp003173615" = "Roseomonas",
"Roseomonas sp016107305" = "Roseomonas",
"Roseomonas sp017355405" = "Roseomonas",
"Rubrivivax sp016790225" = "Rubrivivax",
"Stenomitos sp014695975" = "Stenomitos",
"Trichormus sp001548375" = "Trichormus",
"Variovorax sp001541225" = "Variovorax",
"Variovorax sp902506565" = "Variovorax",
"Actinotalea sp014042015" = "Actinotalea",
"Caulobacter sp016467375" = "Caulobacter",
"Cupriavidus sp001725945" = "Cupriavidus",
"Kouleothrix sp016722075" = "Kouleothrix",
"Neobacillus sp004341175" = "Neobacillus",
"Planococcus sp000775575" = "Planococcus",
"Pontibacter sp006385705" = "Pontibacter",
"Ramlibacter sp013087525" = "Ramlibacter",
"Rhizobacter sp001425785" = "Rhizobacter",
"Rhodococcus sp005938745" = "Rhodococcus",
"Roseococcus sp017355885" = "Roseococcus",
"Skermanella sp016653635" = "Skermanella",
"Tolypothrix sp002368435" = "Tolypothrix",
"Aquihabitans sp019048865" = "Aquihabitans",
"Blastococcus sp000620185" = "Blastococcus",
"Blastococcus sp004570385" = "Blastococcus",
"Blastococcus sp900102425" = "Blastococcus",
"Blastococcus sp900188025" = "Blastococcus",
"Blastococcus sp900230285" = "Blastococcus",
"Cesiribacter sp000597885" = "Cesiribacter",
"Gemmatimonas sp013004105" = "Gemmatimonas",
"Gemmatimonas sp016720905" = "Gemmatimonas",
"Hymenobacter sp012273015" = "Hymenobacter",
"Nitrosomonas sp900112825" = "Nitrosomonas",
"Nitrosospira sp003050965" = "Nitrosospira",
"Nocardioides sp013155375" = "Nocardioides",
"Nocardioides sp014360585" = "Nocardioides",
"Nocardioides sp016735675" = "Nocardioides",
"Nocardioides sp017916425" = "Nocardioides",
"Propylenella sp900110915" = "Propylenella",
"Segetibacter sp017355875" = "Segetibacter",
"Streptomyces sp000527195" = "Streptomyces",
"Streptomyces sp008042155" = "Streptomyces",
"Modestobacter sp013408865" = "Modestobacter",
"Modestobacter sp019112525" = "Modestobacter",
"Paenibacillus sp000023585" = "Paenibacillus",
"Paenibacillus sp008017805" = "Paenibacillus",
"Paludisphaera sp001610895" = "Paludisphaera",
"Salinisphaera sp003177035" = "Salinisphaera",
"Salinisphaera sp017744135" = "Salinisphaera",
"Bradyrhizobium sp018596315" = "Bradyrhizobium",
"Ginsengibacter sp003721595" = "Ginsengibacter",
"Longimicrobium sp902805735" = "Longimicrobium",
"Microterricola sp003610585" = "Microterricola",
"Nostoc PCC-73102 commune" = "Nostoc commune",
"Pseudonocardia sp001942185" = "Pseudonocardia",
"Pseudonocardia sp012911935" = "Pseudonocardia",
"Rhodomicrobium sp018619475" = "Rhodomicrobium",
"Steroidobacter sp016801985" = "Steroidobacter",
"Croceibacterium sp003569745" = "Croceibacterium",
"Croceimicrobium sp018401735" = "Croceimicrobium",
"Flavisolibacter sp014163555" = "Flavisolibacter",
"Phyllobacterium sp000282595" = "Phyllobacterium",
"Salinimicrobium sp012038135" = "Salinimicrobium",
"Solirubrobacter sp000425945" = "Solirubrobacter",
"Anaeromyxobacter sp000964525" = "Anaeromyxobacter",
"Calycomorphotria sp007744515" = "Calycomorphotria",
"Geodermatophilus sp000701365" = "Geodermatophilus",
"Methylobacterium sp001422985" = "Methylobacterium",
"Methylobacterium sp003217615" = "Methylobacterium",
"Paracraurococcus sp004343615" = "Paracraurococcus",
"Sphingomicrobium sp000620665" = "Sphingomicrobium",
"Sphingomicrobium sp014873475" = "Sphingomicrobium",