extract_dart_target_id: Extract DArT target id

View source: R/dart.R

extract_dart_target_idR Documentation

Extract DArT target id

Description

Used internally in radiator and might be of interest for users. The function allows to extract DArT target id from a DArT file. To help prepare the appropriate STRATA file.

Usage

extract_dart_target_id(data, write = TRUE)

Arguments

data

One of the DArT output files. 6 formats used by DArT are recognized by radiator. recognised:

  1. 1row: Genotypes are in 1 row and coded (0, 1, 2, -). 0 for 2 reference alleles REF/REF, 1 for 2 alternate alleles ALT/ALT, 2 for heterozygote REF/ALT, - for missing.

  2. 2rows: No genotypes. It's absence/presence, 0/1, of the REF and ALT alleles. Sometimes called binary format.

  3. counts: No genotypes, It's counts/read depth for the REF and ALT alleles. Sometimes just called count data.

  4. silico.dart: SilicoDArT data. No genotypes, no REF or ALT alleles. It's a file coded as absence/presence, 0/1, for the presence of sequence in the clone id.

  5. silico.dart.counts: SilicoDArT data. No genotypes, no REF or ALT alleles. It's a file coded as absence/presence, with counts for the presence of sequence in the clone id.

  6. dart.vcf: For DArT VCFs, please use read_vcf.

Depending on the number of markers, these format will be recoded similarly to VCF files (dosage of alternate allele, see details).

The function can import .csv or .tsv files.

If you encounter a problem, sent me your data so that I can update the function.

write

With default write = TRUE, the dart target id column is written in a file in the working directory.

Value

A tidy dataframe with a TARGET_ID column. For cleaning, the TARGET_ID column is treated like the column INDIVIDUALS. Spaces and , are removed, _ and : are changed to a dash - and UPPER case is used. see cleaning doc for logic behind this.

Author(s)

Thierry Gosselin thierrygosselin@icloud.com and Peter Grewe peter.grewe@csiro.au

Examples

## Not run: 
# Built a strata file:
strata <- radiator::extract_dart_target_id("mt.dart.file.csv") %>%
    dplyr::mutate(
        INDIVIDUALS = "new id you want to give",
        STRATA = "fill this"
    ) %>%
    readr::write_tsv(x = ., file = "my.new.dart.strata.tsv")

## End(Not run)

thierrygosselin/radiator documentation built on April 25, 2024, 3:20 a.m.