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

## ----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.Osativa.MSU.RGAP7 <- ah[["AH122276"]]

## ----class--------------------------------------------------------------------
class(TxDb.Osativa.MSU.RGAP7)

## ----summary------------------------------------------------------------------
TxDb.Osativa.MSU.RGAP7

## ----summary-function---------------------------------------------------------
summary(TxDb.Osativa.MSU.RGAP7)

## ----chromosome---------------------------------------------------------------
seqinfo(TxDb.Osativa.MSU.RGAP7)

## ----avl-chromosomes----------------------------------------------------------
seqlevels(TxDb.Osativa.MSU.RGAP7)

## ----gene-annotations---------------------------------------------------------
gene_annotations <- genes(TxDb.Osativa.MSU.RGAP7)
gene_annotations

## ----transcript-annotations---------------------------------------------------
transcript_annotations <- transcripts(TxDb.Osativa.MSU.RGAP7)
head(transcript_annotations)

## ----exon-annotations---------------------------------------------------------
exon_annotations <- exons(TxDb.Osativa.MSU.RGAP7)
head(exon_annotations)

## ----cds----------------------------------------------------------------------
cds_annotations <- cds(TxDb.Osativa.MSU.RGAP7)
head(cds_annotations)

## ----promoters----------------------------------------------------------------
promoter_annotations <- promoters(
    TxDb.Osativa.MSU.RGAP7,
    upstream = 2000,
    downstream = 200
)
head(promoter_annotations)

## ----transcripts-by-gene------------------------------------------------------
tx_by_gene <- GenomicFeatures::transcriptsBy(
    TxDb.Osativa.MSU.RGAP7,
    by = "gene"
)
tx_by_gene

## ----exons-by-transcript------------------------------------------------------
exons_by_transcript <- GenomicFeatures::exonsBy(
    TxDb.Osativa.MSU.RGAP7,
    by = "tx"
)
exons_by_transcript

## ----msu-to-rap---------------------------------------------------------------
if (requireNamespace("riceidconverter", quietly = TRUE)) {
    library(riceidconverter)

    msu_ids <- c(
        "LOC_Os01g01010",
        "LOC_Os01g01019",
        "LOC_Os01g01040"
    )

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

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

