Reads the overall_mapping_stats.txt files written by rgi bwt (via
sra2lab::rgi_runs() or sra2lab::rgi_local()), one per sample, into a
tibble with one row per sample: how many reads were sequenced, and how
many mapped to CARD's reference sequences. rgi_aggregate() uses
total_reads to compute RPKM; on its own, the table is a quick quality
check: a sample with very few reads, or an unusually low or high share
mapped, deserves a look.
Usage
rgi_mapping_stats(
results,
sample_pattern = NULL,
pattern = "\\.overall_mapping_stats\\.txt$"
)Arguments
- results
A directory (all files in it matching
patternare read) or a character vector ofoverall_mapping_stats.txtfiles.- sample_pattern
Optional regular expression (Perl-compatible) that extracts the sample ID from each file's path. Files where it does not match get
sample_idNA, with a warning.- pattern
Regular expression for the statistics files when
resultsis a directory.
Value
A tibble with sample_id, aligner, include_wildcard,
include_other_models, total_reads (both reads of a pair count),
mapped_reads, percent_mapped and stats_file.
Examples
rgi_mapping_stats(rgi_example("results"))
#> # A tibble: 18 × 8
#> sample_id aligner include_wildcard include_other_models total_reads
#> <chr> <chr> <lgl> <lgl> <dbl>
#> 1 SRR41520862 kma FALSE FALSE 12750611
#> 2 SRR41520863 kma FALSE FALSE 12160972
#> 3 SRR41520865 kma FALSE FALSE 12748266
#> 4 SRR41520867 kma FALSE FALSE 13057566
#> 5 SRR41520868 kma FALSE FALSE 12267248
#> 6 SRR41520869 kma FALSE FALSE 12864553
#> 7 SRR41520870 kma FALSE FALSE 12849541
#> 8 SRR41520873 kma FALSE FALSE 12741930
#> 9 SRR41520874 kma FALSE FALSE 12698830
#> 10 SRR41520876 kma FALSE FALSE 12316026
#> 11 SRR41520878 kma FALSE FALSE 7241566
#> 12 SRR41520879 kma FALSE FALSE 13169340
#> 13 SRR41520882 kma FALSE FALSE 11976553
#> 14 SRR41520884 kma FALSE FALSE 11287077
#> 15 SRR41520894 kma FALSE FALSE 10765452
#> 16 SRR41520897 kma FALSE FALSE 12883126
#> 17 SRR41520902 kma FALSE FALSE 20700103
#> 18 SRR41520919 kma FALSE FALSE 24319182
#> # ℹ 3 more variables: mapped_reads <dbl>, percent_mapped <dbl>,
#> # stats_file <chr>