Tool:cnv_facets: somatic Copy Number Variant calling using the facets package
0
6
Entering edit mode
6.0 years ago

I'd like to bring to your attention cnv_facets, a command line tool for detecting copy number variant (CNV), based on the facets package (Shen R and Seshan VE, Nucleic Acid Res, 2016).

Recently I've been using the facets package for detecting CNVs in tumour-normal sample pairs. I think facets works great but facets being a collection of R functions (plus an external program to prepare the input), it requires manual interaction from the user and so it doesn't play well with a streamlined analysis pipeline.

cnv_facets wraps all the required steps, from BAM files to VCF output and summary plots, in a simple command line call:

cnv_facets.R -t tumor.bam -n normal.bam -vcf snps.vcf.gz -o tex

Installation can be done under regular user permission (no admin rights required) as:

git clone https://github.com/wwcrc/cnv_facets.git
cd cnv_facets
bash setup.sh /dir/on/your/path

For more information, check out the README file. Feel free to use and report any bugs, comments, questions.

CNV somatic facets cancer • 6.4k views
ADD COMMENT
0
Entering edit mode

Could you show me your code of 'cnv_facets.R' script. I found some errors when I run this command:

cnv_facets.R -t tumor.bam -n normal.bam -vcf snps.vcf.gz -o tex
# Load required packages
library(facets)
library(argparse)

# Define the run_facets function
run_facets <- function(tumor_bam, normal_bam, vcf_file, output_prefix) {
    rcmat <- readSnpMatrix(vcf_file, tumor_bam, normal_bam)
    preproc <- preProcSample(rcmat)
    proc <- procSample(preproc, cval = 150)
    fit <- emcncf(proc)

    pdf(paste0(output_prefix, "_facets.pdf"))
    plotSample(proc, fit)
    dev.off()

    write.table(fit$cncf, paste0(output_prefix, "_facets_cncf.txt"), sep = "\t", quote = FALSE, row.names = FALSE)
    write.table(fit$segs, paste0(output_prefix, "_facets_segs.txt"), sep = "\t", quote = FALSE, row.names = FALSE)
}

# Argument parsing
parser <- ArgumentParser(description = 'Run FACETS for CNV calling')
parser$add_argument('-t', '--tumor', required = TRUE, help = 'Tumor BAM file')
parser$add_argument('-n', '--normal', required = TRUE, help = 'Normal BAM file')
parser$add_argument('-vcf', '--vcf', required = TRUE, help = 'SNPs VCF file')
parser$add_argument('-o', '--output', required = TRUE, help = 'Output prefix')
args <- parser$parse_args()

#test function
run_facets(<normal_bam>, <tumour_bam>, <vcf_file>, <output_prefix>)

# Run the function
run_facets(args$tumor, args$normal, args$vcf, args$output)

The error happens on when I run the run_facets function and it is as follows:

Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
  scan() expected 'a real', got 'Description="Allfilterspassed">'
5.
scan(file = file, what = what, sep = sep, quote = quote, dec = dec,
nmax = nrows, skip = 0, na.strings = na.strings, quiet = TRUE,
fill = fill, strip.white = strip.white, blank.lines.skip = blank.lines.skip,
multi.line = FALSE, comment.char = comment.char, allowEscapes = allowEscapes, ...
4.
read.table(file = file, header = header, sep = sep, quote = quote,
dec = dec, fill = fill, comment.char = comment.char, ...)
3.
read.csv(filename, stringsAsFactors = FALSE, colClasses = rep(c("character",
"numeric", "character", "numeric"), c(1, 1, 2, 8)))
2.
readSnpMatrix(vcf_file, tumor_bam, normal_bam)
1.
run_facets("LN88_chr19.sorted.bam", "Tail88_chr19.sorted.bam",
"Tail88_chr19.variants.vcf", "cnv_output")
ADD REPLY
0
Entering edit mode

I'm confused about how you are using cnv_facets. You are showing the command to be executed on the terminal (cnv_facets.R -t ...). This is how cnv_facets.R is supposed to be used and the command looks about right. But then you show some R commands with functionrun_facets redefined in such way that it cannot work (readSnpMatrix is not meant to read vcf files, hence the error you get). So what is it your trying to do...?

ADD REPLY

Login before adding your answer.

Traffic: 1842 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6