Java Code Examples for htsjdk.samtools.util.CollectionUtil#makeCollection()

The following examples show how to use htsjdk.samtools.util.CollectionUtil#makeCollection() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeneFromGTFBuilder.java    From Drop-seq with MIT License 6 votes vote down vote up
private GeneFromGTF makeGeneWithTranscriptsFromGTFRecords(final Collection<GTFRecord> gtfRecords) {
     final GeneFromGTF gene = makeGeneFromGTFRecords(gtfRecords);
     // Remove featureType==gene before making transcripts
     final Collection<GTFRecord> nonGeneGTFRecords = CollectionUtil.makeCollection(new GeneAnnotationFilter(gtfRecords.iterator()));

     final Map<String, List<GTFRecord>> gtfLinesByTranscript = gatherByTranscriptId(nonGeneGTFRecords);
     for (final Map.Entry<String, List<GTFRecord>> entry : gtfLinesByTranscript.entrySet()) {
         if (entry.getKey() == null)
	// Skip gene entries
             continue;
         addTranscriptToGeneFromGTFRecords(gene, entry.getValue());
     }

     if (!gene.iterator().hasNext())
throw new AnnotationException("No transcript in GTF for gene " + gene.getName());

     return gene;
 }
 
Example 2
Source File: ReduceGtfTest.java    From Drop-seq with MIT License 6 votes vote down vote up
@Test(enabled=true, groups={"dropseq", "transcriptome"})
public void testAPITD1() {
	Iterator<GTFRecord> gtfIterator = parseGtf(GTF_FILE4);
	Assert.assertNotNull(gtfIterator);
       Collection<GTFRecord> records = CollectionUtil.makeCollection(gtfIterator);
	// gunzip -c human_APITD1.gtf.gz | grep -v CDS |grep -v start_codon |grep -v stop_codon |wc -l
	Assert.assertEquals(records.size(),26);

       final GeneFromGTFBuilder geneBuilder = new GeneFromGTFBuilder(records.iterator());
       Collection<GeneFromGTF> genes = CollectionUtil.makeCollection(geneBuilder);
	Assert.assertEquals(genes.size(),1);

       final EnhanceGTFRecords enhancer = new EnhanceGTFRecords();
       for (final GeneFromGTF gene : genes)
		Assert.assertNotNull(enhancer.enhanceGene(gene));
}
 
Example 3
Source File: ReduceGtfTest.java    From Drop-seq with MIT License 6 votes vote down vote up
@Test(enabled=true, groups={"dropseq", "transcriptome"})
public void testAPITD1Complex() {
       Iterator<GTFRecord> gtfIterator = parseGtf(GTF_FILE5);
	Assert.assertNotNull(gtfIterator);
       Collection<GTFRecord> records = CollectionUtil.makeCollection(gtfIterator);
	// gunzip -c human_APITD1.gtf.gz | grep -v CDS |grep -v start_codon |grep -v stop_codon |wc -l
	Assert.assertEquals(records.size(),42);

       final GeneFromGTFBuilder geneBuilder = new GeneFromGTFBuilder(records.iterator());
       Collection<GeneFromGTF> genes = CollectionUtil.makeCollection(geneBuilder);
       Assert.assertEquals(genes.size(),2);

       final EnhanceGTFRecords enhancer = new EnhanceGTFRecords();
       for (final GeneFromGTF gene : genes)
		Assert.assertNotNull(enhancer.enhanceGene(gene));
}