def main(argv=()): with errors.clean_commandline_error_exit(): if len(argv) > 1: errors.log_and_raise( 'Command line parsing failure: call_variants does not accept ' 'positional arguments but some are present on the command line: ' '"{}".'.format(str(argv)), errors.CommandLineError) del argv # Unused. proto_utils.uses_fast_cpp_protos_or_die() logging_level.set_from_flag() model = modeling.get_model(FLAGS.model_name) call_variants( examples_filename=FLAGS.examples, checkpoint_path=FLAGS.checkpoint, model=model, execution_hardware=FLAGS.execution_hardware, output_file=FLAGS.outfile, max_batches=FLAGS.max_batches, batch_size=FLAGS.batch_size) if __name__ == '__main__': flags.mark_flags_as_required([ 'examples', 'outfile', 'checkpoint', ]) tf.app.run()
'truth_variants is required when in training mode.', errors.CommandLineError) if not options.confident_regions_filename: errors.log_and_raise( 'confident_regions is required when in training mode.', errors.CommandLineError) if options.gvcf_filename: errors.log_and_raise('gvcf is not allowed in training mode.', errors.CommandLineError) else: # Check for argument issues specific to calling mode. if options.variant_caller_options.sample_name == _UNKNOWN_SAMPLE: errors.log_and_raise('sample_name must be specified in calling mode.', errors.CommandLineError) if options.variant_caller_options.gq_resolution < 1: errors.log_and_raise('gq_resolution must be a non-negative integer.', errors.CommandLineError) # Run! make_examples_runner(options) if __name__ == '__main__': flags.mark_flags_as_required([ 'examples', 'mode', 'reads', 'ref', ]) tf.app.run()
sample_name=sample_name) variant_generator = haplotypes.maybe_resolve_conflicting_variants( independent_variants) write_variants_to_vcf( variant_generator=variant_generator, output_vcf_path=FLAGS.outfile, header=header) # Also write out the gVCF file if it was provided. if FLAGS.nonvariant_site_tfrecord_path: nonvariant_generator = io_utils.read_shard_sorted_tfrecords( FLAGS.nonvariant_site_tfrecord_path, key=_get_contig_based_variant_sort_keyfn(contigs), proto=variants_pb2.Variant) with vcf.VcfReader(FLAGS.outfile, use_index=False) as variant_reader: lessthanfn = _get_contig_based_lessthan(contigs) gvcf_variants = ( _transform_to_gvcf_record(variant) for variant in variant_reader.iterate()) merged_variants = merge_variants_and_nonvariants( gvcf_variants, nonvariant_generator, lessthanfn, fasta_reader) write_variants_to_vcf( variant_generator=merged_variants, output_vcf_path=FLAGS.gvcf_outfile, header=header) if __name__ == '__main__': flags.mark_flags_as_required(['infile', 'outfile', 'ref']) tf.app.run()
multi_allelic_qual_filter=FLAGS.multi_allelic_qual_filter, sample_name=sample_name) variant_generator = haplotypes.maybe_resolve_conflicting_variants( independent_variants) write_variants_to_vcf(variant_generator=variant_generator, output_vcf_path=FLAGS.outfile, header=header) # Also write out the gVCF file if it was provided. if FLAGS.nonvariant_site_tfrecord_path: nonvariant_generator = io_utils.read_shard_sorted_tfrecords( FLAGS.nonvariant_site_tfrecord_path, key=_get_contig_based_variant_sort_keyfn(contigs), proto=variants_pb2.Variant) with vcf.VcfReader(FLAGS.outfile, use_index=False) as variant_reader: lessthanfn = _get_contig_based_lessthan(contigs) gvcf_variants = (_transform_to_gvcf_record(variant) for variant in variant_reader.iterate()) merged_variants = merge_variants_and_nonvariants( gvcf_variants, nonvariant_generator, lessthanfn, fasta_reader) write_variants_to_vcf(variant_generator=merged_variants, output_vcf_path=FLAGS.gvcf_outfile, header=header) if __name__ == '__main__': flags.mark_flags_as_required(['infile', 'outfile', 'ref']) tf.app.run()
examples_out.write(example) # Do a bit of convenient logging. This is very verbose if we convert a # lot of reads... logging.info(( 'Added an example for read %s (span=%s) with cigar %s [%d added ' 'of %d total reads]'), read.fragment_name, ranges.to_literal(read_range), cigar.format_cigar_units(read.alignment.cigar), n_examples, i) if max_reads is not None and n_examples >= max_reads: return def main(argv): del argv # Unused. make_ngs_error_examples( ref_path=FLAGS.ref, vcf_path=FLAGS.vcf, bam_path=FLAGS.bam, examples_out_path=FLAGS.examples_out, max_reads=FLAGS.max_reads, ) if __name__ == '__main__': flags.mark_flags_as_required(['ref', 'vcf', 'bam', 'examples_out']) app.run(main)
def main(argv): del argv contigs = fasta.RefFastaReader(FLAGS.ref).header.contigs max_records = FLAGS.max_records if FLAGS.max_records >= 0 else None variants_iter = examples_to_variants(FLAGS.examples, max_records=max_records) if not FLAGS.sample_name: sample_name, variants_iter = peek_sample_name(variants_iter) else: sample_name = FLAGS.sample_name header = dv_vcf_constants.deepvariant_header( contigs=contigs, sample_names=[sample_name]) with vcf.VcfWriter(FLAGS.output_vcf, header=header) as writer: for variant in variants_iter: variant.calls[0].call_set_name = sample_name logging.log_every_n(logging.INFO, 'Converted %s', FLAGS.log_every, variant_utils.variant_key(variant)) writer.write(variant) if __name__ == '__main__': flags.mark_flags_as_required([ 'examples', 'ref', 'output_vcf', ]) app.run(main)