Closed Sumithrasank closed 5 years ago
I actually wasn't aware that you could read in a .vcf directly, I have been doing it like this:
sampleID <- "Your_SampleID_Here"
input_vcf <- "/path/to/variants.vcf"
vcf_colnames <- c("CHROM", "POS", "ID", "REF", "ALT", "QUAL", "FILTER", "INFO", "FORMAT", sampleID)
variants <- read.delim(file = input_vcf, header = FALSE, sep = '\t',
comment.char = '#', col.names = vcf_colnames, check.names = FALSE)
# add sample ID column
variants[["SampleID"]] <- sampleID
# convert to signatures format
sigs.input <- mut.to.sigs.input(mut.ref = variants,
sample.id = "SampleID",
chr = "CHROM",
pos = "POS",
ref = "REF",
alt = "ALT")
Note that this strips off the header and column names, and replaces with column names that are assumed to be correct. Might need to tweak that for your own uses.
I get the following error when I try to convert a vcf file into the correct input format for deconstructSigs via the command vcf.to.sigs.input(vcf = "path_to_file/file1.vcf") Error: scanVcf: invalid class “VCFHeader” object: 'info(VCFHeader)' must be a 3 column DataFrame with names Number, Type, Description path: path_to_file/file1.vcf