pyvcf 中带的一个工具 比其他工具用着好些 其他filter我很信不过~~  自己写的功能又很有限 所以转投vcf_filter.py啦

Filtering a VCF file based on some properties of interest is a common enough operation that PyVCF offers an extensible script. vcf_filter.pydoes the work of reading input, updating the metadata and filtering the records.

usage: vcf_filter.py [-h] [--no-short-circuit] [--no-filtered]
              [--output OUTPUT] [--local-script LOCAL_SCRIPT]
              input filter [filter_args] [filter [filter_args]] ...

Filter a VCF file

positional arguments:
  input                 File to process (use - for STDIN) (default: None)

optional arguments:
  -h, --help            Show this help message and exit. (default: False)
  --no-short-circuit    Do not stop filter processing on a site if any filter
                        is triggered (default: False)
  --output OUTPUT       Filename to output [STDOUT] (default: <open file
                        '<stdout>', mode 'w' at 0x2b0f9435c150>)
  --no-filtered         Output only sites passing the filters (default: False)  # 如果不加这个参数,不通过的位点也会被保留下来,只不过在filter列有相应说明!

--local-script LOCAL_SCRIPT
                        Python file in current working directory with the
                        filter classes (default: None)

sq:
  Filter low quailty sites

--site-quality SITE_QUALITY
                        Filter sites below this quality (default: 30)

dps:
  Threshold read depth per sample

--depth-per-sample DEPTH_PER_SAMPLE
                        Minimum required coverage in each sample (default: 5)

avg-dps:
  Threshold average read depth per sample (read_depth / sample_count)

--avg-depth-per-sample AVG_DEPTH_PER_SAMPLE
                        Minimum required average coverage per sample (default:
                        3)

eb:
  Filter sites that look like correlated sequencing errors. Some sequencing
  technologies, notably pyrosequencing, produce mutation hotspots where
  there is a constant level of noise, producing some reference and some
  heterozygote calls. This filter computes a Bayes Factor for each site by
  comparing the binomial likelihood of the observed allelic depths under: *
  A model with constant error equal to the MAF. * A model where each sample
  is the ploidy reported by the caller. The test value is the log of the
  bayes factor. Higher values are more likely to be errors. Note: this
  filter requires rpy2

--eblr EBLR           Filter sites above this error log odds ratio (default:
                        -10)

snp-only:
  Choose only SNP variants

mgq:
  Filters sites with only low quality variants. It is possible to have a
  high site quality with many low quality calls. This filter demands at
  least one call be above a threshold quality.

--genotype-quality GENOTYPE_QUALITY
                        Filter sites with no genotypes above this quality
                        (default: 50)

懒得翻译 自己看吧

注意,里面有默认值:

比如sq 默认30, dps 默认5, avg-dps 默认3, eblr 默认-10, mgq默认50.

但是经过测试, 不指定的话, 好像也不会针对这些项进行过滤, 所以还是指定的好!

下面举一些具体的例子:

vcf_filter.py testfilter.vcf sq 30 > testfilter30.vcf

会发现结果文件中,不满足要求的在filter列显示的是sq30, 满足过滤条件的显示的是PASS.

经观察sq参数是准确可靠地。

vcf_filter.py testfilter.vcf sq --site-quality 30 dps --depth-per-sample 10 > testfilter30_10.vcf

对sq 30 和 dps10 进行过滤:

发现虽然有的dp是小于10的但让然被PASS了,这很尴尬。。。由于我过滤的条件有两个,但是在filter那列,如果两个条件都不满足,只会显示其中一个条件不满足,而没有第二个条件不满足的信息并不会出现。

下面单独测试一下dps:

vcf_filter.py testfilter.vcf  dps --depth-per-sample 10 > testfilter10.vcf

说明dps确实有问题。更郁闷的是不仅有些小于10的不会被过滤掉,连大于10的竟然却被过滤掉了。上图中DP=58被过滤掉了。。。。呵呵了 dps压根不用就是了。

下面单独测试一下avg-dps:

vcf_filter.py testfilter.vcf avg-dps --avg-depth-per-sample 10 > testfilteravg_10.vcf

经测试avg-dps是准确的,其实这个参数正是我们需要的,只要控制了每个样的深度,总的深度也会得到控制,若avg-dps为10, 也就是说总深度我们控制到了30.静平也测试了一下, 发现avg-dps也准确:

这个脚本就avg-dps可以用, 但是不符合我的需要,因为如果三个样本的深度分别是20 5 5 这种情况也满足于avg-dps为10,。

by freemao

FAFU

free_mao@qq.com

vcf_filter.py的更多相关文章

  1. the grave of my scripts

    不定期更新.......... 1,fetch_seq.py https://github.com/freemao/AHRD/blob/master/fetch_seq.py 提取出你想要得染色体的某 ...

  2. VCF文件处理工具PyVCF

    vcf格式示例 ##fileformat=VCFv4.1 ##FILTER=<ID=LowQual,Description=”Low quality”> ##FORMAT=<ID=A ...

  3. python调用py中rar的路径问题。

    1.python调用py,在py中的os.getcwd()获取的不是py的路径,可以通过os.path.split(os.path.realpath(__file__))[0]来获取py的路径. 2. ...

  4. Python导入其他文件中的.py文件 即模块

    import sys sys.path.append("路径") import .py文件

  5. import renumber.py in pymol

    cp renumber.py /usr/local/lib/python2.7/dist-packages/pymol import renumber or run /path/to/renumber ...

  6. python gettitle.py

    #!/usr/bin/env python # coding=utf-8 import threading import requests import Queue import sys import ...

  7. 解决 odoo.py: error: option --addons-path: The addons-path 'local-addons/' does not seem to a be a valid Addons Directory!

    情况说明 odoo源文件路径-/odoo-dev/odoo/: 我的模块插件路径 ~/odoo-dev/local-addons/my-module 在my-module中创建了__init__.py ...

  8. caffe机器学习自带图片分类器classify.py实现输出预测结果的概率及caffe的web_demo例子运行实例

    caffe机器学习环境搭建及python接口编译参见我的上一篇博客:机器学习caffe环境搭建--redhat7.1和caffe的python接口编译 1.运行caffe图片分类器python接口 还 ...

  9. 【转】Windows下使用libsvm中的grid.py和easy.py进行参数调优

    libsvm中有进行参数调优的工具grid.py和easy.py可以使用,这些工具可以帮助我们选择更好的参数,减少自己参数选优带来的烦扰. 所需工具:libsvm.gnuplot 本机环境:Windo ...

随机推荐

  1. java 面向对象编程--第十章 接口

    1.  接口可以看做是抽象类的特例.抽象类中可以定义抽象方法,也可以定义具体方法.但接口只能定义抽象方法.所有接口可以看作行为的抽象.定义接口使用关键字interface,实现接口使用关键字imple ...

  2. windows下phpstorm的快捷键

    ctrl+shift+n查找文件 ctrl+shift+f 在一个目录里查找一段代码(ctrl+f的升级版) ctr+shift+r 在一个目录里查找一段代码并替换(ctrl+r的升级版) CTRL+ ...

  3. S1:动态方法调用:call & apply

    js中函数执行的两种方式:一是通过调用运算符’()’,二是通过调用call或apply来动态执行. 一.动态方法调用中指定this对象 开发中我们往往需要在对象B中调用对象A的方法,这个时候就用到了a ...

  4. Blackhat EU 2013 黑客大会(Full Schedule for Black Hat USA 2013)

    大会文档下载:https://www.blackhat.com/eu-13/archives.html 此次BH EU 议题整体较水,涉及系统安全.移动安全.网络传输安全.WEB安全.游戏安全等.下面 ...

  5. [转载]Android核心分析

    2013-12-19 15:44:03 转载自: http://blog.csdn.net/column/details/androidcore.html 很好的文章,阅读请跳转到转载链接,转载备以后 ...

  6. Noip2014 提高组 T2 联合权值 连通图+技巧

    联合权值 描述 无向连通图 G 有 n 个点,n-1 条边.点从 1 到 n 依次编号,编号为 i 的点的权值为 WiWi, 每条边的长度均为 1.图上两点(u, v)的距离定义为 u 点到 v 点的 ...

  7. String字符串包含运算符实现运算

    string aa = "(1+2)/3+(3+4)*5"; DataTable dt = new DataTable(); string b = dt.Compute(aa, & ...

  8. SharePoint 2016 的新特性概览(二)(What's New for IT Professionals in SharePoint Server 2016)

    博客地址:http://blog.csdn.net/FoxDave SharePoint 2016 的新特性 三. 监测和数据(Insights and Data) 实时数据监测,包括对使用情况.存储 ...

  9. (spring-第16回【AOP基础篇】)基本概念

    AOP(Aspect Oriented Programing),面向切面方程.介绍具体定义前,先看一个例子: package com.baobaotao.concept; public class F ...

  10. sublime3笔记

    选择类Ctrl+D 选中光标所占的文本,继续操作则会选中下一个相同的文本. Alt+F3 选中文本按下快捷键,即可一次性选择全部的相同文本进行同时编辑.举个栗子:快速选中并更改所有相同的变量名.函数名 ...