I am using the Hisat2 - Stringtie - Ballgown pipeline that was published in nature protocols in 2016. When I upload my ballgown data in to r, I have 4 lane technical replicates per biological sample, in addition to 3 biological samples per condition (2 conditions total). This leads to 24 "samples" as Ballgown calls it. I have denoted which sample are tech_reps and biol_reps using the pData function. However, I'd like to collapse the technical replicates through average expression so that I'm left with 6 samples, 3 biological replicates per condition. I am not familiar working with S4 objects. I was able to get the average expression by using rowMeans(subset(bg@expr$trans, select = c(my columns)). I had averaged all technical replicates for each biological replicate, and then took a subset of that to eliminate the tech_rep columns. However, when I fed that bg object into stattest, I got the following error:
Error in `[.data.frame`(x, r, vars, drop = drop) :
undefined columns selected
Which leads me to believe I am doing this incorrectly. Any help would be greatly appreciated!!