Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial documentation #4

Merged
merged 9 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ jobs:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}
# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
# - {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: test-coverage

jobs:
test-coverage:
runs-on: macos-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## General ----
*.swp
*.swo
*.html
*.pdf
.DS_Store
.httr-oauth
vignettes/*.log
vignettes/figure/

.Rproj.user
.Rhistory
.RData
Expand Down
10 changes: 8 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rPHG2
Title: R interface to PHGv2
Version: 0.3
Version: 0.3.1
Authors@R:
person(
given = "Brandon",
Expand All @@ -20,6 +20,9 @@ Description:
from unphased species characterized by low genetic diversity and
high-density genotyping.
License: Apache License (>= 2) | file LICENSE
URL:
https://github.com/maize-genetics/rPHG2,
https://rphg2.maizegenetics.net/
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Expand All @@ -35,6 +38,9 @@ Imports:
methods,
rJava,
tibble
Suggests:
VignetteBuilder: knitr
Suggests:
knitr,
rmarkdown,
testthat (>= 3.0.0)
Config/testthat/edition: 3
33 changes: 0 additions & 33 deletions NEWS

This file was deleted.

7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## rPHG2 0.4
* Added vignettes and README updates
+ `vignette("rPHG2")`
* Created build system for website generation
+ [rphg2.maizegenetics.net](https://rphg2.maizegenetics.net)


## rPHG2 0.3
* Added new class, `PHGDataSet`
+ In memory representation of hVCF data sets
Expand Down
66 changes: 59 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<!-- badges: start -->
[![Life Cycle Status](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![R-CMD-check](https://github.com/maize-genetics/rPHG2/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/maize-genetics/rPHG2/actions/workflows/check-standard.yaml)
[![codecov](https://codecov.io/gh/maize-genetics/rPHG2/graph/badge.svg?token=BEEI8KZ96H)](https://codecov.io/gh/maize-genetics/rPHG2)
<!-- badges: end -->

`rPHG2` is a system to interact with and retrieve information from **version 2**
Expand All @@ -15,19 +17,69 @@ framework for genotype inference. This is accomplished by leveraging the
You can install the development version of rphg2 from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("maize-genetics/rPHG2")
# install.packages("pak")
pak::pak("maize-genetics/rPHG2")
```

## Example

This is a basic example which shows you how to solve a common problem:
## Usage

### Initialize with PHGv2 JARs
``` r
library(rphg2)
initPhg("my/phg/jar/path")
```

### Create a connection
``` r
locCon <- list.files("my/hvcf/dir") |>
PHGLocalCon()
```

### Build a graph
``` r
graph <- locCon |> buildHaplotypeGraph()
```

### Read data into R
``` r
phgDs <- graph |> readPhgDataSet()
```

### Identify areas of interest
``` r
gr <- GRanges(
seqnames = c("1", "2"),
ranges = IRanges(
c(100, 800),
c(400, 900)
)
)

phgDs |>
filterSamples(c("B73", "Ky21", "Mo17")) |>
filterRefRanges(gr)
```


## Lifecycle
[![Life Cycle Status](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)

phgCon <- PHGServerCon("localhost", 8080, "http")
`rPHG2` is a relatively new R package and may be subject to changes in
workflow and function definitions. If you would like to see anything added
or run into problems, please feel free to contact the team using the
[issues page](https://github.com/maize-genetics/rPHG2/issues).

phgCon |> readSamples()

## Learning rPHG2
If installed locally, you can read the "Introduction to rPHG2" vignette by
using:

``` r
vignette("rPHG2")
```

Alternatively, the package's [website](https://rphg2.maizegenetics.net) is
another great place to read up on function usage, code changes, and
workflows.


14 changes: 0 additions & 14 deletions _pkgdown.yml

This file was deleted.

33 changes: 33 additions & 0 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
url: https://rphg2.maizegenetics.net

template:
theme: breeze-light
bootstrap: 5
bslib:
base_font: {google: "Barlow"}
heading_font: {google: "Oswald"}
code_font: {google: "Roboto Mono"}
extra_css: pkgdown/extra.css

navbar:
structure:
left: [intro, articles, reference, news]
right: [search, github, phg]
components:
phg:
icon: fa-dna
href: https://github.com/maize-genetics/phg_v2
aria-label: PHG Source

footer:
structure:
left: acknowledgment
components:
acknowledgment: <b>rPHG2</b> is an R package developed by <a href="https://www.maizegenetics.net/">The Buckler Lab</a>

home:
links:
- text: Report a bug
href: https://github.com/maize-genetics/rPHG2/issues


6 changes: 6 additions & 0 deletions pkgdown/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.navbar-brand {
font-family: 'Oswald', sans-serif; /* Change font family */
font-size: 20px; /* Change font size */
font-weight: bold; /* Make font bold */
color: #363636; /* Change font color to red */
}
2 changes: 1 addition & 1 deletion rphg2.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ LineEndingConversion: Posix
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
PackageRoxygenize: rd,collate,namespace,vignette
6 changes: 6 additions & 0 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ getLatestReleaseUrl <- function(repo) {

response <- httr::GET(apiUrl)

message(" * API total rate...............: ", response$headers$`x-ratelimit-limit`)
message(" * API rate limit (remaining)...: ", response$headers$`x-ratelimit-remaining`)
message(" * API rate limit (used)........: ", response$headers$`x-ratelimit-used`)
message(" * UTC Epoch time to reset......: ", response$headers$`x-ratelimit-reset`)


# Check if the request was successful
if (httr::http_status(response)$category != "Success") {
stop(
Expand Down
Loading
Loading