use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TextReadTest method canShadeBaseQuality.
@Test
public void canShadeBaseQuality() throws InvalidGenomicCoordsException, IOException, InvalidColourException {
GenomicCoords gc = new GenomicCoords("chr7:1-80", 80, null, null);
SAMRecord rec = new SAMRecord(null);
rec.setAlignmentStart(1);
rec.setCigarString("2M3D8M");
rec.setMappingQuality(30);
rec.setReadBases("AAAAATTTTT".getBytes());
rec.setBaseQualities("!!!!!IIIII".getBytes());
System.err.println(rec.getSAMString());
TextRead tr = new TextRead(rec, gc, false);
System.err.println(Splitter.on("m").omitEmptyStrings().splitToList(tr.getPrintableTextRead(false, false, false)));
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackBookmarkTest method canPrintBookmarksAsList.
@Test
public void canPrintBookmarksAsList() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
GenomicCoords gc = new GenomicCoords("chr1:1-100", 80, null, null);
TrackBookmark bm = new TrackBookmark(gc, "book1");
bm.setNoFormat(true);
gc = new GenomicCoords("chr1:200-300", 80, null, null);
bm.setGc(gc);
bm.addBookmark(gc, "book2");
gc = new GenomicCoords("chr2:2000-3000", 80, null, null);
bm.setGc(gc);
bm.addBookmark(gc, "foo bar");
assertEquals(3, bm.asList().size());
assertTrue(bm.asList().get(1).contains("chr1:200-300"));
assertTrue(bm.asList().get(2).contains("foo bar"));
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackBookmarkTest method canAddIntervalsToTrackBookmark.
@Test
public void canAddIntervalsToTrackBookmark() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
GenomicCoords gc = new GenomicCoords("chr1:1-100", 80, null, null);
TrackBookmark bm = new TrackBookmark(gc, "book1");
bm.setNoFormat(true);
gc = new GenomicCoords("chr1:400-500", 80, null, null);
// Move track to this position w/o adding this pos to bookmarks.
bm.setGc(gc);
gc = new GenomicCoords("chr1:200-300", 80, null, null);
bm.setGc(gc);
bm.addBookmark(gc, "book2");
gc = new GenomicCoords("chr1:1-1000", 80, null, null);
bm.setGc(gc);
assertTrue(bm.getIntervalFeatureList().size() == 2);
// Can set name
assertEquals("book2", bm.getIntervalFeatureList().get(1).getName());
System.out.println(bm.printToScreen());
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackBookmarkTest method canRemoveBookmark.
@Test
public void canRemoveBookmark() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
GenomicCoords gc = new GenomicCoords("chr1:1-100", 80, null, null);
TrackBookmark bm = new TrackBookmark(gc, "book1");
bm.setNoFormat(true);
gc = new GenomicCoords("chr1:200-300", 80, null, null);
bm.setGc(gc);
bm.addBookmark(gc, "book2");
// Zoom out to span both bookmarks.
gc = new GenomicCoords("chr1:1-1000", 80, null, null);
bm.setGc(gc);
// Just check we created a correct test object with two intervals
assertEquals(2, bm.getIntervalFeatureList().size());
// Partial overlap not touched
gc = new GenomicCoords("chr1:1-1000", 80, null, null);
bm.setGc(gc);
bm.removeBookmark(gc);
assertEquals(2, bm.getIntervalFeatureList().size());
// Go to first bookmark and remove it:
gc = new GenomicCoords("chr1:1-100", 80, null, null);
bm.setGc(gc);
bm.removeBookmark(gc);
bm.setGc(new GenomicCoords("chr1:1-1000", 80, null, null));
assertEquals(1, bm.getIntervalFeatureList().size());
// Go to second bookmark and remove it. No bookmarks left:
gc = new GenomicCoords("chr1:200-300", 80, null, null);
bm.setGc(gc);
bm.removeBookmark(gc);
assertTrue(bm.getIntervalFeatureList().size() == 0);
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackIntervalFeatureTest method canReadUnsortedVCF.
@Test
public void canReadUnsortedVCF() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
GenomicCoords gc = new GenomicCoords("chr18:1-10000", 80, null, null);
TrackIntervalFeature tif = new TrackIntervalFeature("test_data/CHD.exon.2010_03.sites.unsorted.vcf", gc);
List<IntervalFeature> xset = tif.getFeaturesInInterval("1", 1, 10000000);
assertEquals(9, xset.size());
IntervalFeature x = xset.get(1);
assertEquals("1", x.getChrom());
assertEquals(1108138, x.getFrom());
}
Aggregations