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 count comparison functionality to clonalCompare() #432

Merged
merged 13 commits into from
Oct 31, 2024

Conversation

Qile0317
Copy link
Collaborator

@Qile0317 Qile0317 commented Oct 28, 2024

To address #428, this PR adds the argument proportion = TRUE to clonalCompare(). The default behvaiour of the function is identical to previous versions, but when prop = FALSE it uses counts instead of frequecies.

A minor change is that when exportTable=TRUE the output now is sorted first if the argument was specified. Technically a breaking change but I doubt people would be affected.

The functionality works but when I test the output, I divide the exported counts by the total number of clones and try to see if it would be identical to the proportions but its not. I think I am mis-understanding the exact behaviour here @ncborcherding. Is it instead supposed to be divided only by potentially filtered counts?

@Qile0317 Qile0317 self-assigned this Oct 28, 2024
@Qile0317 Qile0317 added the enhancement New feature or request label Oct 28, 2024
@Qile0317 Qile0317 changed the title [UNFINISHED] #428: add Count comparison functionality to clonalCompare() [UNFINISHED] add count comparison functionality to clonalCompare() Oct 28, 2024
@Qile0317 Qile0317 added the help wanted Extra attention is needed label Oct 28, 2024
Prop was added as a comment and not and argument
Made the new argument "proportion"
Updated NEWS and manual
@ncborcherding
Copy link
Owner

For proportion:

tbl[, 2] <- tbl[, 2] / sum(tbl[, 2])

This will take the individual clone count and divide by the size of the entire repertoire (number of clones * counts). If we were going to do by clones, it would be:

tbl[, 2] <- tbl[, 2] / length(tbl[, 2])

Sorry I went ahead and made a commit before I saw your question, which I think was probably you working through things. My bad.

Nick

@Qile0317
Copy link
Collaborator Author

@ncborcherding All good - I synced up my stuff and updated the test. Could you possible edit the added test file to reflect the intended behaviour? A bit confused here.

I was (perhaps mistakenly) just thinking that the feature requester in #428 wanted the Y axis to be raw totaled counts of all clones. But from your comment above the definition for when proportion=FALSE, it is normalized by repertoire diversity (number of clonotypes) - right?

@Qile0317 Qile0317 marked this pull request as ready for review October 30, 2024 03:25
@Qile0317
Copy link
Collaborator Author

Qile0317 commented Oct 30, 2024

@ncborcherding All good - I synced up my stuff and updated the test. Could you possible edit the added test file to reflect the intended behaviour? A bit confused here.

I was (perhaps mistakenly) just thinking that the feature requester in #428 wanted the Y axis to be raw totaled counts of all clones. But from your comment above the definition for when proportion=FALSE, it is normalized by repertoire diversity (number of clonotypes) - right?

ok, so I did this now everything is passing. I checked that for each sample group the scale factor from proportion to counts are identical. @ncborcherding Should I change the description of the function to highlight this "diversity normalization"? Otherwise this is ready for merge.

@Qile0317 Qile0317 changed the title [UNFINISHED] add count comparison functionality to clonalCompare() add count comparison functionality to clonalCompare() Oct 30, 2024
@Qile0317 Qile0317 removed the help wanted Extra attention is needed label Oct 31, 2024
@ncborcherding ncborcherding merged commit 8e0306a into ncborcherding:dev Oct 31, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants