comparison tools/naive_variant_caller.py @ 5:8398666758e3

Update options.
author Daniel Blankenberg <dan@bx.psu.edu>
date Tue, 04 Feb 2014 17:26:26 -0500
parents ae6edc0012ba
children d5f866df45ae
comparison
equal deleted inserted replaced
4:13d534f2bcde 5:8398666758e3
16 parser.add_option( '-s', '--use_strand', dest='use_strand', action='store_true', default = False, help='Report counts by strand' ) 16 parser.add_option( '-s', '--use_strand', dest='use_strand', action='store_true', default = False, help='Report counts by strand' )
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='uint64', 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( '--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' )
23 parser.add_option( '--safe', dest='safe', action='store_true', default = False, help='Perform checks to prevent certain errors. Is slower.' )
23 parser.add_option( '--region', dest='region', action='append', type="string", default=[], help='region' ) 24 parser.add_option( '--region', dest='region', action='append', type="string", default=[], help='region' )
24 (options, args) = parser.parse_args() 25 (options, args) = parser.parse_args()
25 26
26 if len( options.bam_file ) == 0: 27 if len( options.bam_file ) == 0:
27 print >>sys.stderr, 'You must provide at least one bam (-b) file.' 28 print >>sys.stderr, 'You must provide at least one bam (-b) file.'
53 sys.exit( 1 ) 54 sys.exit( 1 )
54 region = tuple( [ region ] + map( int, region_split ) ) 55 region = tuple( [ region ] + map( int, region_split ) )
55 regions.append( region ) 56 regions.append( region )
56 57
57 coverage = VCFReadGroupGenotyper( map( lambda x: Reader( *x ), bam_files ), options.reference_genome_filename, dtype=options.coverage_dtype, 58 coverage = VCFReadGroupGenotyper( map( lambda x: Reader( *x ), bam_files ), options.reference_genome_filename, dtype=options.coverage_dtype,
58 min_support_depth=options.min_support_depth, min_base_quality=options.min_base_quality, min_mapping_quality=options.min_mapping_quality, 59 min_support_depth=options.min_support_depth, min_base_quality=options.min_base_quality,
59 restrict_regions=regions, use_strand=options.use_strand, allow_out_of_bounds_positions=options.allow_out_of_bounds_positions ) 60 min_mapping_quality=options.min_mapping_quality, restrict_regions=regions, use_strand=options.use_strand,
61 allow_out_of_bounds_positions=options.allow_out_of_bounds_positions, safe=options.safe )
60 for line in coverage.iter_vcf( ploidy=options.ploidy, variants_only=options.variants_only ): 62 for line in coverage.iter_vcf( ploidy=options.ploidy, variants_only=options.variants_only ):
61 out.write( "%s\n" % line ) 63 out.write( "%s\n" % line )
62 out.close() 64 out.close()
63 65
64 if __name__ == "__main__": main() 66 if __name__ == "__main__": main()