Skip to content

new fixMADC function#51

Closed
alex-sandercock wants to merge 5 commits intodevelopmentfrom
rawMADC_function
Closed

new fixMADC function#51
alex-sandercock wants to merge 5 commits intodevelopmentfrom
rawMADC_function

Conversation

@alex-sandercock
Copy link
Copy Markdown
Collaborator

This pull request introduces BIGr version 0.7.0, with the primary change being the addition of a new function, fixMADC, to process and standardize raw MADC files using user-supplied chromosome and position information. The update also includes relevant documentation, namespace, and metadata changes to support this new feature.

New Functionality:

  • Added a new function fixMADC to format raw MADC files by updating allele and clone IDs to a standardized Chr_Pos format using a user-provided marker file. This function supports downstream compatibility with madc2vcf and BIGapp functions. (R/fixMADC.R, NAMESPACE, man/fixMADC.Rd, NEWS.md) [1] [2] [3] [4]

Documentation and Metadata Updates:

  • Updated the package version to 0.7.0 and added a news entry describing the new fixMADC function. (DESCRIPTION, NEWS.md) [1] [2]
  • Updated documentation for the new function, including examples and parameter descriptions. (man/fixMADC.Rd)
  • Updated the RoxygenNote version to 7.3.3 in DESCRIPTION.
  • Added .suffix_type to the list of global variables to avoid R CMD check warnings. (R/utils.R)

Imports and Namespace:

  • Added fixMADC to the list of exported functions and imported replace_na from tidyr for use in the new function. (NAMESPACE) [1] [2]

Other:

  • Cleaned up cran-comments.md by removing outdated update notes.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new fixMADC() feature to the BIGr R package to convert raw DArT MADC files to the fixed allele-ID format (standardizing CloneID to Chr_Pos and appending numbered allele suffixes), along with package metadata/docs updates.

Changes:

  • Introduces R/fixMADC.R (new exported function) and corresponding Rd documentation.
  • Adds a comprehensive testthat suite for fixMADC() and supporting fixture builders.
  • Updates package metadata (version bump to 0.7.0, NEWS entry, NAMESPACE imports/exports) and adds an example marker file to inst/.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
R/fixMADC.R Implements the new fixMADC() function for remapping/standardizing MADC IDs.
tests/testthat/test-fixMADC.R Adds extensive tests covering mapping, validation, warnings/errors, and file output behavior.
man/fixMADC.Rd New generated documentation for fixMADC().
NAMESPACE Exports fixMADC and imports tidyr::replace_na.
DESCRIPTION Bumps version to 0.7.0 and updates RoxygenNote.
NEWS.md Adds a 0.7.0 entry describing fixMADC.
R/utils.R Adds .suffix_type to globalVariables to avoid R CMD check notes.
inst/iris_MADC_marker_file.csv Adds a packaged example marker file for fixMADC usage.
cran-comments.md Removes outdated update notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +82 to +83
#Remove the first n.summary.columns columns
if (n.summary.columns > 0) {
Comment on lines +108 to +136
if (any(grepl("[*#_!.\\-]", marker_file[,3]))) {
stop("Special characters (*#_-!.) detected in the position column (column 3). Please review the marker file.")
}

if (!all(grepl("^[0-9]+$", marker_file[,3]))) {
stop("The position column (column 3) must be numeric. Please review the marker file.")
}

#Make marker IDs column and pad 0's for the position
marker_file$new_ID <- paste0(
marker_file[,2],
"_",
str_pad(marker_file[,3], width = 9, side = "left", pad = "0")
)

#Verify there are no duplicate IDs in the marker file
if (length(unique(marker_file[,1])) != length(marker_file[,1])) {
stop("There are duplicate marker IDs in the first column. Please review marker file.")
}

#Verify there are no duplicate position information
if (length(unique(marker_file$new_ID)) != length(marker_file$new_ID)) {
stop("There are duplicate Chr and Pos information where more than one marker has the same Chr_Pos. Please review the marker file.")
}

#Verify chromosome column (col 2) contains no special characters
if (any(grepl("[*#_!.\\-]", marker_file[,2]))) {
stop("Special characters (*#_-!.) detected in the chromosome column (column 2). Please review the marker file.")
}
#Save the output to disk if file name provided
if (!is.null(output.file)) {
message("Saving fixed MADC data to file")
write.csv(filtered_df, paste0(output.file,"_fixedID.csv"), row.names = FALSE)
Comment on lines +69 to +75
#Read the madc file
filtered_df <- read.csv(madc.file, sep = ',', check.names = FALSE)

#Remove extra text after Ref and Alt (_001 or _002)
#filtered_df$AlleleID <- sub("\\|Ref_.*", "|Ref", filtered_df$AlleleID)
#filtered_df$AlleleID <- sub("\\|Alt_.*", "|Alt", filtered_df$AlleleID)

alex-sandercock and others added 4 commits March 13, 2026 17:16
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 98.78049% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.94%. Comparing base (4f30e52) to head (98933f7).

Files with missing lines Patch % Lines
R/fixMADC.R 98.78% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development      #51      +/-   ##
===============================================
+ Coverage        83.05%   83.94%   +0.88%     
===============================================
  Files               19       20       +1     
  Lines             1369     1451      +82     
===============================================
+ Hits              1137     1218      +81     
- Misses             232      233       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alex-sandercock alex-sandercock deleted the rawMADC_function branch March 27, 2026 13:59
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