Skip to content

Madc2vcf strawberry fix#37

Merged
alex-sandercock merged 2 commits intodevelopmentfrom
madc2vcf_strawberry_fix
May 21, 2025
Merged

Madc2vcf strawberry fix#37
alex-sandercock merged 2 commits intodevelopmentfrom
madc2vcf_strawberry_fix

Conversation

@Cristianetaniguti
Copy link
Collaborator

  • When marker ID has more than one "_", last one is considered to extract the position and the remaining are collapsed as chromosome ID
  • If more than one base pair polymorphism is found between Ref_0001 and Alt_0002, tag is discarded because it is not possible to identify which is the target and its position

Copy link

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

This PR refines marker ID parsing for strawberry, preserving multi-part chromosome IDs and ensuring only single-base polymorphisms are processed.

  • Add check.names = FALSE to CSV reads and data frame creation to retain original column names
  • Collapse all but the last underscore-separated segment of CloneID into the chromosome ID
  • Modify comparison logic to only accept single-base polymorphisms and discard tags with multiple mismatches

if(isBotLoci) one_tag$AlleleSequence <- sapply(one_tag$AlleleSequence, function(x) as.character(reverseComplement(DNAString(x))))

chr <- sapply(strsplit(cloneID, "_"), function(x) x[-length(x)])
if(length(chr > 1)) chr <- paste(chr, collapse = "_")
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

The condition uses length(chr > 1), which computes the length of a logical comparison vector. It should be length(chr) > 1 to correctly check for multiple segments before collapsing.

Suggested change
if(length(chr > 1)) chr <- paste(chr, collapse = "_")
if(length(chr) > 1) chr <- paste(chr, collapse = "_")

Copilot uses AI. Check for mistakes.
# If target alternative have N, discard whole tag
if(all(alt_base %in% c("A", "T", "C", "G"))) {
# Always only one polymorphism, if there are more than one, not sure which is the target
if(all(alt_base %in% c("A", "T", "C", "G")) & length(align@pattern@mismatch@unlistData) == 1) {
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

Use && instead of & for scalar logical operations in if conditions to avoid unintended vectorized behavior.

Suggested change
if(all(alt_base %in% c("A", "T", "C", "G")) & length(align@pattern@mismatch@unlistData) == 1) {
if(all(alt_base %in% c("A", "T", "C", "G")) && length(align@pattern@mismatch@unlistData) == 1) {

Copilot uses AI. Check for mistakes.

clust <- makeCluster(n.cores)
#clusterExport(clust, c("hap_seq","add_ref_alt"))
#clusterExport(clust, c("hap_seq","add_ref_alt", "nsamples"))
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

The clusterExport call is commented out, so hap_seq, nsamples, and add_ref_alt won't be available on the workers. Uncomment or add the export call before parLapply to ensure these objects are passed to the cluster.

Suggested change
#clusterExport(clust, c("hap_seq","add_ref_alt", "nsamples"))
clusterExport(clust, c("hap_seq", "add_ref_alt", "nsamples"))

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented May 21, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.14%. Comparing base (297f058) to head (18ad68d).
Report is 3 commits behind head on development.

Files with missing lines Patch % Lines
R/madc2vcf_all.R 75.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development      #37      +/-   ##
===============================================
+ Coverage        84.13%   84.14%   +0.01%     
===============================================
  Files               16       16              
  Lines             1147     1148       +1     
===============================================
+ Hits               965      966       +1     
  Misses             182      182              

☔ 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 merged commit 73ec035 into development May 21, 2025
5 of 6 checks passed
@alex-sandercock alex-sandercock deleted the madc2vcf_strawberry_fix branch May 21, 2025 19:40
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.

3 participants