use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TextReadTest method canPrintFormattedRead.
@Test
public void canPrintFormattedRead() throws InvalidGenomicCoordsException, IOException, InvalidColourException {
GenomicCoords gc = new GenomicCoords("chr7:5566778-5566798", 80, null, null);
SAMRecord rec = new SAMRecord(null);
rec.setAlignmentStart(5566780);
rec.setCigarString("24M");
rec.setReadBases("AACCGGTTAACCGGTTAACCGGTT".getBytes());
TextRead textRead = new TextRead(rec, gc, false);
rec.setSecondOfPairFlag(false);
// '4': Underline
assertTrue(!textRead.getPrintableTextRead(true, false, false).contains("4;"));
rec.setSecondOfPairFlag(true);
// '4': Underline
assertTrue(textRead.getPrintableTextRead(true, false, false).contains("4;"));
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TextReadTest method canPrintReadWithSkippedBases.
@Test
public void canPrintReadWithSkippedBases() throws InvalidGenomicCoordsException, IOException, InvalidColourException {
GenomicCoords gc = new GenomicCoords("chr7:1-800", 80, samSeqDict, fastaFile);
SAMRecord rec = new SAMRecord(null);
rec.setAlignmentStart(1);
rec.setCigarString("70M200N50M200N10M");
TextRead textRead = new TextRead(rec, gc, false);
System.out.println(textRead.getPrintableTextRead(false, true, false));
assertTrue(textRead.getPrintableTextRead(false, true, false).startsWith(">"));
assertTrue(textRead.getPrintableTextRead(false, true, false).endsWith(">"));
assertTrue(textRead.getPrintableTextRead(false, true, false).contains("_"));
// Very large skipped region: Only show the skipped part.
rec.setCigarString("1M5000N1M");
textRead = new TextRead(rec, gc, false);
System.out.println(textRead.getPrintableTextRead(false, true, false));
assertTrue("_", textRead.getPrintableTextRead(false, true, false).startsWith("_"));
assertTrue("_", textRead.getPrintableTextRead(false, true, false).endsWith("_"));
assertEquals("", textRead.getPrintableTextRead(false, true, false).replaceAll("_", ""));
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackBookmarkTest method canColorByRegex.
@Test
public void canColorByRegex() throws Exception {
GenomicCoords gc = new GenomicCoords("chr1:1-100", 80, null, null);
TrackBookmark bm = new TrackBookmark(gc, "book1");
// This is to populate the ideograms.
bm.printToScreen();
List<Argument> colorForRegex = new ArrayList<Argument>();
colorForRegex.add(new Argument(".*", "216", false));
bm.setColorForRegex(colorForRegex);
assertTrue(bm.printToScreen().contains("216"));
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackIntervalFeatureTest method canConstructTrack.
@Test
public void canConstructTrack() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
String intervalFileName = "test_data/refSeq.bed";
// IntervalFeatureSet ifs= new IntervalFeatureSet(new File(intervalFileName));
GenomicCoords gc = new GenomicCoords("chr1:1-70", 80, null, null);
TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
tif.setNoFormat(true);
String exp = "|||||||||| |||||||||| ";
assertEquals(exp, tif.printToScreen());
gc = new GenomicCoords("chr1:1-70", 80, null, null);
tif = new TrackIntervalFeature(intervalFileName, gc);
tif.setNoFormat(true);
assertTrue(tif.printToScreen().startsWith("||||"));
assertTrue(tif.printToScreen().endsWith(" "));
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackIntervalFeatureTest method canShowAndHide_getFeaturesInInterval.
@Test
public void canShowAndHide_getFeaturesInInterval() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
String intervalFileName = "test_data/hg19_genes_head.gtf.gz";
GenomicCoords gc = new GenomicCoords("chr1:10000-100000", 80, null, null);
TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
tif.setShowHideRegex(Pattern.compile("start_codon"), Pattern.compile("OR4F"));
List<IntervalFeature> subset = tif.getFeaturesInInterval("chr1", 1, 500000000);
assertEquals(40, subset.size());
}
Aggregations