Skip to content

Rotate dendrograms#180

Merged
dan-knight merged 14 commits intomainfrom
hwinata-rotate-dendrograms
Apr 25, 2025
Merged

Rotate dendrograms#180
dan-knight merged 14 commits intomainfrom
hwinata-rotate-dendrograms

Conversation

@whelena
Copy link
Copy Markdown
Collaborator

@whelena whelena commented Apr 15, 2025

Description

Support rotating dendrogram trees

Small example

Screenshot 2025-04-14 at 22 01 19

Checklist

  • This PR does NOT contain Protected Health Information (PHI). A repo may need to be deleted if such data is uploaded.
    Disclosing PHI is a major problem1 - Even a small leak can be costly2.

  • This PR does NOT contain germline genetic data3, RNA-Seq, DNA methylation, microbiome or other molecular data4.

  • This PR does NOT contain other non-plain text files, such as: compressed files, images (e.g. .png, .jpeg), .pdf, .RData, .xlsx, .doc, .ppt, or other output files.

  To automatically exclude such files using a .gitignore file, see here for example.

  • I have read the code review guidelines and the code review best practice on GitHub check-list.

  • I have set up or verified the main branch protection rule following the github standards before opening this pull request.

  • The name of the branch is meaningful and well formatted following the standards, using [AD_username (or 5 letters of AD if AD is too long)]-[brief_description_of_branch].

  • I have added the major changes included in this pull request to the CHANGELOG.md under the next release version or unreleased, and updated the date.

Footnotes

  1. UCLA Health reaches $7.5m settlement over 2015 breach of 4.5m patient records

  2. The average healthcare data breach costs $2.2 million, despite the majority of breaches releasing fewer than 500 records.

  3. Genetic information is considered PHI.
    Forensic assays can identify patients with as few as 21 SNPs

  4. RNA-Seq, DNA methylation, microbiome, or other molecular data can be used to predict genotypes (PHI) and reveal a patient's identity.

@whelena
Copy link
Copy Markdown
Collaborator Author

whelena commented Apr 15, 2025

To do:

  • write unit tests
  • test on larger dendrograms to identify edge cases
  • document new functions

@whelena whelena requested a review from dan-knight April 16, 2025 00:05
R/angles.R Outdated
if (parent.id == -1) {
tree$angle[tree$tip == current.node.id] <- start.angle;
}
# if (parent.id == -1) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure don't need this root node case anymore?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember this is a duplicated statement from make.clone.tree.grobs.R line 79.

R/angles.R Outdated
v = v,
dx.scale = median(tree$length1)
);
# angles[tree$tip %in% child.ids] <- start.angle + angles[tree$tip %in% child.ids];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here. We're sure that split.equal.x.dist accounts for the parent angle properly?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from my naive try to just add start.angle to the dendrogram, but it doesn't exist prior to this PR.

@dan-knight dan-knight changed the title Hwinata rotate dendrograms Rotate dendrograms Apr 25, 2025

rotated <- rotate.dendrogram(df, rotate.by = pi / 2);

expect_equal(dim(rotated), dim(df));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for now. If we start getting more complex failures, it may be good to split each requirement into separate unit test cases. As it's written now, if theres a failure on line 39, line 40 won't be checked (for example).

@dan-knight dan-knight self-requested a review April 25, 2025 20:55
@dan-knight dan-knight merged commit a0d640e into main Apr 25, 2025
6 checks passed
@dan-knight dan-knight deleted the hwinata-rotate-dendrograms branch April 25, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants