All Downloads are FREE. Search and download functionalities are using the official Maven repository.

umcg.genetica.variantAnnotator.VariantAnnotator Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package umcg.genetica.variantAnnotator;

import java.util.ArrayList;
import java.util.HashMap;

/**
 *
 * @author Patrick Deelen
 */
public class VariantAnnotator {

	HashMap> annotations;
	
	public VariantAnnotator() {
		annotations = new HashMap>();
	}
	
	public void addAnnotaion(E annotation) throws Exception{
		ArrayList chrAnnotations = annotations.get(annotation.getSeqname());
		if(chrAnnotations == null){
			chrAnnotations = new ArrayList();
			annotations.put(annotation.getSeqname(), chrAnnotations);
			chrAnnotations.add(annotation);
		} else {
			E last = chrAnnotations.get(chrAnnotations.size() - 1);
			if(last.getStart() > annotation.getStart()){
				throw new Exception("Annotations not sorted");
			} 
			chrAnnotations.add(annotation);
		}
	}
	

	
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy