## ----install, eval=FALSE------------------------------------------------------
# if (!requireNamespace("BiocManager", quietly = TRUE)) {
#     install.packages("BiocManager")
# }
# BiocManager::install("TxDb.Osativa.MSU.RGAP7")

## ----loading, message=FALSE, warning=FALSE------------------------------------
library(TxDb.Osativa.MSU.RGAP7)
library(AnnotationHub)
library(GenomicFeatures)
library(GenomicRanges)

## ----annotationhub, message=FALSE, warning=FALSE------------------------------
ah <- AnnotationHub::AnnotationHub()
txdb <- ah[["AH122276"]]

## ----class--------------------------------------------------------------------
class(txdb)

## ----summary------------------------------------------------------------------
txdb

## ----summary-function---------------------------------------------------------
summary(txdb)

## ----chromosome---------------------------------------------------------------
seqinfo(txdb)

## ----available-chromosomes----------------------------------------------------
seqlevels(txdb)

## ----gene-annotations---------------------------------------------------------
gene_annotations <- genes(txdb)
gene_annotations

## ----transcript-annotations---------------------------------------------------
transcript_annotations <- transcripts(txdb)
head(transcript_annotations)

## ----exon-annotations---------------------------------------------------------
exon_annotations <- exons(txdb)
head(exon_annotations)

## ----cds----------------------------------------------------------------------
cds_annotations <- cds(txdb)
head(cds_annotations)

## ----promoters----------------------------------------------------------------
promoter_annotations <- promoters(
    txdb,
    upstream = 2000,
    downstream = 200
)
head(promoter_annotations)

## ----transcripts-by-gene------------------------------------------------------
tx_by_gene <- GenomicFeatures::transcriptsBy(
    txdb,
    by = "gene"
)
tx_by_gene

## ----exons-by-transcript------------------------------------------------------
exons_by_transcript <- GenomicFeatures::exonsBy(
    txdb,
    by = "tx"
)
exons_by_transcript

## ----msu-to-rap---------------------------------------------------------------
if (requireNamespace("riceidconverter", quietly = TRUE)) {
    msu_ids <- c(
        "LOC_Os01g01010",
        "LOC_Os01g01019",
        "LOC_Os01g01040"
    )

    rap_ids <- msu_to_rap(msu_ids)
    print(rap_ids)
}

## ----sessioninfo--------------------------------------------------------------
sessionInfo()

