Mercurial > repos > blankenberg > naive_variant_detector
comparison tools/naive_variant_detector.py @ 5:4a67169be0ee
Update to allow out of bounds positions to be not be fatal errors.
author | Daniel Blankenberg <dan@bx.psu.edu> |
---|---|
date | Thu, 16 May 2013 09:27:59 -0400 |
parents | 55b4460cd0ce |
children |
comparison
equal
deleted
inserted
replaced
4:1c23da12b768 | 5:4a67169be0ee |
---|---|
17 parser.add_option( '-p', '--ploidy', dest='ploidy', action='store', type="int", default=2, help='Ploidy. Default=2.' ) | 17 parser.add_option( '-p', '--ploidy', dest='ploidy', action='store', type="int", default=2, help='Ploidy. Default=2.' ) |
18 parser.add_option( '-d', '--min_support_depth', dest='min_support_depth', action='store', type="int", default=0, help='Minimum number of reads needed to consider a REF/ALT. Default=0.' ) | 18 parser.add_option( '-d', '--min_support_depth', dest='min_support_depth', action='store', type="int", default=0, help='Minimum number of reads needed to consider a REF/ALT. Default=0.' ) |
19 parser.add_option( '-q', '--min_base_quality', dest='min_base_quality', action='store', type="int", default=None, help='Minimum base quality.' ) | 19 parser.add_option( '-q', '--min_base_quality', dest='min_base_quality', action='store', type="int", default=None, help='Minimum base quality.' ) |
20 parser.add_option( '-m', '--min_mapping_quality', dest='min_mapping_quality', action='store', type="int", default=None, help='Minimum mapping.' ) | 20 parser.add_option( '-m', '--min_mapping_quality', dest='min_mapping_quality', action='store', type="int", default=None, help='Minimum mapping.' ) |
21 parser.add_option( '-t', '--coverage_dtype', dest='coverage_dtype', action='store', type="string", default='uint8', help='dtype to use for coverage array' ) | 21 parser.add_option( '-t', '--coverage_dtype', dest='coverage_dtype', action='store', type="string", default='uint8', help='dtype to use for coverage array' ) |
22 parser.add_option( '--allow_out_of_bounds_positions', dest='allow_out_of_bounds_positions', action='store_true', default = False, help='Allows out of bounds positions to not throw fatal errors' ) | |
22 parser.add_option( '--region', dest='region', action='append', type="string", default=[], help='region' ) | 23 parser.add_option( '--region', dest='region', action='append', type="string", default=[], help='region' ) |
23 (options, args) = parser.parse_args() | 24 (options, args) = parser.parse_args() |
24 | 25 |
25 if len( options.bam_file ) == 0: | 26 if len( options.bam_file ) == 0: |
26 print >>sys.stderr, 'You must provide at least one bam (-b) file.' | 27 print >>sys.stderr, 'You must provide at least one bam (-b) file.' |
53 region = tuple( [ region ] + map( int, region_split ) ) | 54 region = tuple( [ region ] + map( int, region_split ) ) |
54 regions.append( region ) | 55 regions.append( region ) |
55 | 56 |
56 coverage = VCFReadGroupGenotyper( map( lambda x: Reader( *x ), bam_files ), options.reference_genome_filename, dtype=options.coverage_dtype, | 57 coverage = VCFReadGroupGenotyper( map( lambda x: Reader( *x ), bam_files ), options.reference_genome_filename, dtype=options.coverage_dtype, |
57 min_support_depth=options.min_support_depth, min_base_quality=options.min_base_quality, min_mapping_quality=options.min_mapping_quality, | 58 min_support_depth=options.min_support_depth, min_base_quality=options.min_base_quality, min_mapping_quality=options.min_mapping_quality, |
58 restrict_regions=regions, use_strand=options.use_strand ) | 59 restrict_regions=regions, use_strand=options.use_strand, allow_out_of_bounds_positions=options.allow_out_of_bounds_positions ) |
59 for line in coverage.iter_vcf( ploidy=options.ploidy, variants_only=options.variants_only ): | 60 for line in coverage.iter_vcf( ploidy=options.ploidy, variants_only=options.variants_only ): |
60 out.write( "%s\n" % line ) | 61 out.write( "%s\n" % line ) |
61 out.close() | 62 out.close() |
62 | 63 |
63 if __name__ == "__main__": main() | 64 if __name__ == "__main__": main() |