Skip to contents

Reads the variant calls from FACETS CNA caller

Usage

read_facets_cnas(path, sample_id = path, chrom_convention = "UCSC")

Arguments

path

Can be either:

  1. path to a single file, sample ID can be passed using sample_id argument

  2. vector of file paths, element names will be used as sample IDs

  3. directory containing multiple FACETS .csv files, sample IDs will be guessed from the file names

sample_id

Sample ID, used with path is a single file

chrom_convention

UCSC/NCBI/keep

Details

read_facets_csv() reads a single csv file. If sample_id is not provided, file path is used

Examples

library(readthis)

file1 <- system.file("extdata", "FACETS", "S1.csv", package = "readthis")
read_facets_cnas(file1)
#> # A tibble: 64 × 18
#>    sample_id      chrom  start    end total_cn major_cn minor_cn log_ratio   seg
#>    <chr>          <chr>  <int>  <int>    <int>    <int>    <int>     <dbl> <dbl>
#>  1 /home/runner/… chr1  1.75e4 1.00e7        1        1        0   -0.261      1
#>  2 /home/runner/… chr1  1.00e7 1.49e8        2        1        1   -0.0364     2
#>  3 /home/runner/… chr1  1.49e8 2.49e8        3        2        1    0.130      3
#>  4 /home/runner/… chr2  4.56e4 9.50e7        2        1        1   -0.0417     4
#>  5 /home/runner/… chr2  9.51e7 9.85e7        3       NA       NA    0.122      5
#>  6 /home/runner/… chr2  9.85e7 1.00e8        2       NA       NA    0.0293     6
#>  7 /home/runner/… chr2  1.00e8 1.12e8        1        1        0   -0.256      7
#>  8 /home/runner/… chr2  1.12e8 2.09e8        2        1        1   -0.0440     8
#>  9 /home/runner/… chr2  2.10e8 2.18e8        1        1        0   -0.248      9
#> 10 /home/runner/… chr2  2.18e8 2.37e8        2        1        1   -0.0576    10
#> # ℹ 54 more rows
#> # ℹ 9 more variables: num.mark <dbl>, nhet <dbl>, mafR <dbl>, segclust <dbl>,
#> #   cnlr.median.clust <dbl>, mafR.clust <dbl>, cf.em <dbl>, Purity <dbl>,
#> #   Ploidy <dbl>

file2 <- system.file("extdata", "FACETS", "S2.csv", package = "readthis")
files <- c(S1 = file1, S2 = file2)
read_facets_cnas(files)
#> # A tibble: 128 × 18
#>    sample_id chrom     start      end total_cn major_cn minor_cn log_ratio   seg
#>    <chr>     <chr>     <int>    <int>    <int>    <int>    <int>     <dbl> <dbl>
#>  1 S1        chr1      17500   1.00e7        1        1        0   -0.261      1
#>  2 S1        chr1   10008200   1.49e8        2        1        1   -0.0364     2
#>  3 S1        chr1  148953300   2.49e8        3        2        1    0.130      3
#>  4 S1        chr2      45600   9.50e7        2        1        1   -0.0417     4
#>  5 S1        chr2   95053400   9.85e7        3       NA       NA    0.122      5
#>  6 S1        chr2   98538000   1.00e8        2       NA       NA    0.0293     6
#>  7 S1        chr2  100321500   1.12e8        1        1        0   -0.256      7
#>  8 S1        chr2  112389300   2.09e8        2        1        1   -0.0440     8
#>  9 S1        chr2  209653415   2.18e8        1        1        0   -0.248      9
#> 10 S1        chr2  218385300   2.37e8        2        1        1   -0.0576    10
#> # ℹ 118 more rows
#> # ℹ 9 more variables: num.mark <dbl>, nhet <dbl>, mafR <dbl>, segclust <dbl>,
#> #   cnlr.median.clust <dbl>, mafR.clust <dbl>, cf.em <dbl>, Purity <dbl>,
#> #   Ploidy <dbl>

dir <- system.file("extdata", "FACETS", package = "readthis")
read_facets_cnas(dir)
#> # A tibble: 128 × 18
#>    sample_id chrom     start      end total_cn major_cn minor_cn log_ratio   seg
#>    <chr>     <chr>     <int>    <int>    <int>    <int>    <int>     <dbl> <dbl>
#>  1 S1        chr1      17500   1.00e7        1        1        0   -0.261      1
#>  2 S1        chr1   10008200   1.49e8        2        1        1   -0.0364     2
#>  3 S1        chr1  148953300   2.49e8        3        2        1    0.130      3
#>  4 S1        chr2      45600   9.50e7        2        1        1   -0.0417     4
#>  5 S1        chr2   95053400   9.85e7        3       NA       NA    0.122      5
#>  6 S1        chr2   98538000   1.00e8        2       NA       NA    0.0293     6
#>  7 S1        chr2  100321500   1.12e8        1        1        0   -0.256      7
#>  8 S1        chr2  112389300   2.09e8        2        1        1   -0.0440     8
#>  9 S1        chr2  209653415   2.18e8        1        1        0   -0.248      9
#> 10 S1        chr2  218385300   2.37e8        2        1        1   -0.0576    10
#> # ℹ 118 more rows
#> # ℹ 9 more variables: num.mark <dbl>, nhet <dbl>, mafR <dbl>, segclust <dbl>,
#> #   cnlr.median.clust <dbl>, mafR.clust <dbl>, cf.em <dbl>, Purity <dbl>,
#> #   Ploidy <dbl>