Skip to content

Commit

Permalink
update_perfect_GWASpoly_positions
Browse files Browse the repository at this point in the history
  • Loading branch information
jeekinlau committed Jan 29, 2024
1 parent 2e2b945 commit 2542b6f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .Rhistory
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ devtools::document()
devtools::document()
devtools::document()
devtools::document()
genomic_pos = read.csv("https://raw.githubusercontent.com/jeekinlau/RoseArrayTools/master/data/perfect_fits_saintoyant.csv", header = T)
View(genomic_pos)
roxygen2::roxygenise()
devtools::install_github("jeekinlau/RoseArrayTools")
2 changes: 1 addition & 1 deletion .Rproj.user/036DA200/pcs/windowlayoutstate.pper
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"right": {
"splitterpos": 666,
"topwindowstate": "MAXIMIZE",
"topwindowstate": "NORMAL",
"panelheight": 1071,
"windowheight": 1109
}
Expand Down
2 changes: 1 addition & 1 deletion .Rproj.user/036DA200/pcs/workbench-pane.pper
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"TabSet1": 0,
"TabSet2": 0,
"TabSet2": 2,
"TabZoom": {}
}
Empty file removed R/.Rhistory
Empty file.
26 changes: 25 additions & 1 deletion R/fitpoly_to_gwaspoly_input.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @return a .csv file that has the added columns of genome position and LG of markers. Will contain markers with no known location at bottom of file.
#'
#' @export fitPoly_to_GWASpoly_input
#'
#' @export fitpoly_to_GWASpoly_input_perfect
#'
#'
#'
Expand Down Expand Up @@ -36,3 +36,27 @@ fitPoly_to_GWASpoly_input <- function(input_file){
write.csv(final,paste0(input_file_name,"_GWAS_ready.csv"),row.names = F)
print("done")
}



fitPoly_to_GWASpoly_input_perfect <- function(input_file){
input_file_name = gsub(".csv","",input_file)
file = read.csv(input_file)
genomic_pos = read.csv("https://raw.githubusercontent.com/jeekinlau/RoseArrayTools/master/data/perfect_fits_saintoyant.csv", header = T)

temp_names = colnames(file)
temp_names[1] = "Marker"
colnames(file) = temp_names

merged = merge(file,genomic_pos, by="Marker", all=T)

merged_genotypes = merged[,-which(colnames(merged)%in%c("Marker","LG","Position"))]

final = cbind(merged$Marker, merged$LG, merged$Position, merged_genotypes)
final_colnames <- colnames(final)
final_colnames[1:3] = c("Marker", "Chrom", "Position")
colnames(final) = final_colnames
final = final[order(final$Chrom, final$Position),]
write.csv(final,paste0(input_file_name,"_GWAS_ready.csv"),row.names = F)
print("done")
}

0 comments on commit 2542b6f

Please sign in to comment.