Code Monkey home page Code Monkey logo

Comments (4)

thierrygosselin avatar thierrygosselin commented on May 26, 2024 1

Hi Brenna, the latest commit 6f57bbc fixes the issue (it was working properly with multi allelic datasets, but the all the colours of genind were not accounted for when using biallelic datasets..)

Thanks for reporting !
Thierry

from radiator.

thierrygosselin avatar thierrygosselin commented on May 26, 2024

Hi Brenna,

I was not able to run your code, I get this error:
Error in is.factor(x) : object 'sets.length' not found

Where is sets.length from ?
If you show me the fix, I'll try to read genind object differently (re-open the issue by replying):

Otherwise, you can do this:

Import data and load radiator

library(radiator)
data <- suppressWarnings(readr::read_csv(
  file = "foo2.csv",
  col_names = TRUE, col_types = readr::cols(.default = readr::col_character()))) %>%
  dplyr::mutate(POP_ID = rep("POP1", n())) %>%
  dplyr::select(POP_ID, INDIVIDUALS = X1, dplyr::everything(.)) %>%
  dplyr::mutate_all(.tbl = ., .funs = tidyr::replace_na, replace = "000000")

Generate the tidy data

tidy.data <- radiator::tidy_genomic_data(data)

test genind

genind.data <- radiator::write_genind(tidy.data)
genind.data

Or, do all this at the same time as testing the imputations
2 ways: through radiator::genomic converter or grur::grur_imputations

imp.rf <- radiator::genomic_converter(
  data = data,
  output = "genind", 
  imputation.method = "rf",
  hierarchical.levels = "global", 
  verbose = TRUE)
names(imp.rf)
[1] "genind.no.imputation" "genind.imputed"      
[3] "tidy.data"            "tidy.data.imp"

So here you have both imputed and non imputed: tidy data and genind objects.

Recover them separately:

tidy.data <- imp.rf$tidy.data
tidy.data.imp <- imp.rf$tidy.data.imp
genind.no.imputation <- imp.rf$genind.no.imputation
genind.imputed <- imp.rf$genind.imputed

You have simulated data with NA's ? Simulated on what?

Early next week I have a grur update to evaluate imputation accuracy and other tools...
Cheers
Thierry

from radiator.

thierrygosselin avatar thierrygosselin commented on May 26, 2024

I'm actually reopening it ;)

  1. To make the code fully reproducible, show how you import foo2 in R ?

I used :

foo2 <- suppressWarnings(readr::read_csv(
  file = "foo2.csv",
  col_names = TRUE, col_types = readr::cols(.default = readr::col_character())))
  1. foo.genind@pop <- as.factor(rep("PO1", 100)) in your code fix the problem on my end.

But... when I run some checks, I get weird results:

foo.genind@tab # gives weird weird results
  • You should have the marker/locus name then a . with the alleles you report using: 110 and 100
  • not the case on my end Which is not the case, the first columns of the matrix are X1.1, X1.2, ...
  • the columns at the end are fine
  1. [email protected] and adegenet::nLoc(foo.genind)
    Shows that the individual column is considered as locus, which explains why the weird results above.

do your get the same results?

Best
Thierry

from radiator.

BrennaF avatar BrennaF commented on May 26, 2024

I'm sorry about that Thierry - I didn't check the data file after I wrote it out.

Read it in this way and it should recreate the problem:

foo2 <- read.csv("foo2.csv", check.names=F)
foo2 <- foo2 [,-1]
foo2 [, ] <- lapply(foo2 [, ], as.character)
foo.genind <- df2genind(foo2, ncode = 3, NA.char = NA, ploidy = 2)
foo.genind@pop <- as.factor(rep("PO1", length(sets.length[x])))

Let me know if it is still not working!

from radiator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.