Source:
<code>public static void main(String[] args) throws Exception { GenomicsDatasetOptions opts = PipelineOptionsFactory.fromArgs(args) .withValidation().as(GenomicsDatasetOptions.class); GenomicsFactory.OfflineAuth auth = GenomicsOptions.Methods.getGenomicsAuth(opts); Genomics genomics = auth.getGenomics(auth.getDefaultFactory()); List<String> callSetIds = ImmutableList.copyOf(opts.getCallSetIds().split(",")); List<String> transcriptSetIds = validateAnnotationSetsFlag(genomics, opts.getTranscriptSetIds(), "TRANSCRIPT"); List<String> variantAnnotationSetIds = validateAnnotationSetsFlag(genomics, opts.getVariantAnnotationSetIds(), "VARIANT"); String refsetId = validateRefsetForAnnotationSets(genomics, transcriptSetIds); Iterable<Contig> contigs = opts.isAllReferences() ? Contig.getContigsInVariantSet( genomics, opts.getDatasetId(), SexChromosomeFilter.INCLUDE_XY) : Contig.parseContigsFromCommandLine(opts.getReferences()); Pipeline p = Pipeline.create(opts); DataflowWorkarounds.registerGenomicsCoders(p); <START> DataflowWorkarounds.getPCollection(ImmutableList.copyOf(contigs), p, opts.getNumWorkers()) <END> .apply(ParDo.of(new AnnotateVariants(auth, opts.getDatasetId(), refsetId, callSetIds, transcriptSetIds, variantAnnotationSetIds))) .apply(GroupByKey.<String, VariantAnnotation>create()) .apply(ParDo.of(new DoFn<KV<String, Iterable<VariantAnnotation>>, String>() { @Override public void processElement(ProcessContext c) { c.output(c.element().getKey() + ": " + c.element().getValue()); } })) .apply(TextIO.Write.to(opts.getOutput())); p.run(); }</code><technical_language>Is this necessary? convert list of Contigs a PCollection directly</technical_language>

Target:
public static void main(String[] args) throws Exception { GenomicsDatasetOptions opts = PipelineOptionsFactory.fromArgs(args) .withValidation().as(GenomicsDatasetOptions.class); GenomicsFactory.OfflineAuth auth = GenomicsOptions.Methods.getGenomicsAuth(opts); Genomics genomics = auth.getGenomics(auth.getDefaultFactory()); List<String> callSetIds = ImmutableList.of(); if (!Strings.isNullOrEmpty(opts.getCallSetIds().trim())) { callSetIds = ImmutableList.copyOf(opts.getCallSetIds().split(",")); } List<String> transcriptSetIds = validateAnnotationSetsFlag(genomics, opts.getTranscriptSetIds(), "TRANSCRIPT"); List<String> variantAnnotationSetIds = validateAnnotationSetsFlag(genomics, opts.getVariantAnnotationSetIds(), "VARIANT"); validateRefsetForAnnotationSets(genomics, transcriptSetIds); Iterable<Contig> contigs = opts.isAllReferences() ? Contig.getContigsInVariantSet( genomics, opts.getDatasetId(), SexChromosomeFilter.INCLUDE_XY) : Contig.parseContigsFromCommandLine(opts.getReferences()); Pipeline p = Pipeline.create(opts); DataflowWorkarounds.registerGenomicsCoders(p); p.begin() .apply(Create.of(contigs)) .apply(ParDo.of(new AnnotateVariants(auth, opts.getDatasetId(), callSetIds, transcriptSetIds, variantAnnotationSetIds))) .apply(GroupByKey.<String, VariantAnnotation>create()) .apply(ParDo.of(new DoFn<KV<String, Iterable<VariantAnnotation>>, String>() { @Override public void processElement(ProcessContext c) { c.output(c.element().getKey() + ": " + c.element().getValue()); } })) .apply(TextIO.Write.to(opts.getOutput())); p.run(); }