use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackReadsTest method canFilterReadsInIntervalKeepAll.
@Test
public void canFilterReadsInIntervalKeepAll() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException, InvalidColourException {
GenomicCoords gc = new GenomicCoords("chr7:1000001-1000081", 100, samSeqDict, fastaFile);
TrackReads tr = new TrackReads("test_data/variant_reads.sam", gc);
tr.setNoFormat(true);
tr.setVariantReadInInterval("chr7", 1000028, 1000028, true);
// Default: only variants
assertEquals(2, tr.printToScreen().split("\n").length);
tr.setVariantReadInInterval("chr7", 1000028, 1000028, false);
System.err.println(tr.printToScreen());
assertEquals(4, tr.printToScreen().split("\n").length);
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackReadsTest method canConstructFromUnsortedInput.
@Test
public void canConstructFromUnsortedInput() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException, InvalidColourException {
// If the genomic window is too large do not process the bam file and return zero height track.
GenomicCoords gc = new GenomicCoords("chr7:1-100000000", 80, samSeqDict, fastaFile);
TrackReads tr = new TrackReads("test_data/ds051.noindex.sam", gc);
assertEquals("", tr.printToScreen());
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackReadsTest method canShadeLowBaseQuality.
@Test
public void canShadeLowBaseQuality() throws InvalidGenomicCoordsException, InvalidColourException, ClassNotFoundException, IOException, InvalidRecordException, SQLException, InvalidCommandLineException, InvalidConfigException {
String shade = Config.get(ConfigKey.shade_low_mapq);
String xshade = Integer.toString(Xterm256.colorNameToXterm256(shade));
GenomicCoords gc = new GenomicCoords("chr7:999-1041", 80, null, null);
TrackReads tr = new TrackReads("test_data/missingReadSeq.bam", gc);
System.err.println(tr.printToScreen());
assertTrue(tr.printToScreen().trim().startsWith("[48;5;" + xshade));
// Read with soft clipped bases
gc = new GenomicCoords("chr7:9999-10050", 80, null, null);
tr = new TrackReads("test_data/missingReadSeq.bam", gc);
assertTrue(tr.printToScreen().contains(xshade));
// Read with deletions and skipped bases
gc = new GenomicCoords("chr7:19999-20050", 80, null, null);
tr = new TrackReads("test_data/missingReadSeq.bam", gc);
tr.printToScreen();
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackSeqRegexTest method canIntrepretIupac.
@Test
public void canIntrepretIupac() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
GenomicCoords gc = new GenomicCoords("seq:1-100", 80, null, "test_data/seq_cg.fa");
TrackSeqRegex trackSeqRegex = new TrackSeqRegex(gc);
trackSeqRegex.setNoFormat(true);
// NB: Must be set BEFORE setSeqRegex;
trackSeqRegex.setIupac(true);
trackSeqRegex.setSeqRegex("atcKVNMNNNN");
assertTrue(trackSeqRegex.getIntervalFeatureList().size() > 5 && trackSeqRegex.getIntervalFeatureList().size() < 100);
assertTrue(trackSeqRegex.printToScreen().contains("ATC"));
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class GenotypeMatrixTest method canHandleIntervalWithNoFeatures.
@Test
public void canHandleIntervalWithNoFeatures() throws IOException, InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException, InvalidColourException {
GenomicCoords gc = new GenomicCoords("2:1-1000", 80, null, null);
TrackIntervalFeature vcf = new TrackIntervalFeature("test_data/ALL.wgs.mergedSV.v8.20130502.svs.genotypes.vcf.gz", gc);
List<IntervalFeature> linf = vcf.getIntervalFeatureList();
GenotypeMatrix gm = new GenotypeMatrix();
// gm.makeMatrix(linf, 80, null);
String x = gm.printToScreen(true, linf, 80, null);
assertTrue(x.isEmpty());
}
Aggregations