Check for taxa occurrences within a radius around multiple samples using GBIF data
Source:R/tax_occur_multi_check_pq.R
tax_occur_multi_check_pq.RdThis function performs a species range check for taxa contained in a phyloseq object, for multiple samples based on their geographic coordinates (longitude and latitude).
Usage
tax_occur_multi_check_pq(
physeq = NULL,
taxonomic_rank = "currentCanonicalSimple",
min_occur = 0,
verbose = TRUE,
lon_column = NULL,
longitudes = NULL,
lat_column = NULL,
latitudes = NULL,
radius_km = 50,
...
)Arguments
- physeq
(required) A phyloseq object.
- taxonomic_rank
The taxonomic rank to use for the check. Default is "currentCanonicalSimple" which corresponds to the cleaned scientific names in the phyloseq object if [gna_verifier_pq()] was used with default parameter.
- min_occur
Minimum number of occurrences in the radius to keep the taxon (default: 0).
- verbose
(Logical, default: TRUE). Whether to print progress messages.
- lon_column
Column name in sample_data containing longitudes.
- longitudes
Vector of longitudes corresponding to samples in the phyloseq object. If provided, it overrides lon_column.
- lat_column
Column name in sample_data containing latitudes.
- latitudes
Vector of latitudes corresponding to samples in the phyloseq object. If provided, it overrides lat_column.
- radius_km
Numeric. Search radius in kilometers (default: 50). See ?[tax_occur_check_pq()].
- ...
Additional parameters passed to [tax_occur_check()].
Value
A list containing: - A tibble resulting from the concatenation of result of function [tax_occur_check()] for each GPS position. - A matrix of samples x taxa with the number of occurrences in the radius for each case of the matrix. - A new phyloseq object with taxa filtered based on min_occur. Be careful, the filtering may be very stringent.
Examples
data_fungi_mini_cleanNames <-
gna_verifier_pq(data_fungi_mini,
data_sources = 210
)
#> ✔ GNA verification summary:
#> • Total taxa in phyloseq: 45
#> • Taxa submitted for verification: 37
#> • Genus-level only taxa: 2
#> • Total matches found: 25
#> • Synonyms: 4 (including 4 at genus level)
#> • Accepted names: 21 (including 15 at genus level)
res_occur_check <-
tax_occur_multi_check_pq(subset_samples(data_fungi_mini_cleanNames, Diameter == 52),
longitudes = c(8.31, 8.31, 8.64, -1.19, 7.03),
latitudes = c(47.38, 47.38, 45.83, 43.65, 43.93)
)
#> ■■■■■■■■■ 25% | ETA: 0s
#> ℹ Processing GPS point: "8.31_47.38"
#> ■■■■■■■■■ 25% | ETA: 0s
#> Cleaning suppress 36 taxa and 0 samples.
#> ! No occurrences found for Stereum ostrea
#> ■■■■■■■■■ 25% | ETA: 0s
#> Reading ne_50m_land.zip from naturalearth...
#> ℹ After cleaning with CoordinateCleaner::clean_coordinates:
#> - 999 occurrences remain(s)
#> - Total original: 1000
#> - Retention rate: 99.9%
#> ■■■■■■■■■ 25% | ETA: 0s
#> ✔ Found 912 occurrences for species Stereum hirsutum:
#> ■■■■■■■■■ 25% | ETA: 0s
#> • Closest occurrence: 1.78 km
#> ■■■■■■■■■ 25% | ETA: 0s
#> ■■■■■■■■■■■■■■■■ 50% | ETA: 9s
#> ℹ Processing GPS point: "8.64_45.83"
#> ■■■■■■■■■■■■■■■■ 50% | ETA: 9s
#> Cleaning suppress 38 taxa and 0 samples.
#> ! No occurrences found for Stereum ostrea
#> ■■■■■■■■■■■■■■■■ 50% | ETA: 9s
#> ℹ Processing GPS point: "-1.19_43.65"
#> ■■■■■■■■■■■■■■■■ 50% | ETA: 9s
#> Cleaning suppress 40 taxa and 0 samples.
#> ! No occurrences found for Stereum ostrea
#> ■■■■■■■■■■■■■■■■ 50% | ETA: 9s
#> ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% | ETA: 0s
#>
#> ℹ Processing GPS point: "7.03_43.93"
#> Cleaning suppress 40 taxa and 0 samples.
#> ! No occurrences found for Stereum ostrea
#> Cleaning suppress 44 taxa ( ASV7 / ASV8 / ASV12 / ASV18 / ASV25 / ASV27 / ASV29 / ASV32 / ASV34 / ASV35 / ASV41 / ASV42 / ASV46 / ASV47 / ASV48 / ASV49 / ASV50 / ASV53 / ASV54 / ASV58 / ASV59 / ASV61 / ASV62 / ASV63 / ASV64 / ASV67 / ASV68 / ASV71 / ASV72 / ASV75 / ASV77 / ASV82 / ASV83 / ASV85 / ASV91 / ASV93 / ASV94 / ASV99 / ASV100 / ASV101 / ASV104 / ASV105 / ASV107 / ASV108 ) and 4 sample(s) ( A10-005-H_S189_MERGED.fastq.gz / A10-005-M_S190_MERGED.fastq.gz / AD32-007-M_S13_MERGED.fastq.gz / EC2-013-B_S104_MERGED.fastq.gz ).
#> ℹ After filtering taxa with at least 1 GBIF occurrences within 50km:/n - Taxa: 1/45 remain/n - Samples: 1/5 remain/n - Occurrences: 1/28 remain