Skip to content

Fix unicode error in Github Action#214

Merged
jarbet merged 10 commits intomainfrom
jarbet-fix-unicode-error-GHA
Jun 25, 2025
Merged

Fix unicode error in Github Action#214
jarbet merged 10 commits intomainfrom
jarbet-fix-unicode-error-GHA

Conversation

@jarbet
Copy link
Copy Markdown
Contributor

@jarbet jarbet commented Jun 20, 2025

Description

  • A unicode symbol (\u25CF) has been blocking our Github action R CMD CHECK for a long time now.
  • The error only occurs if the plots are rendered in the examples. A recent PR Example tempfile exports #207 stopped rendering all plots, which stopped the error, but now lab members can no longer see rendered plots on our BPG website help pages Website no longer renders examples #209
  • To fix this bug, I've replaced the problematic unicode with a safer but simpler looking unicode (\u2022)
  • The plot now renders fine without errors

After merging this PR, the next step will be to re-render all plots in the help pages on the BPG website. This is very important for new users to BPG so they can better learn from the examples. #209 #211

Closes #205

Checklist

  • This PR does NOT contain PHI or germline genetic data. A repo may need to be deleted if such data is uploaded. Disclosing PHI is a major problem.

  • This PR does NOT contain molecular files, compressed files, output files such as images (e.g. .png, .jpeg), .pdf, .RData, .xlsx, .doc, .ppt, or other non-plain-text 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 NEWS under the next release version or unreleased, and updated the date. I have also updated the version number in DESCRIPTION according to semantic versioning rules.

  • Both R CMD build and R CMD check run successfully.

Testing Results

Example taken from help page of create.heatmap:

devtools::load_all()
# Method 1 of adding symbols (very similar to how text is added)
points <- microarray[1:20, 1:20][microarray[1:20, 1:20] > 11];
size.from <- range(points, na.rm = TRUE);
size.to <- c(1,3);
point.size <- (points - size.from[1])/diff(size.from) * diff(size.to) + size.to[1];
point.colour <- grey(runif(sum(microarray[1:20, 1:20] > 11), max = 0.5));

create.heatmap(
    #filename = tempfile(pattern = 'Heatmap_Symbols_1', fileext = '.tiff'),
    x = microarray[1:20, 1:20],
    main = 'Symbols',
    xlab.label = 'Genes',
    ylab.label = 'Samples',
    xaxis.cex = 0.75,
    yaxis.cex = 0.75,
    xaxis.fontface = 1,
    yaxis.fontface = 1,
    colourkey.cex = 1,
    colourkey.labels.at = seq(2,12,1),
    colour.alpha = 'automatic',
    clustering.method = 'none',
    # conditionally adding points to cells
    # flipping rows and columns because the heatmap function does so
    row.pos = which(microarray[1:20, 1:20] > 11, arr.ind = TRUE)[,2],
    col.pos = which(microarray[1:20, 1:20] > 11, arr.ind = TRUE)[,1],
    cell.text = rep(expression("\u2022"), times = sum(microarray[1:20, 1:20] > 11)),
    text.col = point.colour,
    text.cex = point.size,
    description = 'Heatmap created using BoutrosLab.plotting.general',
    resolution = 200
    );

github is still not letting me upload images...

@jarbet jarbet changed the title Fix unicode error in GHA Fix unicode error in Github Action Jun 20, 2025
@jarbet jarbet marked this pull request as ready for review June 20, 2025 23:24
@jarbet jarbet requested review from a team and dan-knight as code owners June 20, 2025 23:24
dan-knight
dan-knight previously approved these changes Jun 23, 2025
Copy link
Copy Markdown
Collaborator

@dan-knight dan-knight left a comment

Choose a reason for hiding this comment

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

Perfect, just replacing with a more common unicode character is great. Just need an owner review.

yashpatel6
yashpatel6 previously approved these changes Jun 23, 2025
Copy link
Copy Markdown
Contributor

@yashpatel6 yashpatel6 left a comment

Choose a reason for hiding this comment

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

Looks good! One minor comment

Comment thread man/create.heatmap.Rd Outdated

create.heatmap(
filename = tempfile(pattern = 'Heatmap_Symbols_1', fileext = '.tiff'),
#filename = tempfile(pattern = 'Heatmap_Symbols_1', fileext = '.tiff'),
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.

question: was this intended to be kept commented out? If so, any reason to not just remove the line instead?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IMO, shouldn't be commented out. We're using the tempfile for other examples.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The reason I commented it out was to demonstrate the unicode problem when the plot is returned (which also affects #211 ). If you remove the comment, then the GHA wont error from the problematic unicode.

@dan-knight removed the comments from the filename argument for all BPG examples in #207 , but this had the unwanted side effect of no longer rendering any examples in the BPG website #209 .

I guess I can remove the comment for now since I've clearly demonstrated that the unicode bug is now fixed. And we can deal with the problem of rendering plot examples in #211 or consider undoing #207 and always commenting out filename like we did in the past.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After uncommenting filename now we are getting an error about V8 not being available despite being in the DESCRIPTION file. Not sure the root cause but guessing something is off with the github action. #215

@jarbet jarbet dismissed stale reviews from yashpatel6 and dan-knight via f1858d1 June 23, 2025 18:37
@jarbet jarbet mentioned this pull request Jun 23, 2025
@jarbet jarbet requested a review from yashpatel6 June 25, 2025 17:06
@jarbet
Copy link
Copy Markdown
Contributor Author

jarbet commented Jun 25, 2025

@yashpatel6 ready for rereview

Copy link
Copy Markdown
Contributor

@yashpatel6 yashpatel6 left a comment

Choose a reason for hiding this comment

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

Looks good! Date might need an update but I guess that can be done before the next release is made

@jarbet
Copy link
Copy Markdown
Contributor Author

jarbet commented Jun 25, 2025

Looks good! Date might need an update but I guess that can be done before the next release is made

Sure, there are a few other open PRs so I will bump the date there.

@jarbet jarbet merged commit 7d99585 into main Jun 25, 2025
6 checks passed
@tnyamaguchi tnyamaguchi deleted the jarbet-fix-unicode-error-GHA branch July 27, 2025 18:53
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.

Unicode Font Issue in R CMD check CI/CD Workflow

3 participants