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

Strata problem #360

Open
laiajulianamu opened this issue Apr 12, 2024 · 7 comments
Open

Strata problem #360

laiajulianamu opened this issue Apr 12, 2024 · 7 comments
Labels
not adegenet This issue does not belong to adegenet, it belongs in a downstream package

Comments

@laiajulianamu
Copy link

laiajulianamu commented Apr 12, 2024

Hi I am trying to create a strata for running an AMOVA. I am using a Genlight object but for some reason I am having the error below.
Can somebody help me, please?

strata(gl) <- data.frame(other(gl))
Starting gl.read.dart 
Starting utils.read.dart 
  Topskip not provided.
 Setting topskip to 6 .
  Reading in the SNP data
  Detected 2 row format.
Number of rows per clone (should be only  2 s): 2 
 Added the following locus metrics:
AlleleID CloneID AlleleSequence TrimmedSequence SNP SnpPosition CallRate OneRatioRef OneRatioSnp FreqHomRef FreqHomSnp FreqHets PICRef PICSnp AvgPIC AvgCountRef AvgCountSnp RepAvg .
Recognised: 479 individuals and 76246  SNPs in a 2 row format using Report_DTu24-9051_2_moreOrders_SNP_1.csv 
Completed: utils.read.dart 
Starting utils.dart2genlight 
Starting conversion....
Format is 2 rows.
Please note conversion of bigger data sets will take some time!
Once finished, we recommend to save the object using save(object, file="object.rdata")
Adding individual metrics: meta2.csv .
  Ids for individual metadata (at least a subset of) are matching!
  Found  479 matching ids out of 479 ids provided in the ind.metadata file.
  Added population assignments.
  Added latlon data.
 Added  id  to the other$ind.metrics slot.
  Added  pop  to the other$ind.metrics slot.
  Added  lat  to the other$ind.metrics slot.
  Added  lon  to the other$ind.metrics slot.
Completed: utils.dart2genlight 
   479 rows and 76246 columns of data read
  Read depth calculated and added to the locus metrics
  Minor Allele Frequency (MAF) calculated and added to the locus metrics
  Recalculating locus metrics provided by DArT (optionally specified)
Starting gl.compliance.check 
  Processing genlight object with SNP data
  Checking coding of SNPs
    SNP data scored NA, 0, 1 or 2 confirmed
  Checking for population assignments
    Population assignments confirmed
  Checking locus metrics and flags
  Recalculating locus metrics
  Checking for monomorphic loci
    No monomorphic loci detected
  Checking for loci with all missing data
    No loci with all missing data detected
  Checking whether individual names are unique.
  Checking for individual metrics
    Individual metrics confirmed
  Spelling of coordinates checked and changed if necessary to 
            lat/lon
Completed: gl.compliance.check 
Completed: gl.read.dart 
Error in utils.check.datatype(x, verbose = verbose) : 
  Fatal Error: inappropriate object passed to function, found list expecting genlight or SNP or SilicoDArT
> strata(gi) <- data.frame(other(gi))
Starting gl.read.dart 
Starting utils.read.dart 
  Topskip not provided.
 Setting topskip to 6 .
  Reading in the SNP data
  Detected 2 row format.
Number of rows per clone (should be only  2 s): 2 
 Added the following locus metrics:
AlleleID CloneID AlleleSequence TrimmedSequence SNP SnpPosition CallRate OneRatioRef OneRatioSnp FreqHomRef FreqHomSnp FreqHets PICRef PICSnp AvgPIC AvgCountRef AvgCountSnp RepAvg .
Recognised: 479 individuals and 76246  SNPs in a 2 row format using Report_DTu24-9051_2_moreOrders_SNP_1.csv 
Completed: utils.read.dart 
Starting utils.dart2genlight 
Starting conversion....
Format is 2 rows.
Please note conversion of bigger data sets will take some time!
Once finished, we recommend to save the object using save(object, file="object.rdata")
Adding individual metrics: meta2.csv .
  Ids for individual metadata (at least a subset of) are matching!
  Found  479 matching ids out of 479 ids provided in the ind.metadata file.
  Added population assignments.
  Added latlon data.
 Added  id  to the other$ind.metrics slot.
  Added  pop  to the other$ind.metrics slot.
  Added  lat  to the other$ind.metrics slot.
  Added  lon  to the other$ind.metrics slot.
Completed: utils.dart2genlight 
   479 rows and 76246 columns of data read
  Read depth calculated and added to the locus metrics
  Minor Allele Frequency (MAF) calculated and added to the locus metrics
  Recalculating locus metrics provided by DArT (optionally specified)
Starting gl.compliance.check 
  Processing genlight object with SNP data
  Checking coding of SNPs
    SNP data scored NA, 0, 1 or 2 confirmed
  Checking for population assignments
    Population assignments confirmed
  Checking locus metrics and flags
  Recalculating locus metrics
  Checking for monomorphic loci
    No monomorphic loci detected
  Checking for loci with all missing data
    No loci with all missing data detected
  Checking whether individual names are unique.
  Checking for individual metrics
    Individual metrics confirmed
  Spelling of coordinates checked and changed if necessary to 
            lat/lon
Completed: gl.compliance.check 
Completed: gl.read.dart 
Error in utils.check.datatype(x, verbose = verbose) : 
  Fatal Error: inappropriate object passed to function, found list expecting genlight or SNP or SilicoDArT
@zkamvar
Copy link
Collaborator

zkamvar commented Apr 12, 2024

I believe this might be a problem from the {dartR} package maintained by @green-striped-gecko (who might be able to suggest a better forum for this question) because none of the output shown or errors exist in {adegenet}.

It looks like the error is coming from a function in {dartR} called utils.check.datatype.

It would be helpful if you could provide any of the following:

  1. the code for how you created the gl object
  2. the output of sessionInfo()
  3. the output of class(gl)
  4. the output of class(other(gl))

@zkamvar zkamvar added the not adegenet This issue does not belong to adegenet, it belongs in a downstream package label Apr 12, 2024
@laiajulianamu
Copy link
Author

laiajulianamu commented Apr 12, 2024 via email

@zkamvar
Copy link
Collaborator

zkamvar commented Apr 15, 2024

Thank you for providing the code, @laiajulianamu. Looking into the dartR.base::gl.read.dart() function, I think your problem is that the contents of the @other slot is not a data frame of population strata. That function calculates locus-based statistics and strata() assumes individual based population assignments.

However, digging a little further, it looks like a metadata file is required and any column that couldn't be assigned to individual ID, population, or lat/lon is placed in @other$ind.metrics. Perhaps your solution is this if you had columns of strata in "meta2.csv"

strata(gl) <- other(gl)$ind.metrics

@green-striped-gecko, please let me know if my assumptions are correct.

@zkamvar
Copy link
Collaborator

zkamvar commented May 5, 2024

Checking in to see if the solution has worked for you @laiajulianamu

@laiajulianamu
Copy link
Author

laiajulianamu commented May 5, 2024 via email

@zkamvar
Copy link
Collaborator

zkamvar commented May 6, 2024

@green-striped-gecko, since this originates from the dartR suite, would you be able to provide some insight?

@laiajulianamu Do you get the same error or a different error after you run the commands?

@laiajulianamu
Copy link
Author

laiajulianamu commented May 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not adegenet This issue does not belong to adegenet, it belongs in a downstream package
Projects
None yet
Development

No branches or pull requests

2 participants