Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail when reading population structure #5

Open
cyadrogarcia opened this issue Nov 30, 2023 · 0 comments
Open

Fail when reading population structure #5

cyadrogarcia opened this issue Nov 30, 2023 · 0 comments

Comments

@cyadrogarcia
Copy link

I am trying to run prepareEnv as follow:
`prepareEnv("WC_climate_data.csv", "BIOC_pop.csv",

  •        separator = ";",
    
  •        maxCorr = 1.0,
    
  •        idName = 'ID',
    
  •        genoFile = gdsFile,
    
  •        numPc = 0.2,
    
  •        mafThresh = 0.05,
    
  •        missingnessThresh=0.1,
    
  •        ldThresh=0.2,
    
  •        numPop=2,
    
  •        x ='lon',
    
  •        y ='lat',
    
  •        popStrCol = c("ligustica", "carnica"),
    
  •        interactiveChecks=FALSE,
    
  •        locationProj=4326)
    

`

But i am alway getting the following error:
"Checking correlation between kept env variables and population var. If correlation env-pop > 70%, the environmental variable will be printed here" Error in cor(env_kept[, j], as.numeric(popvect2[, i]), use = "complete.obs") : no complete element pairs In addition: Warning message: In is.data.frame(y) : NAs introduced by coercion

as I understood it seem to be that the enviromental dataset and the population structure dont have the same number of elements. However I loaded my enviromental dataset with read.csv and used str and length to check, and all the vectors appears to have the same length:

`env <- read.csv("/home/carlosgarcia-dora/ITALY/SAMBADAr/WC_climate_data.csv", sep = ";", dec = ",")

str(env)
'data.frame': 225 obs. of 19 variables:
$ ID : chr "I_3281_" "I_3282_" "I_3283_" "I_3284_" ...
$ pop_ID : chr "NorthWest" "NorthEast" "South" "NorthEast" ...
$ ecotype : chr "NorthWest" "NorthEast" "South" "NorthEast" ...
$ lat : num 46.2 44.4 40.8 45.5 42.9 ...
$ lon : num 9.85 11.33 14.83 10.94 12.63 ...
$ Mean_Temperature_of_Warmest_Quarter: num 14.9 22.5 21 21.6 22.2 ...
$ Mean_Temperature_of_Coldest_Quarter: num -1.45 3.92 6.78 2.77 5.6 ...
$ Precipitation_Seasonality : num 38.5 22 42.9 24.4 23.7 ...
$ Precipitation_of_Wettest_Quarter : int 300 266 344 250 229 141 227 426 219 249 ...
$ Precipitation_of_Driest_Quarter : int 115 171 97 138 136 76 74 107 145 149 ...
$ Precipitation_of_Warmest_Quarter : int 300 178 97 242 136 76 108 107 163 204 ...
$ Precipitation_of_Coldest_Quarter : int 115 171 301 138 157 97 151 333 152 158 ...
$ Mean_Diurnal_Range : num 10.24 9.29 8.34 9.27 10.84 ...
$ Isothermality : num 36.2 31.3 34.8 31.1 36.6 ...
$ Temperature_Annual_Range : num 28.3 29.7 24 29.8 29.6 ...
$ Mean_Temperature_of_Wettest_Quarter: num 14.9 13.7 11 17.5 14.5 ...
$ Mean_Temperature_of_Driest_Quarter : num -0.25 3.92 21.02 2.77 22.22 ...
$ ligustica : num 0.53 0.63 0.93 0.6 1 0.92 0.83 0.45 0.61 1 ...
$ carnica : num 0.47 0.37 0.07 0.4 0 0.08 0.17 0.55 0.39 0 ...
lengths <- sapply(env, length)
print(lengths)
ID pop_ID
225 225
ecotype lat
225 225
lon Mean_Temperature_of_Warmest_Quarter
225 225
Mean_Temperature_of_Coldest_Quarter Precipitation_Seasonality
225 225
Precipitation_of_Wettest_Quarter Precipitation_of_Driest_Quarter
225 225
Precipitation_of_Warmest_Quarter Precipitation_of_Coldest_Quarter
225 225
Mean_Diurnal_Range Isothermality
225 225
Temperature_Annual_Range Mean_Temperature_of_Wettest_Quarter
225 225
Mean_Temperature_of_Driest_Quarter ligustica
225 225
carnica
225
`
Really sorry to bother, Would you please bear with my ignorance on this issue?
Carlos

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

No branches or pull requests

1 participant