using JLD2 # for loading saved data
using DataFrames # for storing data as type DataFrame
using CairoMakie # for plots
using Statistics # for var() function
using MultivariateStats # for getting variances from PCA model
using CSV # for reading in delimited files
# using Impute # for imputing missing genotypes
Greenish Warbler PCA plots
This page shows the code used to generate PCA plots for the whole genome (and also for each chromosome, although those aren’t shown in the paper).
Prior to examining the code on this page, readers should look at GreenishWarblerGenomics2025.qmd
(or .html
) and GW_Zchromosome_analysis.qmd
(or .html
), as this current page depends on the code on those pages being run first.
Citation
The scripts, data, and figures shown in this website were used as the basis for the paper listed below, which should be cited as the source of information from this website:
Irwin, D., S. Bensch, C. Charlebois, G. David, A. Geraldes, S.K. Gupta, B. Harr, P. Holt, J.H. Irwin, V.V. Ivanitskii, I.M. Marova, Y. Niu, S. Seneviratne, A. Singh, Y. Wu, S. Zhang, T.D. Price. 2025. The distribution and dispersal of large haploblocks in a superspecies. Molecular Ecology, in press.
A note about plots in this document
The plots shown below may different somewhat in appearance between the version produced by Quarto (i.e., in this published document) and the version you would get if you run this code without using Quarto. In particular, the dimensions and font sizes of labels and titles may differ. So if you want the versions identical to those used in the paper, run the code directly in the Julia REPL (or using an environment such as VS Code) without using Quarto.
In the rendered (.html
) version of this Quarto notebook, each figure may be accompanied by a warning caused by an interaction between Quarto and the Makie plotting package. Ignore these warnings as they do not affect the calculations or plots.
Load packages
Load my custom package GenomicDiversity
:
using GenomicDiversity
Choose working directory
= "/Users/darrenirwin/Dropbox/Darren's current work/"
dataDirectory cd(dataDirectory)
Load the filtered dataset
This dataset was produced through filtering in GreenishWarblerGenomics2025.qmd
:
= "GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome"
baseName = ".Jan2025."
tagName = string(baseName, tagName, "ind_SNP_ind_filtered.jld2")
filename # load info into a dictionary (and check for errors):
= load(filename)
d if baseName != d["baseName"]
println("WARNING: baseNames don't match between that defined above and in the saved file")
end
if tagName != d["tagName"]
println("WARNING: tagNames don't match don't match between that defined above and in the saved file")
end
= d["GW_GenoData_indFiltered"]
GW_GenoData_indFiltered = d["repoDirectory"]
repoDirectory = d["dataDirectory"]
dataDirectory = d["scaffold_info"]
scaffold_info = d["scaffold_lengths"]
scaffold_lengths = d["filenameTextMiddle"]
filenameTextMiddle = d["missingGenotypeThreshold"]
missingGenotypeThreshold = d["filenameTextEnd"]
filenameTextEnd =d["chromosomes_to_process"]
chromosomes_to_process println("Loaded the filtered data.")
Loaded the filtered data.
Make final whole-genome PCA
Now that the Z-chromosome problem has been solved (by removing SNPs that had a divergent W sequence mapped onto that Z location), we can construct a new whole-genome PCA. I will combine the saved imputed genotypes for each chromosome into a large data matrix, and conduct PCA on that.
We need to first specify some groups to include in the plot, and their colors:
= ["vir","vir_S","nit", "lud_PK", "lud_KS", "lud_central", "lud_Sath", "lud_ML","troch_west","troch_LN","troch_EM","obs","plumb_BJ","plumb","plumb_vir"]
groups_to_plot_PCA = ["blue","turquoise1","grey","seagreen4","seagreen3","seagreen2","olivedrab3","olivedrab2","olivedrab1","yellow","gold","orange","pink","red","purple"]; group_colors_PCA
Make list of scaffolds to include in the whole-genome PCA:
= "gw" .* string.(vcat(28:-1:17, 15:-1:1))
scaffolds_to_include push!(scaffolds_to_include, "gw1A", "gw4A", "gwZ_cleaned") # add three other scaffolds
30-element Vector{String}:
"gw28"
"gw27"
"gw26"
"gw25"
"gw24"
"gw23"
"gw22"
"gw21"
"gw20"
"gw19"
"gw18"
"gw17"
"gw15"
⋮
"gw9"
"gw8"
"gw7"
"gw6"
"gw5"
"gw4"
"gw3"
"gw2"
"gw1"
"gw1A"
"gw4A"
"gwZ_cleaned"
# initialize data structures for genotypes and positions
= "KNN" # choices are KNN or SVD
imputeMethod
= Matrix{Union{Missing, Float32}}(undef, nrow(GW_GenoData_indFiltered.indInfo), 0)
genos_imputed_loaded
= DataFrame(chrom = String[], position = Int64[])
pos_SNP_loaded for i in eachindex(scaffolds_to_include)
= scaffolds_to_include[i]
chrom = string("chr", chrom)
regionText = string(baseName, tagName, regionText, ".", imputeMethod, "imputedMissing.jld2")
filename = load(filename, "imputed_genos")
imputed_genos_one_chr = hcat(genos_imputed_loaded, imputed_genos_one_chr)
genos_imputed_loaded if GW_GenoData_indFiltered.indInfo.ind != load(filename, "ind_with_metadata_indFiltered")[:, :ind]
println("""Warning: "ind" columns in loaded data and memory data don't match.""")
end
= load(filename, "pos_SNP_filtered_region")
pos_SNP_filtered_region = vcat(pos_SNP_loaded, pos_SNP_filtered_region)
pos_SNP_loaded println(string("Loaded ",filename))
println(string(regionText, ": ", size(imputed_genos_one_chr,2), " SNPs from ", size(imputed_genos_one_chr,1), " individuals"))
end
= true
flipPC1 = true
flipPC2 = plotPCA(genos_imputed_loaded,
PCA_wholeGenome
GW_GenoData_indFiltered.indInfo,
groups_to_plot_PCA, group_colors_PCA; = "greenish warblers", regionText = "wholeGenome",
sampleSet = flipPC1, flip2 = flipPC2,
flip1 = 0.7, fillOpacity = 0.6,
lineOpacity = 14, showTitle = false)
symbolSize = var(PCA_wholeGenome.model)
totalObservationVariance = principalvars(PCA_wholeGenome.model)[1:2]
PC1_variance, PC2_variance = PC1_variance / totalObservationVariance
PC1_prop_variance = PC2_variance / totalObservationVariance
PC2_prop_variance println("PC1 explains ", 100*PC1_prop_variance, "% of the total variance.
", 100*PC2_prop_variance, "%.")
PC2 explains
= PCA_wholeGenome.PC1
GW_GenoData_indFiltered.indInfo.PC1 = PCA_wholeGenome.PC2
GW_GenoData_indFiltered.indInfo.PC2
# add position of reference genome
= predict(PCA_wholeGenome.model, zeros(size(genos_imputed_loaded, 2)))
refGenomePCAposition && (refGenomePCAposition[1] *= -1) # this flips PC1 if flipPC1 = true
flipPC1 && (refGenomePCAposition[2] *= -1) # same for PC2
flipPC2 scatter!(refGenomePCAposition[1], refGenomePCAposition[2], marker = :diamond, color="black", markersize=15, strokewidth=0.5)
CairoMakie.
trydisplay(PCA_wholeGenome.PCAfig)
catchprintln("NOTICE: Figure for ", regionText, " could not be shown due to an unknown error.")
end
if false #set to true to save
save(string("Figure1B_PCAwholeGenome_", imputeMethod,"imputed_fromJulia.png"), PCA_wholeGenome.PCAfig, px_per_unit = 2.0)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw28.KNNimputedMissing.jld2
chrgw28: 11180 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw27.KNNimputedMissing.jld2
chrgw27: 9684 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw26.KNNimputedMissing.jld2
chrgw26: 14303 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw25.KNNimputedMissing.jld2
chrgw25: 3794 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw24.KNNimputedMissing.jld2
chrgw24: 13821 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw23.KNNimputedMissing.jld2
chrgw23: 13949 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw22.KNNimputedMissing.jld2
chrgw22: 5473 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw21.KNNimputedMissing.jld2
chrgw21: 13321 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw20.KNNimputedMissing.jld2
chrgw20: 32739 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw19.KNNimputedMissing.jld2
chrgw19: 25414 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw18.KNNimputedMissing.jld2
chrgw18: 19359 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw17.KNNimputedMissing.jld2
chrgw17: 26313 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw15.KNNimputedMissing.jld2
chrgw15: 27517 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw14.KNNimputedMissing.jld2
chrgw14: 30969 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw13.KNNimputedMissing.jld2
chrgw13: 33543 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw12.KNNimputedMissing.jld2
chrgw12: 33294 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw11.KNNimputedMissing.jld2
chrgw11: 27683 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw10.KNNimputedMissing.jld2
chrgw10: 26962 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw9.KNNimputedMissing.jld2
chrgw9: 38180 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw8.KNNimputedMissing.jld2
chrgw8: 37818 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw7.KNNimputedMissing.jld2
chrgw7: 36575 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw6.KNNimputedMissing.jld2
chrgw6: 40175 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw5.KNNimputedMissing.jld2
chrgw5: 55329 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw4.KNNimputedMissing.jld2
chrgw4: 49980 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw3.KNNimputedMissing.jld2
chrgw3: 82372 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw2.KNNimputedMissing.jld2
chrgw2: 93292 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw1.KNNimputedMissing.jld2
chrgw1: 80862 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw1A.KNNimputedMissing.jld2
chrgw1A: 50051 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw4A.KNNimputedMissing.jld2
chrgw4A: 18467 SNPs from 257 individuals
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgwZ_cleaned.KNNimputedMissing.jld2
chrgwZ_cleaned: 51505 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 12.08685% of the total variance.
PC2 explains 6.3917747%.
Plot location around ring vs. PC1:
= CairoMakie.Figure()
f = Axis(f[1, 1],
ax = "", #"Genomic PC1 around ring"
title = "Location around ring (km)", xlabelsize = 24,
xlabel = "Genomic PC1", ylabelsize = 24)
ylabel hidedecorations!(ax, label = false, ticklabels = false, ticks = false) # hide background lattice
= 100 # in km
jitterSize = GW_GenoData_indFiltered.indInfo.ring_km .+ jitterSize .* (rand(length(GW_GenoData_indFiltered.indInfo.PC1)) .- 0.5)
x_plot_values = GW_GenoData_indFiltered.indInfo.PC1
y_plot_values for i in eachindex(groups_to_plot_PCA)
= GW_GenoData_indFiltered.indInfo.Fst_group .== groups_to_plot_PCA[i]
selection scatter!(ax, x_plot_values[selection], y_plot_values[selection], marker = :diamond, color = (group_colors_PCA[i], 0.6), markersize=14, strokewidth=0.5, strokecolor = ("black", 0.7))
CairoMakie.end
# add position of reference genome
cd(repoDirectory)
= DataFrame(CSV.File("metadata/GW2023_ring_locations.txt"))
ring_locations = ring_locations.LocationAroundRing[ring_locations.location_short .== "GG"][1]
refGenome_location scatter!(refGenome_location, refGenomePCAposition[1], marker = :diamond, color="black", markersize=15, strokewidth=0.5)
CairoMakie.cd(dataDirectory)
display(f)
if false #set to true to save
save("Figure1C_PCAwholeGenomeAroundRing_fromJulia.png", f, px_per_unit = 2.0)
end
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
Make a whole-genome PCA just for the western side of the ring
= ["vir", "vir_misID", "vir_S", "nit", "lud_PK", "lud_KS", "lud_central", "lud_Sath", "lud_ML", "troch_west", "troch_LN"]
western_groups_to_plot_PCA = ["blue", "blue", "turquoise1", "grey", "seagreen4", "seagreen3", "seagreen2", "olivedrab3", "olivedrab2", "olivedrab1", "yellow"]
western_group_colors_PCA = plotPCA(genos_imputed_loaded,
PCA_wholeGenome
GW_GenoData_indFiltered.indInfo,
western_groups_to_plot_PCA, western_group_colors_PCA;="greenish warblers", regionText="wholeGenome",
sampleSet=false, flip2=false,
flip1= 0.7, fillOpacity = 0.6,
lineOpacity = 14, showTitle = false)
symbolSize = var(PCA_wholeGenome.model)
totalObservationVariance = principalvars(PCA_wholeGenome.model)[1:2]
PC1_variance, PC2_variance = PC1_variance / totalObservationVariance
PC1_prop_variance = PC2_variance / totalObservationVariance
PC2_prop_variance println("PC1 explains ", 100 * PC1_prop_variance, "% of the total variance.
", 100 * PC2_prop_variance, "%.") PC2 explains
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 11.394545% of the total variance.
PC2 explains 1.7678221%.
Make a whole-genome PCA just for the eastern side of the ring
= ["troch_LN","troch_EM","obs","plumb_BJ","plumb"]
eastern_groups_to_plot_PCA = ["yellow","gold","orange","pink","red"]
eastern_group_colors_PCA = false
flipPC1 = true
flipPC2 = plotPCA(genos_imputed_loaded,
PCA_wholeGenome
GW_GenoData_indFiltered.indInfo,
eastern_groups_to_plot_PCA, eastern_group_colors_PCA; = "greenish warblers", regionText = "wholeGenome",
sampleSet = flipPC1, flip2 = flipPC2,
flip1 = 0.7, fillOpacity = 0.6,
lineOpacity = 14, showTitle = false)
symbolSize = var(PCA_wholeGenome.model)
totalObservationVariance = principalvars(PCA_wholeGenome.model)[1:2]
PC1_variance, PC2_variance = PC1_variance / totalObservationVariance
PC1_prop_variance = PC2_variance / totalObservationVariance
PC2_prop_variance println("PC1 explains ", 100*PC1_prop_variance, "% of the total variance.
", 100*PC2_prop_variance, "%.") PC2 explains
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 9.740206% of the total variance.
PC2 explains 1.8479686%.
Make PCA plots for individual scaffolds
Define a function for plotting one PCA for a scaffold:
function plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
baseName, tagName, scaffold;
flipPC1, flipPC2, showTitle)
= string("chr", scaffold)
regionText = string(baseName, tagName, regionText, ".KNNimputedMissing.jld2")
filename = load(filename, "imputed_genos")
imputed_genos = load(filename, "ind_with_metadata_indFiltered")
ind_with_metadata_indFiltered = load(filename, "pos_SNP_filtered_region")
pos_SNP_filtered_region println(string("Loaded ",filename))
println(string(regionText, ": ", size(imputed_genos,2), " SNPs from ", size(imputed_genos,1), " individuals"))
# flipPC1 = true
# flipPC2 = true
= plotPCA(imputed_genos, ind_with_metadata_indFiltered,
PCAmodel
groups_to_plot_PCA, group_colors_PCA; = "greenish warblers", regionText=regionText,
sampleSet = flipPC1, flip2 = flipPC2,
flip1 = 0.7, fillOpacity = 0.6,
lineOpacity = 14, showTitle = showTitle,
symbolSize = string("Chromosome ", scaffold," PC1"), yLabelText = string("Chromosome ", scaffold," PC2"),
xLabelText = false)
showPlot
= var(PCAmodel.model)
totalObservationVariance = principalvars(PCAmodel.model)[1:2]
PC1_variance, PC2_variance = PC1_variance / totalObservationVariance
PC1_prop_variance = PC2_variance / totalObservationVariance
PC2_prop_variance println("PC1 explains ", 100*PC1_prop_variance, "% of the total variance.
", 100*PC2_prop_variance, "%.")
PC2 explains
# add position of reference genome
= predict(PCAmodel.model, zeros(size(imputed_genos, 2)))
refGenomePCAposition && (refGenomePCAposition[1] *= -1) # this flips PC1 if flipPC1 = true
flipPC1 && (refGenomePCAposition[2] *= -1) # same for PC2
flipPC2 scatter!(refGenomePCAposition[1], refGenomePCAposition[2], marker = :diamond, color="black", markersize=14, strokewidth=0.5)
CairoMakie.
trydisplay(PCAmodel.PCAfig)
catchprintln("NOTICE: Figure for ", regionText, " could not be shown due to an unknown error.")
end
return PCAmodel
end
plotOneScaffoldPCA (generic function with 1 method)
Make PCA plots for each chromosome, with option to save:
= false #set to true to save the figures from cells below savefig
false
= "gw1"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=false, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw1.KNNimputedMissing.jld2
chrgw1: 80862 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 11.790371% of the total variance.
PC2 explains 6.068956%.
= "gw1A"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=false, flipPC2=false, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw1A.KNNimputedMissing.jld2
chrgw1A: 50051 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 14.3619375% of the total variance.
PC2 explains 8.243913%.
= "gw2"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw2.KNNimputedMissing.jld2
chrgw2: 93292 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 13.293323% of the total variance.
PC2 explains 6.3256464%.
= "gw3"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw3.KNNimputedMissing.jld2
chrgw3: 82372 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 12.753571% of the total variance.
PC2 explains 6.4516797%.
= "gw4"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=false, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw4.KNNimputedMissing.jld2
chrgw4: 49980 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 11.8756075% of the total variance.
PC2 explains 6.052506%.
= "gw4A"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw4A.KNNimputedMissing.jld2
chrgw4A: 18467 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 8.10225% of the total variance.
PC2 explains 6.4409094%.
= "gw5"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw5.KNNimputedMissing.jld2
chrgw5: 55329 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 12.462368% of the total variance.
PC2 explains 6.6817045%.
= "gw6"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw6.KNNimputedMissing.jld2
chrgw6: 40175 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 10.859537% of the total variance.
PC2 explains 5.9476075%.
= "gw7"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=false, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw7.KNNimputedMissing.jld2
chrgw7: 36575 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 11.095749% of the total variance.
PC2 explains 6.085347%.
= "gw8"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=false, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw8.KNNimputedMissing.jld2
chrgw8: 37818 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 11.007252% of the total variance.
PC2 explains 5.915666%.
= "gw9"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw9.KNNimputedMissing.jld2
chrgw9: 38180 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 11.258947% of the total variance.
PC2 explains 5.450791%.
= "gw10"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw10.KNNimputedMissing.jld2
chrgw10: 26962 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 11.141077% of the total variance.
PC2 explains 5.4113245%.
= "gw11"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=false, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw11.KNNimputedMissing.jld2
chrgw11: 27683 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 10.932791% of the total variance.
PC2 explains 5.910336%.
= "gw12"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw12.KNNimputedMissing.jld2
chrgw12: 33294 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 11.808325% of the total variance.
PC2 explains 5.742847%.
= "gw13"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=false, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw13.KNNimputedMissing.jld2
chrgw13: 33543 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 13.365666% of the total variance.
PC2 explains 7.26101%.
= "gw14"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw14.KNNimputedMissing.jld2
chrgw14: 30969 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 11.530412% of the total variance.
PC2 explains 6.537424%.
= "gw15"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=false, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw15.KNNimputedMissing.jld2
chrgw15: 27517 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 12.024455% of the total variance.
PC2 explains 6.3510194%.
= "gw17"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw17.KNNimputedMissing.jld2
chrgw17: 26313 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 10.918732% of the total variance.
PC2 explains 6.300656%.
= "gw18"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw18.KNNimputedMissing.jld2
chrgw18: 19359 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 13.948867% of the total variance.
PC2 explains 8.864708%.
= "gw19"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw19.KNNimputedMissing.jld2
chrgw19: 25414 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 9.869666% of the total variance.
PC2 explains 5.4673886%.
= "gw20"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw20.KNNimputedMissing.jld2
chrgw20: 32739 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 13.309981% of the total variance.
PC2 explains 8.098767%.
= "gw21"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw21.KNNimputedMissing.jld2
chrgw21: 13321 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 10.157121% of the total variance.
PC2 explains 5.943965%.
= "gw22"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=false, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw22.KNNimputedMissing.jld2
chrgw22: 5473 SNPs from 257 individuals
PC1 explains 13.285248
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
% of the total variance.
PC2 explains 8.581498%.
= "gw23"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw23.KNNimputedMissing.jld2
chrgw23: 13949 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 10.519924% of the total variance.
PC2 explains 6.485574%.
= "gw24"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw24.KNNimputedMissing.jld2
chrgw24: 13821 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 8.532888% of the total variance.
PC2 explains 5.108733%.
= "gw25"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw25.KNNimputedMissing.jld2
chrgw25: 3794 SNPs from 257 individuals
PC1 explains 17.002586% of the total variance.
PC2 explains 11.373987%.
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
= "gw26"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw26.KNNimputedMissing.jld2
chrgw26: 14303 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 14.828697% of the total variance.
PC2 explains 7.8627186%.
= "gw27"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw27.KNNimputedMissing.jld2
chrgw27: 9684 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 12.95481% of the total variance.
PC2 explains 7.359955%.
= "gw28"
scaffold = plotOneScaffoldPCA(groups_to_plot_PCA, group_colors_PCA,
PCAmodel
baseName, tagName, scaffold;=true, flipPC2=true, showTitle=false)
flipPC1if savefig #set to true to save
= string("Figure_", scaffold, "_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgw28.KNNimputedMissing.jld2
chrgw28: 11180 SNPs from 257 individuals
PC1 explains 13.7301655% of the total variance.
PC2 explains 8.083617%.
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
Make Z chromosome PCA:
= "chrgwZ_cleaned"
regionText = string(baseName, tagName, regionText, ".KNNimputedMissing.jld2")
filename = load(filename, "imputed_genos")
imputed_genos = load(filename, "ind_with_metadata_indFiltered")
ind_with_metadata_indFiltered = load(filename, "pos_SNP_filtered_region")
pos_SNP_filtered_region println(string("Loaded ",filename))
println(string(regionText, ": ", size(imputed_genos,2), " SNPs from ", size(imputed_genos,1), " individuals"))
= true
flipPC1 = true
flipPC2 = plotPCA(imputed_genos, ind_with_metadata_indFiltered,
PCAmodel
groups_to_plot_PCA, group_colors_PCA; = "greenish warblers", regionText=regionText,
sampleSet = flipPC1, flip2 = flipPC2,
flip1 = 0.7, fillOpacity = 0.6,
lineOpacity = 14, showTitle = false,
symbolSize = string("Chromosome Z PC1"), yLabelText = string("Chromosome Z PC2"),
xLabelText = false)
showPlot
= var(PCAmodel.model)
totalObservationVariance = principalvars(PCAmodel.model)[1:2]
PC1_variance, PC2_variance = PC1_variance / totalObservationVariance
PC1_prop_variance = PC2_variance / totalObservationVariance
PC2_prop_variance println("PC1 explains ", 100*PC1_prop_variance, "% of the total variance.
", 100*PC2_prop_variance, "%.")
PC2 explains
# add position of reference genome
= predict(PCAmodel.model, zeros(size(imputed_genos, 2)))
refGenomePCAposition && (refGenomePCAposition[1] *= -1) # this flips PC1 if flipPC1 = true
flipPC1 && (refGenomePCAposition[2] *= -1) # same for PC2
flipPC2 scatter!(refGenomePCAposition[1], refGenomePCAposition[2], marker = :diamond, color="black", markersize=14, strokewidth=0.5)
CairoMakie.
trydisplay(PCAmodel.PCAfig)
catchprintln("NOTICE: Figure for ", regionText, " could not be shown due to an unknown error.")
end
if savefig #set to true to save
= string("Figure_gwZ_PCA_allInds_from_Julia.png")
filename save(filename, PCAmodel.PCAfig, px_per_unit = 2.0)
println("Saved ", filename)
end
Loaded GW_genomics_2022_with_new_genome/GW2022_GBS_012NA_files/GW2022_all4plates.genotypes.SNPs_only.whole_genome.Jan2025.chrgwZ_cleaned.KNNimputedMissing.jld2
chrgwZ_cleaned: 51505 SNPs from 257 individuals
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/Y3ABD/src/scenes.jl:238
PC1 explains 17.929323% of the total variance.
PC2 explains 9.7906275%.
The below script will produce a bunch of PCAs for different scaffolds, but will not appropriately flip the axes of each as the above ones do (so making inactive):
= "gw" .* string.(vcat(1:15, 17:28))
scaffolds_to_show_PCA push!(scaffolds_to_show_PCA, "gw1A", "gw4A", "gwZ_cleaned") # add three other scaffolds
for i in eachindex(scaffolds_to_show_PCA)
= scaffolds_to_show_PCA[i]
chrom = plotOneScaffoldPCA(groups_to_plot_PCA,
PCAmodel
group_colors_PCA,
baseName, tagName, chrom;=true, flipPC2=true, showTitle=true)
flipPC1end