You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thank you for building this useful R package. I have made various plots using alignment files and vcf metrics using the PHGmetrics constructor object metData. I was wondering if there is any way to change the order of the samples in this object and subsequently in the generated plots? Thank you.
The text was updated successfully, but these errors were encountered:
beantkapoor786
changed the title
Change order of samples in PHG graph
Change order of samples in metData object
Sep 16, 2024
Sorry for the late reply. We currently do not have a simple parameter to pass to the base plot functions, but since these plot objects are modified ggplot objects, we can directly manipulate the data slots for each sub-plot. Here is a reprex for manipulating gVCF plots:
# Get test data and plotmetBase<- system.file(
"extdata", "toy_gvcf_metrics.tsv",
package="rPHG2"
) |>
PHGMetrics()
pBase<-metBase|> plotGvcf()
# New sample ordernewOrder<- c("Xb02", "Xb03", "Xb01") # old levels (Xb01, Xb02, Xb03)# Make in-memory copypNewOrder<-pBase# Re-order copyfor(iin seq_len(length(pNewOrder))) {
pNewOrder[[i]]$data$taxa<-factor(
pNewOrder[[i]]$data$taxa,
levels=newOrder
)
}
# InspectpNewOrder
Hello, thank you for building this useful R package. I have made various plots using alignment files and vcf metrics using the
PHGmetrics
constructor objectmetData
. I was wondering if there is any way to change the order of the samples in this object and subsequently in the generated plots? Thank you.The text was updated successfully, but these errors were encountered: