Created
April 6, 2016 19:26
-
-
Save ryanlayer/bcf15bc96d465cb1e445a32387b2716c to your computer and use it in GitHub Desktop.
Filtering SVTyped lumpy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from cyvcf2 import VCF | |
| import numpy as np | |
| my_vcf = VCF('-') | |
| #print my_vcf.raw_header, | |
| samples = np.array(my_vcf.samples) | |
| for variant in my_vcf: | |
| gts = variant.gt_types | |
| non_ref = samples[(gts != 0) & (gts != 2)] | |
| if ((1 in variant.gt_types) or (3 in variant.gt_types)) \ | |
| and (2 not in variant.gt_types) \ | |
| and variant.QUAL > 100 \ | |
| and np.median(variant.format('GQ', float)) > 100: | |
| #print str(variant), | |
| print variant.CHROM + "\t" + variant.ID +"\t" + str(variant.QUAL) + "\t" + str(variant.INFO['SU']) + "\t" + str(variant.format('AO', int).max()) + "\t" + str(len(non_ref)) + "\t" + "\t".join(non_ref) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment