Hi, everyone.
Recently, I am writing a package and want to submit to bioconductor in the future. I almost finish the function, but I have not write a calss or generic function. Becasue I am new to writing package or R class. For now, my output of function are Granges class or data.frame, and my operation is about peakAnno, extract metaInfo and do some calculation using dply. For now, I just want my calss can store some meta info, like paramter and peakAnno result based on GRanges.
So I am wondering whether I should write my own class or using common class like Common Bioconductor Methods and Classes. I have noticed Granges calss have metadata attribute, which is a list. mabye I can write some meta info into it. like
> peak@metadata$"test" <- "a"
> peak@metadata
$test
[1] "a"
But I also noticed some package I always used, like DiffBind, ChIPseeker created their own class.
Please forgive me if I misunderstand something :)
Best wishes
Guandong Shang
Note that using direct slot access (with
@
) is a bad idea and strongly discouraged. Please always use accessor functions instead e.g.Cheers,
H.