Question: filtering VCF files
0
gravatar for Bogdan
2.7 years ago by
Bogdan580
Palo Alto, CA, USA
Bogdan580 wrote:

Dear all, and dear Valerie, and Martin,

please i would need a bit of help to set up a filter on a VCF file that contains, SNV, INDELs and DELETIONs.

I would like to filter the file based on a 2 fields in the INFO column - FS and SOR (related to strandness), however, these 2 fields are only present in SNV fields of vcf, and not in INSERTION or DELETION records.

And if I set up the filter below, it will work, however it excludes from the final output file the records with INSERTION and DELETIONs (it prints only filtered SNVs). 

FS_SOR_filters = function(x) {
                               fs  <- info(x)$FS <= 60
                               sor <- info(x)$SOR <= 4
                               fs & sor & isSNV(x)
                             }

FS_SOR_rules <- FilterRules(list(FS_SOR_filters = FS_SOR_filters))

vcf_filtered <- filterVcf( "AML_out_AF_and_AD_filtered.vcf.bgzip", "hg38",
                           "AML_out_AF_and_AD_FS_and_SOR_filtered.vcf",
                            filters=FS_SOR_rules)

what shall i do in order to be able to keep the INSERTION and DELETION in the output file, although the records do not contain FS and SOR fields ? thank you very much,

 

-- bogdan

 

ADD COMMENTlink modified 2.7 years ago by Michael Lawrence11k • written 2.7 years ago by Bogdan580
Answer: filtering VCF files
3
gravatar for Michael Lawrence
2.7 years ago by
United States
Michael Lawrence11k wrote:

Maybe your expression could be something like:

fs & sor | !isSNV(x)

 

ADD COMMENTlink written 2.7 years ago by Michael Lawrence11k

Thank you for suggestions, Mike ! great, it works !

ADD REPLYlink written 2.7 years ago by Bogdan580
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 228 users visited in the last hour