Arcadia-Science / sourmashconsumr

Working with the outputs of sourmash in R
https://arcadia-science.github.io/sourmashconsumr/
Other
25 stars 3 forks source link

converting tax annotate files to phyloseq object #69

Closed Htrivett closed 1 year ago

Htrivett commented 1 year ago

I have been using sourmashconsumr to convert phyloseq objects, but I keep getting the error:

Error in validObject(.Object) : invalid class “sample_data” object: Sample Data must have non-zero dimensions.

I have ensured there are no 0 within the data frames, and the sample name in the dataframe is correct, but I still have the error. Any advice as to what could be causing this error?

Code used below for reference-

read in CSV

taxonomy_annotate_df <- read_csv("sample1.51gtdb.with-lineages.csv") head(taxonomy_annotate_df)

metadata- new dataframe from existing data

query_name <- c("sample1.fq") metadata <- data.frame(query_name = query_name)

Replace Zero with NA Value in a dataframe

taxonomy_annotate_df [taxonomy_annotate_df == 0] <- NA

Converting from taxonomy annotate to phyloseq object

sample1_phyloseq <- from_taxonomy_annotate_to_phyloseq(taxonomy_annotate_df = taxonomy_annotate_df, metadata_df = metadata %>% tibble::column_to_rownames("query_name"))

Htrivett commented 1 year ago

empty file for metadata. fixed with edit to metadata