def test_info(): a = info('fixture/sample.vcf', arities={'AC': 2}) print repr(a) eq_(3, a[2]['NS']) eq_(.5, a[2]['AF']) eq_(True, a[2]['DB']) eq_((3, 1), tuple(a[6]['AC']))
def test_condition(): v = variants('fixture/sample.vcf') eq_(9, len(v)) c = calldata('fixture/sample.vcf', condition=v['FILTER']['PASS']) eq_(5, len(c)) i = info('fixture/sample.vcf', condition=v['FILTER']['PASS']) eq_(5, len(i)) vf = variants('fixture/sample.vcf', condition=v['FILTER']['PASS']) eq_(5, len(vf))
def build_arrays(vcf_fn, region, samples=None, force=False): variants_array_fn = vcf_fn + '.' + region.replace('-:', '_') + '.variants.npy' if force or not os.path.exists(variants_array_fn): print >>sys.stderr, 'building', variants_array_fn V = vcfnp.variants(vcf_fn, region=region, progress=20000) np.save(variants_array_fn, V) else: print >>sys.stderr, 'skipping', variants_array_fn info_array_fn = vcf_fn + '.' + region.replace('-:', '_') + '.info.npy' if force or not os.path.exists(info_array_fn): print >>sys.stderr, 'building', info_array_fn I = vcfnp.info(vcf_fn, region=region, progress=20000, fields=['NS', 'UQ', 'CODING', 'DP', 'AD'], vcf_types={'DP': 'Integer', 'AD': 'Integer'}, arities={'AD': 2}) np.save(info_array_fn, I) else: print >>sys.stderr, 'skipping', info_array_fn
def profile(): a = vcfnp.info(sys.argv[1], count=int(sys.argv[2]))