ExportVirusDataFrame {Virusparies} | R Documentation |
ExportVirusDataFrame: Export processed hittables and summary stats data frames
Description
Export data frames generated by Virusparies functions.
Usage
ExportVirusDataFrame(
df,
file_name,
dir_path = NULL,
file_type = NULL,
create_path = FALSE
)
Arguments
df |
A summary statistics or VirusHunterGatherer hittable data frame. |
file_name |
A character string naming the file, optionally including ".tsv" or ".csv" file extensions. If suffix is not provided, file_type will be used to determine the file type. |
dir_path |
A character string indicating the directory path where the file will be saved (default: current corking directory). |
file_type |
A character vector specifying the type of file to export. Can be "csv" or "tsv". If NULL and file_name does not specify a suffix, the function infers the file type based on the prefix in file_name. |
create_path |
Logical indicating whether to create the directory path specified in dir_path if it does not already exist (default: FALSE). |
Details
Functions in the Virusparies package can generate both plots and new data frames.
Data frames contain either summary statistics for contig length, E-value or identity in percentage
or a processed hittable for example outlier or observations below threshold, when running
VhgBoxplot
.
Both types of data frames can be exported via ExportVirusDataFrame
. Summary stats and hittables
can be exported as CSV files or in TSV format, if the user prefers the file type used in VirusHunterGatherer
hittables.
Value
A message indicating that export was successful.
Author(s)
Sergej Ruff
See Also
VirusHunterGatherer is available here: https://github.com/lauberlab/VirusHunterGatherer.
Examples
path <- system.file("extdata", "virushunter.tsv", package = "Virusparies")
file <- ImportVirusTable(path)
# generate a plot that returns both processed hittables (outlier) and summary stats
plot1 <- VhgBoxplot(file, x_column = "best_query", y_column = "ViralRefSeq_E")
# export hittable as tsv (same format as input hittables)
ExportVirusDataFrame(df=plot1$outlier,file_name="outlier",file_type="tsv",
dir_path=tempdir())
# export summary stats as csv
ExportVirusDataFrame(df=plot1$summary_stats,file_name="summarystats",
file_type="csv",dir_path=tempdir())