gt: 		LinkedList<Feature> gene2 = new LinkedList<>();
context: package org.kidneyomics.gtf;
  
  import static org.junit.Assert.*;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.LinkedList;
  import java.util.List;
  
  import org.biojava.nbio.genome.parsers.gff.Feature;
  import org.biojava.nbio.genome.parsers.gff.Location;
  import org.junit.Test;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.core.io.ClassPathResource;
  import org.springframework.core.io.Resource;
  
  public class FindOverlappingExonsBetweenGenesTest {
  
  	Logger logger = LoggerFactory.getLogger(FindOverlappingExonsBetweenGenesTest.class);
  	
  	@Test
  	public void testTwoGenes() throws IOException {
  		logger.info("testTwoGenes");
  		Resource r = new ClassPathResource("genecode.v19.annotation.head.10000.gtf.gz");
  		
  		File gtf = r.getFile();
  		
  		LinkedList<Feature> gene1 = new LinkedList<>();
  		LinkedList<Feature> gene2 = new LinkedList<>();
  		
  		
  		try(GTFReader reader = GTFReader.getGTFByFileNoEnsemblVersion(gtf)) {
  			//Only read exons
  			reader.addFilter(new ExonFilter()).addFilter(new RemoveRetainedIntronFilter());
  			for(Feature f : reader) {
  				String geneId = f.getAttribute("gene_id");
  				if(geneId.equals("ENSG00000157916")) {
  					gene1.add(f);
  				} else if(geneId.equals("ENSG00000157911")) {
  					gene2.add(f);
  				}
  			}
  		}
  		
  		GTFFeatureUtil.sortFeatures(gene1);
  		GTFFeatureUtil.sortFeatures(gene2);
  		
  		FindOverlappingExonsBetweenGenes service = new FindOverlappingExonsBetweenGenes();
  		List<Feature> results = service.findOverlappingExons(gene1, gene2);
  		
  		assertTrue(results.size() > 0);
  		
  		logger.info("Size of results " + results.size());
  		
  		gene1.removeAll(results);
  		gene2.removeAll(results);
  		
  		List<Feature> gene1Merge = FeatureMerger.mergeOverlappingFeaturesIgnoringStrand(gene1);
  		List<Feature> gene2Merge = FeatureMerger.mergeOverlappingFeaturesIgnoringStrand(gene2);
  		
  		LinkedList<Feature> noOverlap = new LinkedList<>();
  		
  		noOverlap.addAll(gene1Merge);
  		noOverlap.addAll(gene2Merge);
  		
  		assertTrue(GTFFeatureUtil.hasNoOverlapIgnoreStrand(noOverlap));
  		
  	}
  	
  	
  	@Test
  	public void test1() {
  		logger.info("test1");
  		
  		FindOverlappingExonsBetweenGenes service = new FindOverlappingExonsBetweenGenes();
  		
  		
  		Feature f1 = new Feature("chr1", "a", "exon", Location.fromBio(100, 200, '+'), 0.0, 0, "");
  		Feature f2 = new Feature("chr1", "a", "exon", Location.fromBio(50, 150, '+'), 0.0, 0, "");
  		
  		
  		
  		LinkedList<Feature> gene1 = new LinkedList<>();
  		gene1.add(f1);
  		gene1.add(f2);
  		
  		Collections.sort(gene1, new FeatureComparator());
  		
  		
  		List<Feature> results = service.findOverlappingExons(gene1, gene1);
  		
  		assertEquals(2,results.size());
  	}
  	
  	
  	@Test
  	public void test2() {
  		logger.info("test2");
  		
  		FindOverlappingExonsBetweenGenes service = new FindOverlappingExonsBetweenGenes();
  		
  		
  		Feature f1 = new Feature("chr1", "a", "exon", Location.fromBio(100, 200, '+'), 0.0, 0, "");
  		Feature f2 = new Feature("chr1", "a", "exon", Location.fromBio(50, 150, '+'), 0.0, 0, "");
  		
  		
  		
  		LinkedList<Feature> gene1 = new LinkedList<>();
  		gene1.add(f1);
  		gene1.add(f2);
  		
  		Collections.sort(gene1, new FeatureComparator());
  		
  		
  		Feature f3 = new Feature("chr2", "a", "exon", Location.fromBio(100, 200, '+'), 0.0, 0, "");
  		Feature f4 = new Feature("chr2", "a", "exon", Location.fromBio(50, 150, '+'), 0.0, 0, "");
  		
  		
  		
  		LinkedList<Feature> gene2 = new LinkedList<>();
  		gene2.add(f3);
  		gene2.add(f4);
  		
  		Collections.sort(gene2, new FeatureComparator());
  		
  		
  		List<Feature> results = service.findOverlappingExons(gene1, gene2);
  		
  		assertEquals(0,results.size());
  	}
  	
  	@Test
  	public void test3() {
  		logger.info("test3");
  		FindOverlappingExonsBetweenGenes service = new FindOverlappingExonsBetweenGenes();
  		
  		
  		Feature f1 = new Feature("chr1", "a", "exon", Location.fromBio(100, 200, '+'), 0.0, 0, "");
  		Feature f2 = new Feature("chr1", "a", "exon", Location.fromBio(50, 150, '+'), 0.0, 0, "");
  		
  		
  		
  		LinkedList<Feature> gene1 = new LinkedList<>();
  		gene1.add(f1);
  		gene1.add(f2);
  		
  		Collections.sort(gene1, new FeatureComparator());
  		
  		
  		Feature f3 = new Feature("chr1", "a", "exon", Location.fromBio(199, 250, '+'), 0.0, 0, "");
  		Feature f4 = new Feature("chr1", "a", "exon", Location.fromBio(400, 500, '+'), 0.0, 0, "");
  		
  		
  		
  		LinkedList<Feature> gene2 = new LinkedList<>();
  		gene2.add(f3);
  		gene2.add(f4);
  		
  		Collections.sort(gene2, new FeatureComparator());
  		
  		
  		List<Feature> results = service.findOverlappingExons(gene1, gene2);
  		
  		assertEquals(2,results.size());
  	}
  	
  	@Test
  	public void test4() {
  		logger.info("test4");
  		FindOverlappingExonsBetweenGenes service = new FindOverlappingExonsBetweenGenes();
  		
  		
  		Feature f1 = new Feature("chr1", "a", "exon", Location.fromBio(100, 200, '+'), 0.0, 0, "");
  		Feature f2 = new Feature("chr1", "a", "exon", Location.fromBio(50, 150, '+'), 0.0, 0, "");
  		
  		
  		
  		LinkedList<Feature> gene1 = new LinkedList<>();
  		gene1.add(f1);
  		gene1.add(f2);
  		
  		Collections.sort(gene1, new FeatureComparator());
  		
  		
  		Feature f3 = new Feature("chr1", "a", "exon", Location.fromBio(149, 250, '+'), 0.0, 0, "");
  		Feature f4 = new Feature("chr1", "a", "exon", Location.fromBio(400, 500, '+'), 0.0, 0, "");
  		
  		
  		
  		LinkedList<Feature> gene2 = new LinkedList<>();
  		gene2.add(f3);
  		gene2.add(f4);
  		
  		Collections.sort(gene2, new FeatureComparator());
  		
  		
  		List<Feature> results = service.findOverlappingExons(gene1, gene2);
  		
  		assertEquals(3,results.size());
  	}
  
  	
  	@Test
  	public void test5() {
  		logger.info("test5");
  		FindOverlappingExonsBetweenGenes service = new FindOverlappingExonsBetweenGenes();
  		
  		
  		Feature f1 = new Feature("chr1", "a", "exon", Location.fromBio(100, 200, '+'), 0.0, 0, "");
  		Feature f2 = new Feature("chr1", "a", "exon", Location.fromBio(50, 150, '+'), 0.0, 0, "");
  		
  		
  		
  		LinkedList<Feature> gene1 = new LinkedList<>();
  		gene1.add(f1);
  		gene1.add(f2);
  		
  		Collections.sort(gene1, new FeatureComparator());
  		
  		
  		Feature f3 = new Feature("chr1", "a", "exon", Location.fromBio(149, 250, '+'), 0.0, 0, "");
  		Feature f4 = new Feature("chr1", "a", "exon", Location.fromBio(45, 60, '+'), 0.0, 0, "");
  		Feature f5 = new Feature("chr1", "a", "exon", Location.fromBio(37, 51, '+'), 0.0, 0, "");
  		
  		
  		LinkedList<Feature> gene2 = new LinkedList<>();
  		gene2.add(f3);
  		gene2.add(f4);
  		gene2.add(f5);
  		
  		Collections.sort(gene2, new FeatureComparator());
  		//for(Feature f : gene2) {
  		//	System.err.println(GTFFeatureRenderer.render(f));
  		//}
  		
  		List<Feature> results = service.findOverlappingExons(gene1, gene2);
  		
  		assertEquals(5,results.size());
  	}
  	
  	@Test
  	public void test6() {
  		logger.info("test6");
  		FindOverlappingExonsBetweenGenes service = new FindOverlappingExonsBetweenGenes();
  		
  		
  		Feature f1 = new Feature("chr1", "a", "exon", Location.fromBio(100, 200, '+'), 0.0, 0, "");
  		Feature f2 = new Feature("chr1", "a", "exon", Location.fromBio(50, 150, '+'), 0.0, 0, "");
  		Feature f6 = new Feature("chr1", "a", "exon", Location.fromBio(1, 37, '+'), 0.0, 0, "");
  		
  		
  		LinkedList<Feature> gene1 = new LinkedList<>();
  		gene1.add(f1);
  		gene1.add(f2);
  		gene1.add(f6);
  		
  		Collections.sort(gene1, new FeatureComparator());
  		
  		
  		Feature f3 = new Feature("chr1", "a", "exon", Location.fromBio(149, 250, '+'), 0.0, 0, "");
  		Feature f4 = new Feature("chr1", "a", "exon", Location.fromBio(45, 60, '+'), 0.0, 0, "");
  		Feature f5 = new Feature("chr1", "a", "exon", Location.fromBio(37, 51, '+'), 0.0, 0, "");
  		
  		
  