@Override public void setHeader(final VCFHeader header) { if (outputHasBeenWritten) { throw new IllegalStateException("The header cannot be modified after the header or variants have been written to the output stream."); } // make sure the header is sorted correctly this.header = doNotWriteGenotypes ? new VCFHeader(header.getMetaDataInSortedOrder()) : new VCFHeader( header.getMetaDataInSortedOrder(), header.getGenotypeSamples()); // create the config offsets map if ( this.header.getContigLines().isEmpty() ) { if ( ALLOW_MISSING_CONTIG_LINES ) { if ( GeneralUtils.DEBUG_MODE_ENABLED ) { System.err.println("No contig dictionary found in header, falling back to reference sequence dictionary"); } createContigDictionary(VCFUtils.makeContigHeaderLines(getRefDict(), null)); } else { throw new IllegalStateException("Cannot write BCF2 file with missing contig lines"); } } else { createContigDictionary(this.header.getContigLines()); } // set up the map from dictionary string values -> offset final ArrayList<String> dict = BCF2Utils.makeDictionary(this.header); for ( int i = 0; i < dict.size(); i++ ) { stringDictionaryMap.put(dict.get(i), i); } sampleNames = this.header.getGenotypeSamples().toArray(new String[this.header.getNGenotypeSamples()]); // setup the field encodings fieldManager.setup(this.header, encoder, stringDictionaryMap); }
@Override public void setHeader(final VCFHeader header) { if (outputHasBeenWritten) { throw new IllegalStateException("The header cannot be modified after the header or variants have been written to the output stream."); } // make sure the header is sorted correctly this.header = doNotWriteGenotypes ? new VCFHeader(header.getMetaDataInSortedOrder()) : new VCFHeader( header.getMetaDataInSortedOrder(), header.getGenotypeSamples()); // create the config offsets map if ( this.header.getContigLines().isEmpty() ) { if ( ALLOW_MISSING_CONTIG_LINES ) { if ( GeneralUtils.DEBUG_MODE_ENABLED ) { System.err.println("No contig dictionary found in header, falling back to reference sequence dictionary"); } createContigDictionary(VCFUtils.makeContigHeaderLines(getRefDict(), null)); } else { throw new IllegalStateException("Cannot write BCF2 file with missing contig lines"); } } else { createContigDictionary(this.header.getContigLines()); } // set up the map from dictionary string values -> offset final ArrayList<String> dict = BCF2Utils.makeDictionary(this.header); for ( int i = 0; i < dict.size(); i++ ) { stringDictionaryMap.put(dict.get(i), i); } sampleNames = this.header.getGenotypeSamples().toArray(new String[this.header.getNGenotypeSamples()]); // setup the field encodings fieldManager.setup(this.header, encoder, stringDictionaryMap); }
fieldManager.setup(header, encoder, stringDictionaryMap);