<commit_before>package com.github.lindenb.jvarkit.tools.misc;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import net.sf.samtools.SAMSequenceDictionary;
import net.sf.samtools.SAMSequenceRecord;
import net.sf.samtools.util.CloserUtil;

import org.broadinstitute.variant.variantcontext.VariantContext;
import org.broadinstitute.variant.variantcontext.VariantContextBuilder;
import org.broadinstitute.variant.variantcontext.writer.VariantContextWriter;
import org.broadinstitute.variant.vcf.VCFHeader;
import org.broadinstitute.variant.vcf.VCFHeaderLine;

import com.github.lindenb.jvarkit.io.IOUtils;
import com.github.lindenb.jvarkit.util.vcf.AbstractVCFFilter2;
import com.github.lindenb.jvarkit.util.vcf.VcfIterator;

public class ConvertVcfChromosomes extends AbstractVCFFilter2 {
	private boolean use_original_chrom_name_if_no_mapping=false;
	private Map<String,String> customMapping=new HashMap<String,String>();
	private Set<String> unmappedChromosomes=new HashSet<String>();
	private boolean ignore_if_no_mapping=false;
	private ConvertVcfChromosomes()
		{
		
		}
	
	private String convertName(String chrom)throws IOException
		{
		if(chrom==null) throw new NullPointerException();
		String newname=customMapping.get(chrom);
		if(newname==null)
			{
			if(use_original_chrom_name_if_no_mapping)
				{
				if(!unmappedChromosomes.contains(chrom))
					{
					warning("unmapped chromosome "+chrom);
					unmappedChromosomes.add(chrom);
					}
				if(ignore_if_no_mapping) return null;
				
				return chrom;
				}<commit_msg>rename chromosomes<commit_after>package com.github.lindenb.jvarkit.tools.misc;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import net.sf.samtools.SAMSequenceDictionary;
import net.sf.samtools.SAMSequenceRecord;
import net.sf.samtools.util.CloserUtil;

import org.broadinstitute.variant.variantcontext.VariantContext;
import org.broadinstitute.variant.variantcontext.VariantContextBuilder;
import org.broadinstitute.variant.variantcontext.writer.VariantContextWriter;
import org.broadinstitute.variant.vcf.VCFHeader;
import org.broadinstitute.variant.vcf.VCFHeaderLine;

import com.github.lindenb.jvarkit.io.IOUtils;
import com.github.lindenb.jvarkit.util.vcf.AbstractVCFFilter2;
import com.github.lindenb.jvarkit.util.vcf.VcfIterator;

public class ConvertVcfChromosomes extends AbstractVCFFilter2 {
	private boolean use_original_chrom_name_if_no_mapping=false;
	private Map<String,String> customMapping=new HashMap<String,String>();
	private Set<String> unmappedChromosomes=new HashSet<String>();
	private boolean ignore_if_no_mapping=false;
	private ConvertVcfChromosomes()
		{
		
		}
	
	private String convertName(String chrom)throws IOException
		{
		if(chrom==null) throw new NullPointerException();
		String newname=customMapping.get(chrom);
		if(newname==null)
			{
			if(!unmappedChromosomes.contains(chrom))
				{
				warning("unmapped chromosome "+chrom);
				unmappedChromosomes.add(chrom);
				}
			if(ignore_if_no_mapping) return null;
			
			if(use_original_chrom_name_if_no_mapping)
				{	
				return chrom;
				}
{'fraction_non_alphanumeric': 0.09796619879690634, 'fraction_numerical': 0.0011458034947006588, 'mean_word_length': 6.0120481927710845, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2500354', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1148, 'n_words': 177}