Search in sources :

Example 11 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method transcriptGTFToOneLine.

@Test
public void transcriptGTFToOneLine() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
    // Expect:
    // ccccccccccc-----cccccae------------------------------------eeeeeeeee
    String intervalFileName = "test_data/hg19.gencode_genes_v19.gtf.gz";
    GenomicCoords gc = new GenomicCoords("chr7:5568562-5572120", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    tif.setNoFormat(true);
    System.err.println(tif.printToScreen());
    assertTrue(tif.printToScreen().trim().startsWith("ccc"));
    assertTrue(tif.printToScreen().trim().endsWith("eee"));
    assertEquals(6, tif.getIntervalFeatureList().size());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 12 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canShowAndHide_coordsOfNextFeature.

@Test
public void canShowAndHide_coordsOfNextFeature() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
    GenomicCoords gc = new GenomicCoords("chr1:1", 80, null, null);
    String intervalFileName = "test_data/hg19_genes_head.gtf.gz";
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    tif.setShowHideRegex(Pattern.compile(".*exon.*"), Pattern.compile(".*DDX11L1.*"));
    GenomicCoords curr = tif.coordsOfNextFeature(gc, false);
    assertEquals(14362, (int) curr.getFrom());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 13 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canProcessIndelAtWindowBoundary.

@Test
public void canProcessIndelAtWindowBoundary() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
    // VCF record:
    // 1 113054374 . CTTG C
    // The genomic start is at 113054374, which is inside the GenomicCoords interval.
    // However, the printable coordinates start at 113054374 + 1 because the first
    // base is equal to reference. This means that at the boundary we have a feature
    // that is in this interval but not visible.
    GenomicCoords gc = new GenomicCoords("1:113054305-113054375", 70, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature("test_data/CEU.exon.2010_06.genotypes.vcf.gz", gc);
    tif.setNoFormat(true);
    // VCF record is in interval and visible:
    assertEquals(1, tif.getIntervalFeatureList().size());
    System.err.println(tif.printToScreen());
    // Deletion
    assertTrue(tif.printToScreen().contains("D"));
    // Now the end coordinate equals the start of the deletion. Since the first base of the
    // deletion is equal to ref, there is nothing to print on screen:
    gc = new GenomicCoords("1:113054305-113054374", 70, null, null);
    tif = new TrackIntervalFeature("test_data/CEU.exon.2010_06.genotypes.vcf.gz", gc);
    tif.setNoFormat(true);
    // tif.getGenotypeMatrix().setnMaxSamples(0);
    // Feature is in interval
    assertEquals(1, tif.getIntervalFeatureList().size());
    // But nothing to print
    assertTrue(tif.printToScreen().length() > 70);
    // No deletion visible
    assertTrue(!tif.printToScreen().contains("D"));
// GenomicCoords gc= new GenomicCoords("1:113054305-113054374", 70, null, null);
// TrackIntervalFeature tif= new TrackIntervalFeature("test_data/CEU.exon.2010_06.genotypes.vcf.gz", gc);
// tif.getGenotypeMatrix();
// 
// List<IntervalFeature> xset = tif.getFeaturesInInterval("1", 113054305, 113054374);
// System.err.println(xset);
// System.err.println(tif.printToScreen());
// 
// assertEquals(9, xset.size());
// IntervalFeature x = xset.get(1);
// assertEquals("1", x.getChrom());
// assertEquals(1108138, x.getFrom());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 14 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canPrintMappingOfFeaturesToScreen.

@Test
public void canPrintMappingOfFeaturesToScreen() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
    List<Double> rulerMap = new ArrayList<Double>();
    for (int i = 14000; i < 14400; i += 10) {
        rulerMap.add((double) i);
    }
    System.out.println(rulerMap);
    GenomicCoords gc = new GenomicCoords("chr18:1-10000", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature("test_data/refSeq.hg19.short.bed", gc);
    System.out.println(tif.getFeaturesInInterval("chr1", 0, 1000000000).get(0));
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 15 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canReadBigBed.

@Test
public void canReadBigBed() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
    String filename = "test_data/wgEncodeDukeDnase8988T.fdr01peaks.hg19.bb";
    GenomicCoords gc = new GenomicCoords("chr1:1-800170", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature(filename, gc);
    tif.setNoFormat(true);
    assertEquals(12, tif.getIntervalFeatureList().size());
    assertEquals(564665 + 1, tif.getIntervalFeatureList().get(0).getFrom());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Aggregations

GenomicCoords (samTextViewer.GenomicCoords)156 Test (org.junit.Test)147 File (java.io.File)10 ArrayList (java.util.ArrayList)9 Config (coloring.Config)8 VCFFileReader (htsjdk.variant.vcf.VCFFileReader)8 VCFHeader (htsjdk.variant.vcf.VCFHeader)8 SAMRecord (htsjdk.samtools.SAMRecord)6 InvalidCommandLineException (exceptions.InvalidCommandLineException)3 InvalidGenomicCoordsException (exceptions.InvalidGenomicCoordsException)1 MappingQualityFilter (htsjdk.samtools.filter.MappingQualityFilter)1 SamRecordFilter (htsjdk.samtools.filter.SamRecordFilter)1 IOException (java.io.IOException)1 TrackReads (tracks.TrackReads)1