mmollina / MAPpoly

Genetic maps in autopolyploids
23 stars 9 forks source link

Bug in make_seq_mappoly #74

Open jeekinlau opened 1 month ago

jeekinlau commented 1 month ago

https://github.com/mmollina/MAPpoly/blame/7bcae98fdeaeb4538a8f087cb7f92386399b9bdb/R/make_seq.R#L57

I think I isolated the problem to start at commit 8f7c232 (all previous commits work) May 1, 2023 @Cristianetaniguti

make_seq_mappoly at some point was broken so that the tutorial lines below are broken. https://rpubs.com/mmollin/tetra_mappoly_vignette

Problem reported by Amaka as she was trying to go through my tutorial https://jeekinlau.github.io/mapping_example/tutorial/Mapping_Example.html. But similar problem can be recreated also with Marcelo's tutorial.

# Marcelo's tutorial

z <- as.numeric(colnames(grs$seq.vs.grouped.snp)[1:12])
LGS<-vector("list", 12)
for(j in 1:12){
    temp1 <- make_seq_mappoly(grs, j, genomic.info = 1)
    tpt <- make_pairs_mappoly(all.rf.pairwise, input.seq = temp1)
    temp2 <- rf_snp_filter(input.twopt = tpt, diagnostic.plot = FALSE)
    lgtemp <- get_genomic_order(temp2)
    LGS[[z[j]]] <- list(seq = make_seq_mappoly(lgtemp), tpt = tpt, ch = z[j])
}

# my tutorial

LGS.inter=vector("list", 7)
for(j in 1:7){
  temp1 = make_seq_mappoly(grs, j, genomic.info=1)
  tpt = make_pairs_mappoly(all.rf.pairwise, input.seq = temp1)
  temp2 = rf_snp_filter(input.twopt = tpt, diagnostic.plot = FALSE)
  tpt2 = make_pairs_mappoly(tpt, input.seq = temp2)
  LGS.inter[[as.numeric(names(table(temp2$chrom))[which.max(table(temp2$chrom))])]] = list(seq = temp2, tpt = tpt2)
}

Current suggestion I gave was to revert to an older build before the problem happens in commit 8f7c232

mmollina commented 1 month ago

I will take care of this soon. As a workaround :

devtools::install_github(repo = "mmollina/mappoly", 
                        ref = "95aa0cf25f2be17a64faf3a13c627b8399c5b52f", 
                        dependencies = TRUE)