Question: Extract SNPs within 5 bps distance apart
0
gravatar for waqasnayab
11 months ago by
waqasnayab140
Pakistan
waqasnayab140 wrote:

Hi,

I am wondering is there a way to extract / print those variants from a vcf file whose distance is not more than 5 bps apart?

Regards,

Waqas.

snp next-gen R vcf • 496 views
ADD COMMENTlink modified 11 months ago by sacha1.0k • written 11 months ago by waqasnayab140
3
gravatar for Pierre Lindenbaum
11 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum104k wrote:

If I'm not wrong, you can flag the close SNPs with: https://software.broadinstitute.org/gatk/documentation/tooldocs/current/org_broadinstitute_gatk_tools_walkers_filters_VariantFiltration.php

java -jar /commun/data/packages/gatk/3.7.0/GenomeAnalysisTK.jar -T VariantFiltration -R ref.fasta -V input.vcf --clusterSize 2 --clusterWindowSize  5

this will add 'SnpCluster' in the FILTER column.

ADD COMMENTlink modified 11 months ago • written 11 months ago by Pierre Lindenbaum104k
1

Yes, Pierre GATK's VariantFiltration worked for me. I wanted the exact same thing...,,,!!!!

Big Thanks...,,,,!!!!

Cheers,

Waqas.

ADD REPLYlink written 11 months ago by waqasnayab140
1
gravatar for Macspider
11 months ago by
Macspider2.2k
Vienna - BOKU
Macspider2.2k wrote:

Yes, you can do it in many ways (python, command line, perl). You just have to ask for this condition to be verified:

for each line, print line if (line_position - previous_line_position) <= 5

The position field in the VCF file is the 2nd :) https://samtools.github.io/hts-specs/VCFv4.2.pdf

ADD COMMENTlink modified 11 months ago • written 11 months ago by Macspider2.2k

yeah, chromosomal positions (second column) is my target. I searched on google but I failed. Is there a way, to do the same in awk?

Thanks,

Waqas.

ADD REPLYlink written 11 months ago by waqasnayab140

yes, but it's more complicated with indels/multi-allelic sites + check the chromosome is the same.

ADD REPLYlink written 11 months ago by Pierre Lindenbaum104k
0
gravatar for sacha
11 months ago by
sacha1.0k
France
sacha1.0k wrote:

I guess you can do it with bedtools cluster in two step. http://bedtools.readthedocs.io/en/latest/content/tools/cluster.html?highlight=cluster

ADD COMMENTlink written 11 months ago by sacha1.0k
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 2.3.0
Traffic: 623 users visited in the last hour