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

fastSmoothEMD code review suggestions #129

Closed
wants to merge 199 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
ab0a5ed
Add roxygen2 as suggested dependency
martintoreilly May 2, 2019
965f7da
Update documentation via Roxygen run
martintoreilly May 2, 2019
cb0fe73
Rename dendrogram vignettes
martintoreilly May 2, 2019
0999e70
Update titles for vignetted to reflect file renames
martintoreilly May 2, 2019
ebcf51f
Partial Netdis quickstart vignette
martintoreilly May 2, 2019
c6de628
Update dendrogram_example_net_dis.Rmd
jack89roberts Jun 7, 2019
54ba2f8
Update dendrogram_example_net_dis.Rmd
jack89roberts Jun 7, 2019
6a2a702
placeholders for next steps in netdis vignette
jack89roberts Jun 7, 2019
5a0ce2c
2 graph vignette and fn changes in progress
jack89roberts Jul 23, 2019
ea9a190
dropping of small ego networks moved to make_named_ego_graph
jack89roberts Jul 24, 2019
54fdabd
rename index entry of 2 graphs vignette
jack89roberts Jul 24, 2019
016e7a0
min_ego_nodes and min_ego_edges added to test_orca_interface
jack89roberts Jul 25, 2019
6db8c46
ego filtering args added to test_measures_net_dist
jack89roberts Jul 25, 2019
00589e0
comment prototype code to check all tests passing
jack89roberts Jul 25, 2019
707ca64
Update quickstart_netdis.Rmd
jack89roberts Jul 25, 2019
9bdfe76
expected and centred counts calculated
jack89roberts Jul 26, 2019
aa43c75
working 2 graph vignette for netdis
jack89roberts Jul 29, 2019
c112599
minor name tweaks
jack89roberts Jul 29, 2019
ac915cd
started refactoring according to style guides
jack89roberts Jul 29, 2019
85b9fb4
applied styler to whole package
jack89roberts Jul 30, 2019
33ccb41
added function taking 2 graphs, output netdis statistic
jack89roberts Jul 30, 2019
70277bc
functions for one-to-one, one-to-many and many-to-many
jack89roberts Jul 30, 2019
6f08ab7
Update quickstart_netdis_functions.Rmd
jack89roberts Jul 30, 2019
c8fe478
vignette using geometric poisson approximation
jack89roberts Aug 30, 2019
479f424
started constant counts vignette
jack89roberts Aug 30, 2019
e310b71
make scaling counts with graphlet tuples optional
jack89roberts Sep 2, 2019
3bafe7c
expected counts using query networks rather than ref network
jack89roberts Sep 4, 2019
8def02f
vignette for use of customisation functions
jack89roberts Sep 4, 2019
c01b003
fix broken tests for old netdis interface
jack89roberts Sep 5, 2019
f5c03b9
fix vignette names
jack89roberts Sep 5, 2019
036f1e1
fix old arg names and ordering in vignettes
jack89roberts Sep 5, 2019
1d70042
export single_density_bin function
jack89roberts Sep 5, 2019
7298201
some docs and formatting improvements
jack89roberts Sep 5, 2019
03d6262
add a docstring for all function parameters
jack89roberts Sep 6, 2019
12871d4
dendogram vignette with new interface
jack89roberts Sep 6, 2019
f6e566d
started adding tests for new functions
jack89roberts Sep 9, 2019
f6fb92e
few more tests
jack89roberts Sep 9, 2019
74e6849
test for netdis_expected_graphlet_counts_per_ego
jack89roberts Sep 10, 2019
65c2ea7
commit to mark pre-removal of old functions
jack89roberts Sep 11, 2019
10d3ca7
delete unused functions in measures_net_dis
jack89roberts Sep 11, 2019
2d2c2e1
rough test for netdis statistic functions
jack89roberts Sep 11, 2019
6dffaef
netdis_one_to_one test
jack89roberts Sep 11, 2019
8034b02
add tolerance to expect_equal
jack89roberts Sep 23, 2019
fcb36db
add tolerance (fix previous commit)
jack89roberts Sep 23, 2019
3a685c2
add missing definition of source_dir
jack89roberts Sep 23, 2019
c535b14
remove commented tests using old functions
jack89roberts Sep 23, 2019
a4adf53
many to many test
jack89roberts Sep 23, 2019
613f559
tidy comments
jack89roberts Sep 25, 2019
4a57a11
adding number of nodes to graphlet_counts objects
jack89roberts Sep 26, 2019
19a6bd3
count graphlet tuples using graphlet counts object only
jack89roberts Sep 26, 2019
323612a
density from graphlet counts objects
jack89roberts Sep 26, 2019
3c3cd16
expected counts functions using graphlet counts
jack89roberts Sep 27, 2019
8d75dd1
stopped passing around ego networks
jack89roberts Oct 8, 2019
ecc6b1d
add option to pass constant exp counts value
jack89roberts Oct 10, 2019
5f8969c
update one_to_one and one_to_many fns to reflect many_to_many changes
jack89roberts Oct 10, 2019
49f5b74
rebuild
jack89roberts Oct 11, 2019
b62c25c
update orca tests for objects with node counts
jack89roberts Oct 11, 2019
c05cff4
fix tuple count tests
jack89roberts Oct 11, 2019
bf40c3d
fix density test
jack89roberts Oct 11, 2019
48defe3
scale graphlet counts only for columns present in tuple counts
jack89roberts Oct 11, 2019
aac03f1
fix netdis_expected_graphlet_counts test
jack89roberts Oct 11, 2019
1a97875
fix expected graphlet counts test
jack89roberts Oct 11, 2019
09eb6e7
remove print statements
jack89roberts Oct 11, 2019
18f33f5
fix some lint errors
jack89roberts Oct 11, 2019
9a1dd4b
update some docstrings
jack89roberts Oct 11, 2019
678e93f
couple of tests to improve coverage
jack89roberts Oct 15, 2019
ab03a00
add additional cases to argument checking test
jack89roberts Oct 17, 2019
77cfb01
update some docstrings
jack89roberts Oct 18, 2019
4741511
started refactor to avoid storing all expected counts in memory
jack89roberts Nov 7, 2019
bf681ee
new centred counts function working
jack89roberts Nov 8, 2019
05d3043
Fix for NA exp counts in geometric poisson
jack89roberts Nov 12, 2019
6e8df48
add a test for using constant expected counts
jack89roberts Nov 12, 2019
41944e3
Rename some long variables
jack89roberts Mar 10, 2020
b3941a4
rebuild vignettes and docs
jack89roberts Mar 12, 2020
1f5d9d7
Formatting and whitespace
ots22 Apr 17, 2020
91c9561
Formatting
ots22 Apr 17, 2020
9151e52
Local for-loop index
ots22 Apr 17, 2020
b35563e
Combine some conditional cases in get_segment
ots22 Apr 17, 2020
0ca7c89
Combine cases for handling the leftmost segments (NetEmdSmoothV2)
ots22 Apr 17, 2020
c36c3f6
Remove unused function
ots22 Apr 17, 2020
4af238d
Rename loop counters
ots22 Apr 17, 2020
3feb0ae
added tests
andeElliott Apr 17, 2020
a398920
Iterable class to interleave two sequences in the required way
ots22 Apr 20, 2020
c302c43
added fast smooth header
andeElliott Apr 21, 2020
4b57f15
Merge branch 'fastSmoothEMD-review' of https://github.com/alan-turing…
andeElliott Apr 21, 2020
c02200e
lint whole package with styler
jack89roberts Apr 21, 2020
89bba30
updated tests
andeElliott Apr 21, 2020
14e1c82
Merge pull request #122 from alan-turing-institute/118-netdis-interfa…
jack89roberts Apr 21, 2020
5436310
remove browser
andeElliott Apr 21, 2020
ce8cbb3
Merge branch 'master' into fastSmoothEMD-review
andeElliott Apr 21, 2020
5c4dd42
Iterate over overlapping intervals
ots22 Apr 22, 2020
77b9338
Move overlapping segment iterator into fastSmoothV2.h
ots22 Apr 22, 2020
72de9ea
Use NumericVectors in tests
ots22 Apr 22, 2020
8e12200
Use overlapping interval iterator in NetEmdSmoothV2
ots22 Apr 22, 2020
857c91c
Small refactor of OverlappingSegments, and use for NetEmdSmoothV2
ots22 Apr 23, 2020
17ef75e
Small formatting changes
ots22 Apr 23, 2020
a67c2ce
Move begin() and end() after iterator class (fix breaking build)
ots22 Apr 23, 2020
4014aa0
TRIAL
leospinaf Jun 8, 2020
ebcad51
Create a vignette menu.
leospinaf Jun 8, 2020
00739e2
Menu Vignettte.
leospinaf Jun 8, 2020
d031fd7
Creation of a small menu of vignettes for the package.
leospinaf Jun 11, 2020
aefadd3
Change to names of dhist1 to dhist_1. Modification and renaming of ne…
leospinaf Jun 12, 2020
8ddcd9a
Automatic changes to files after running checks and clean+rebuild
leospinaf Jun 12, 2020
2e20243
Additional automatic changes to files after check and clean+rebuild (…
leospinaf Jun 12, 2020
6747d5e
Rename and modifications to net_emd to net_emd_one_to_one - test are …
leospinaf Jun 13, 2020
e4908a4
Changes to net_emd_one_to_one so that it takes graphs, matrices and d…
leospinaf Jun 15, 2020
5183988
Mostly automatic updates to files given changes in previous commit
leospinaf Jun 15, 2020
34e2bb5
Rename of net_emd to netemd
leospinaf Jun 22, 2020
6d8bbff
Pointing out the initial netemd name modifications from net_emd to ne…
leospinaf Jun 22, 2020
181ad70
Modifications to introductory vignette, function name changes and add…
leospinaf Jun 23, 2020
a59cc6f
test
leospinaf Jun 23, 2020
dd82b16
Latest package source built that is in use for pairwise comparisons c…
leospinaf Jun 23, 2020
d33ccbb
Important changes to functions for netdis_gp, mostly for the handling…
leospinaf Jun 24, 2020
25476ef
Current work on many_to_many vignette (trial for pushing)
leospinaf Jun 24, 2020
420f86d
make geometric poisson default if ref_graph null
jack89roberts Jun 27, 2020
1ab8407
check for null graphlet_counts_ref as well as ref_graph
jack89roberts Jun 27, 2020
370c28a
add graphlet_counts_ref argument to netdis_one_to_many
jack89roberts Jun 30, 2020
11c6507
bug fix missing graphlet_counts_ref
jack89roberts Jun 30, 2020
6ab9aba
Merge commit '11c6507ef676ab3cf3cb4bd69f775bbf81e91ff8' into Vignette…
leospinaf Jul 8, 2020
722f83e
Correct default functionallit of netdis call for GP variant. Renaming…
leospinaf Jul 13, 2020
2d34b25
Correct renaming of net emd many to many. Package documentation compi…
leospinaf Jul 13, 2020
df9a467
ManyToMany renaming and vignette working.
leospinaf Jul 13, 2020
4f0f7ce
Build checks done and passed with zero errors
leospinaf Jul 13, 2020
b34b2cd
pheatmap has been added to the dependencies. This is used in the vign…
leospinaf Jul 13, 2020
bbea2b8
Changes to figure sizes in many to many vignette
leospinaf Jul 14, 2020
3544a47
Error on Netdis GP for graphs with a number of connected nodes smalle…
leospinaf Jul 14, 2020
96b49b0
Update the name of parameters in netdis functions
leospinaf Dec 8, 2020
1dedcab
Update to Netdis step by step vignette. Update of some Vign names.
leospinaf Dec 8, 2020
12a94c6
Vignettes for STEP BY STEP Netdis classical and GP
leospinaf Dec 8, 2020
aa22d6b
Adding a plotting function for many-to-many comparisons
leospinaf Dec 9, 2020
180d9e2
Changing vignette for basic parameter changes of Netdis
leospinaf Dec 9, 2020
547a213
Small update to function definition. There is a need to do a larger u…
leospinaf Dec 9, 2020
891fc55
Check of Vignette Default Usage 1
leospinaf Dec 12, 2020
d9bfbab
Vignette 2 Update.
leospinaf Dec 13, 2020
daa4a26
Vignette 2 Update
leospinaf Dec 13, 2020
c4434c9
Previous small updates to dendrograms
leospinaf Dec 13, 2020
b00b259
Small text edits and updates to multiple files in relation to Vignett…
leospinaf Dec 14, 2020
c3ef790
New data to be used in one of the vignettes. The dataset are world t…
leospinaf Feb 3, 2021
be1371a
Content and checks into the examples and the text.
leospinaf Feb 3, 2021
08dabda
Fix a bug on Netemd many to many. List requires names.
leospinaf Feb 3, 2021
75cc2f8
Updates to the dataset used in NetEmd world trade - also updates to t…
leospinaf Feb 4, 2021
e1d2d51
Updates to the plotting functions
leospinaf Feb 4, 2021
ce672bb
Update to menu vignette
leospinaf Feb 4, 2021
fd820a3
These files come from the cache in world trade vignette... perhaps th…
leospinaf Feb 4, 2021
f1bff90
Review of pairwise vignette.
leospinaf Feb 8, 2021
a592f12
Review of pre-computed props
leospinaf Feb 8, 2021
7194a0b
Review of many to many Vign
leospinaf Feb 8, 2021
17a9bd5
Review Netdis steps Gold-Std
leospinaf Feb 8, 2021
978db43
Review of netdisgp and netdis custom...
leospinaf Feb 9, 2021
6831c6a
Review of netdis and netemd examples
leospinaf Feb 9, 2021
fb69186
Minor change to worltrade text
leospinaf Feb 9, 2021
2f8b145
Changes to NetEmd example dataset
leospinaf Feb 14, 2021
23d3de3
Small changes to text
leospinaf Feb 14, 2021
896f4ad
Updates to files after building
leospinaf Feb 14, 2021
e9a08a6
Some grammar checks
leospinaf Feb 17, 2021
1fd6fb7
removed the flag for sse to test if this will work on M1
andeElliott May 18, 2022
66f9f8f
attempt2 to fix the M1 issues
andeElliott May 18, 2022
dcff9a3
adding arg back in to see if it is needed
andeElliott May 18, 2022
e569025
Merge branch 'M1fix' into fastSmoothEMD-review-m1
andeElliott May 18, 2022
0a04e3b
updated Rcpp Exports
andeElliott May 18, 2022
474d895
update namespace to test if functions will export
andeElliott May 18, 2022
5d556a5
Update DESCRIPTION
leospinaf May 18, 2022
193f6c6
replace purrr::contains with purrr::has_element
jack89roberts Jun 1, 2022
19d7a82
Merge pull request #135 from alan-turing-institute/VignettesAndDoc
jack89roberts Jun 6, 2022
06e2f28
Merge pull request #139 from alan-turing-institute/fix/132-purr-contains
jack89roberts Jun 6, 2022
7529469
touch to check if travis is working
jack89roberts May 17, 2022
d6f384f
switch Travis bad to travis-ci.com
jack89roberts May 17, 2022
ebf59b3
run on R oldrel, release, and devel versions
jack89roberts Jun 1, 2022
6d34b9f
see if Travis will use R v4.1 and 4.2 if harcoded
jack89roberts Jun 1, 2022
e141bc3
try gh actions
jack89roberts Jun 1, 2022
587b4c3
add rcmdcheck
jack89roberts Jun 1, 2022
2c368c4
add rcmdcheck to setup dependencies
jack89roberts Jun 1, 2022
5c26bbf
placeholders for running on schedule and other versions
jack89roberts Jun 1, 2022
ba1410c
move dplyr and phangorn to suggested dependencies
jack89roberts Jun 1, 2022
d22565c
setup pandoc and latex in actions
jack89roberts Jun 6, 2022
9bbd739
remove space in docstring
jack89roberts Jun 6, 2022
2b6d48e
[#140] remove += syntax fro, PKG_CPPFLAGS
jack89roberts Jun 6, 2022
b2d31c0
fix docstring spacing in netdis_many_to_many
jack89roberts Jun 6, 2022
8720179
run devtools::check instead of rcmdcheck
jack89roberts Jun 6, 2022
a0d7aa8
rebuild docs
jack89roberts Jun 6, 2022
c1c219d
change badges to GitHub actions
jack89roberts Jun 6, 2022
619c546
removed the flag for sse to test if this will work on M1
andeElliott May 18, 2022
36cfa85
rename build action
jack89roberts Jun 6, 2022
d576f89
minor version bump
jack89roberts Jun 6, 2022
1f4d833
undo Makevars changes
jack89roberts Jun 6, 2022
17789bf
Merge pull request #142 from alan-turing-institute/test-travis
jack89roberts Jun 6, 2022
b364d16
pkgdown actions setup
jack89roberts Jun 6, 2022
2237b7d
add pkgdown action file contents
jack89roberts Jun 6, 2022
189b8f5
set branch to push from PR
jack89roberts Jun 6, 2022
b34bb8d
Merge pull request #145 from alan-turing-institute/pkgdown
jack89roberts Jun 6, 2022
73cdfec
update badge link
jack89roberts Jun 6, 2022
ee67bd4
update badge link
jack89roberts Jun 6, 2022
7c8055c
Merge branch 'master' into fastSmoothEMD-review
ots22 Jun 7, 2022
f11f068
Regenerated NAMESPACE and RcppExports.R after devtools::document()
ots22 Jun 7, 2022
13eba31
Update to renamed function in test case
ots22 Jun 8, 2022
d3ab662
Use Kahan summation in NetEmdSmoothV2
ots22 Jun 8, 2022
a543607
Remove old unused versions of fastSmooth
ots22 Jun 8, 2022
b0eb0a5
adding tests with previous version rather than integrate
andeElliott Jun 8, 2022
2abf918
Merge branch 'fastSmoothEMD-review' of github.com:alan-turing-institu…
andeElliott Jun 8, 2022
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
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
^data-raw$
^.travis.yml
^appveyor\.yml$
^doc$
^Meta$
75 changes: 75 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
- cron: "5 5 5 * *" # run at 05:05 on 5th day of each month

name: Build

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel'}
- {os: ubuntu-latest, r: 'devel'}
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
# on PR set branch to be able to push back, see https://github.com/actions/checkout/issues/124
- uses: actions/checkout@v2
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: actions/checkout@v2
if: github.event_name != 'pull_request'

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: true

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::devtools
any::covr

- name: Document
run: devtools::document()
shell: Rscript {0}

- name: Commit and push documentation changes
if: ${{ (matrix.config.os == 'ubuntu-latest') && (matrix.config.r == 'release') }}
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add man/\* NAMESPACE
git commit -m "Update documentation" || echo "No changes to commit"
git pull --ff-only
git push origin

- name: Check package
run: devtools::check()
shell: Rscript {0}

- name: Check coverage
run: covr::codecov(quiet = FALSE)
shell: Rscript {0}
41 changes: 41 additions & 0 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
release:
types: [published]

name: Website

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

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

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
*.so
*.dll
vignettes/.build.timestamp
inst/doc
doc
Meta
docs/
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

14 changes: 8 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: netdist
Title: An implementation of the NetEMD alignment-free network distance measure
Version: 0.4.9000
Version: 0.4.9100
Authors@R: person("Martin", "O'Reilly",email = "[email protected]",
role = c("aut", "cre"))
Description: An implementation of the NetEMD alignment-free network
Expand All @@ -20,13 +20,15 @@ Imports:
purrr,
lpSolve,
plyr,
dplyr,
Rcpp
pheatmap,
Rcpp,
Suggests:
dplyr,
phangorn,
testthat,
knitr,
phangorn,
rmarkdown
RoxygenNote: 6.0.1
rmarkdown,
roxygen2
RoxygenNote: 7.2.0
VignetteBuilder: knitr
Encoding: UTF-8
Binary file added Meta/vignette.rds
Binary file not shown.
31 changes: 18 additions & 13 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(NetEmdSmoothV2)
export(NetEmdSmooth)
export(adaptive_breaks)
export(area_between_dhist_ecmfs)
export(as_smoothed_dhist)
Expand All @@ -10,13 +9,15 @@ export(binned_densities_adaptive)
export(count_graphlet_tuples)
export(count_graphlet_tuples_ego)
export(count_graphlets_ego)
export(count_graphlets_ego_scaled)
export(count_graphlets_for_graph)
export(count_graphlets_per_node)
export(count_orbits_per_node)
export(counts_from_observations)
export(cross_comp_to_matrix)
export(cross_comparison_spec)
export(density_binned_counts)
export(density_binned_counts_gp)
export(density_from_counts)
export(dhist)
export(dhist_ecmf)
export(dhist_from_obs)
Expand All @@ -25,6 +26,8 @@ export(dhist_mean_location)
export(dhist_std)
export(dhist_variance)
export(ecmf_knots)
export(ego_network_density)
export(ego_to_graphlet_counts)
export(emd)
export(emd_cs)
export(emd_fast_no_smoothing)
Expand All @@ -46,29 +49,31 @@ export(min_emd)
export(min_emd_exhaustive)
export(min_emd_optimise)
export(min_emd_optimise_fast)
export(netEMDSpeedTest)
export(netEMDSpeedTestSmooth)
export(net_emd)
export(net_emds_for_all_graphs)
export(netdis)
export(netdis.plot)
export(netdis_centred_graphlet_counts)
export(netdis_centred_graphlet_counts_ego)
export(netdis_expected_graphlet_counts)
export(netdis_expected_graphlet_counts_ego)
export(netdis_expected_graphlet_counts_ego_fn)
export(netdis_for_all_graphs)
export(netdis_expected_counts)
export(netdis_many_to_many)
export(netdis_one_to_many)
export(netdis_one_to_one)
export(netdis_subtract_exp_counts)
export(netdis_uptok)
export(netemd.plot)
export(netemd_many_to_many)
export(netemd_one_to_one)
export(netemd_single_pair)
export(normalise_dhist_mass)
export(normalise_dhist_variance)
export(orbit_key)
export(orbit_to_graphlet_counts)
export(read_simple_graph)
export(read_simple_graphs)
export(scale_graphlet_count)
export(scale_graphlet_counts_ego)
export(shift_dhist)
export(simplify_graph)
export(single_density_bin)
export(sort_dhist)
export(zeros_to_ones)
import(Rcpp)
importFrom(Rcpp,evalCpp)
importFrom(Rcpp,sourceCpp)
useDynLib(netdist, .registration=TRUE)
56 changes: 56 additions & 0 deletions R/PlottingFunctions.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

#' Heatmap of Netdis many-to-many comparisons
#'
#' Provides a heatmap and dendrogram for the network comparisons via \code{pheatmap}.
#'
#' @param netdislist Default output of \code{netdis_many_to_many}.
#'
#' @param whatrow Selection of the row in \code{netdis_many_to_many$comp_spec} to be used for plotting.
#'
#' @param clustering_method Clustering method as allowed in the \code{pheatmap} function from the \code{pheatmap} package. The dendrogram will appear if \code{docluster} is TRUE (default).
#'
#' @param main Title of the plot.
#'
#' @param docluster controls the order of the rows and columns. If TRUE (default) the rows and columns will be reordered to create the dendrogram. If FALSE, then only the heatmap is drawn.
#'
#' @return Provides a heatmap and dendrogram for the network comparisons via \code{pheatmap}.
#' @export

netdis.plot <- function(netdislist,whatrow=c(1,2)[2],clustering_method="ward.D",main="Nedis",docluster=TRUE){
adjmat <- cross_comp_to_matrix(measure = netdislist$netdis[whatrow,], cross_comparison_spec = netdislist$comp_spec)
vnames <- rownames(adjmat)

legend1 <- seq(min(adjmat),max(adjmat),length.out = 5)
levels1 <- round(legend1,digits = 2)
pheatmap::pheatmap(mat = as.dist(adjmat),cluster_rows = docluster,cluster_cols = docluster,clustering_method = clustering_method,angle_col=45,main = main,treeheight_row = 80,labels_row = vnames,labels_col = vnames,display_numbers = TRUE,legend_breaks = legend1,legend_labels = levels1)
}




#' Heatmap of NetEmd many-to-many comparisons
#'
#' Provides a heatmap and dendrogram for the network comparisons via \code{pheatmap}.
#'
#' @param netdislist Default output of \code{netdis_many_to_many}.
#'
#' @param whatrow Selection of the row in \code{netdis_many_to_many$comp_spec} to be used for plotting.
#'
#' @param clustering_method Clustering method as allowed in the \code{pheatmap} function from the \code{pheatmap} package. The dendrogram will appear if \code{docluster} is TRUE (default).
#'
#' @param main Title of the plot.
#'
#' @param docluster controls the order of the rows and columns. If TRUE (default) the rows and columns will be reordered to create the dendrogram. If FALSE, then only the heatmap is drawn.
#'
#' @return Provides a heat map and dendrogram for the network comparisons via \code{pheatmap}.
#' @export

netemd.plot <- function(netemdlist,clustering_method="ward.D",main="NetEmd",docluster=TRUE){
adjmat <- cross_comp_to_matrix(measure = netemdlist$netemds, cross_comparison_spec = netemdlist$comp_spec)
vnames <- rownames(adjmat)

legend1 <- seq(min(adjmat),max(adjmat),length.out = 5)
levels1 <- round(legend1,digits = 2)
pheatmap::pheatmap(mat = as.dist(adjmat),cluster_rows = docluster,cluster_cols = docluster,clustering_method = clustering_method,angle_col=45,main = main,treeheight_row = 80,labels_row = vnames,labels_col = vnames,display_numbers = TRUE,legend_breaks = legend1,legend_labels = levels1)

}
10 changes: 0 additions & 10 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ emd_fast_no_smoothing <- function(locations1, values1, locations2, values2) {
#' Compute EMD
NULL

#'
#' @export
NetEmdSmooth <- function(loc1, val1, binWidth1, loc2, val2, binWidth2) {
.Call(`_netdist_NetEmdSmooth`, loc1, val1, binWidth1, loc2, val2, binWidth2)
}

#' @title
#' Compute EMD
NULL

#'
#' @export
NetEmdSmoothV2 <- function(loc1, val1, binWidth1, loc2, val2, binWidth2) {
Expand Down
29 changes: 25 additions & 4 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Protein-protein interaction (PPI) networks for 5 microorganisms
#'
#' A dataset containing the protein-protein interaction networks for the
#' A dataset containing the protein-protein interaction networks for the
#' following 5 microorganisms
#'\itemize{
#' \itemize{
#' \item EBV
#' \itemize{
#' \item Common name: Epstein Barr virus
Expand Down Expand Up @@ -33,11 +33,32 @@
#' \item Scientific name: Human alphaherpesvirus 3
#' \item TaxonomyID: 10335
#' }
#'}
#' }
#'
#' @format A list of \code{igraph} objects.
#' @source \strong{PPI data (EBV, HSV-1, KSHV, VZV):} Fossum E, Friedel CC, Rajagopala SV, Titz B, Baiker A, Schmidt T, et al. (2009) Evolutionarily Conserved Herpesviral Protein Interaction Networks. PLoS Pathog 5(9): e1000570. \url{https://doi.org/10.1371/journal.ppat.1000570}. Data from Table S2 in the supporting information.
#' @source \strong{PPI data (ECL):} Peregrín-Alvarez JM, Xiong X, Su C, Parkinson J (2009) The Modular Organization of Protein Interactions in Escherichia coli. PLoS Comput Biol 5(10): e1000523. \url{https://doi.org/10.1371/journal.pcbi.1000523}
#' @source \strong{Taxonomy ground truth:} NCBI taxonomy database. \url{https://www.ncbi.nlm.nih.gov/taxonomy}
#' @encoding UTF-8
"virusppi"
"virusppi"





#' World trade networks from 1985–2014
#'
#' The world trade data set consists of a small sample of world trade networks for the years 2001-2014, and pre-computed subgraph counts of a larger set of world trade networks (1985–2014). The world trade networks are based on the data set from [Feenstra et al., 2005] for the years 1962- 2000 and on the United Nations division COMTRADE [Division, 2015] for the years 2001-2014.
#'
#' \itemize{
#' \item wtnets: List of \code{igraph} objects providing the world trade networks from 2001–2014.
#' \item Counts: Pre-computed graphlet counts for the world trade networks in the years 1985-2014.
#' }
#'
#' @format A list of two elements. The first element, 'wtnets', is a list of \code{igraph} objects providing a small sample of world trade networks from 2001–2014. The second element, 'Counts', is a list of pre-computed subgraph counts of world trade networks in the years 1985-2014.
#' @source \strong{World trade networks:}. United nations commodity trade statistics database (UN comtrade). http://comtrade.un.org/, 2015.
#' @source \strong{Subgraph Counts:} Feenstra RC,Lipsey RE, Deng H, Ma AC, and Mo H. (2005) World trade flows: 1962-2000. Technical report, National Bureau of Economic Research. (See also https://cid.econ.ucdavis.edu/wix.html).
#'
#' @encoding UTF-8
"worldtradesub"

Loading