Search in sources :

Example 31 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackPileupTest method canConstructFromUnsortedInput.

@Test
public void canConstructFromUnsortedInput() throws ClassNotFoundException, IOException, InvalidGenomicCoordsException, InvalidRecordException, SQLException {
    GenomicCoords gc = new GenomicCoords("chr1:1-1000", 80, null, null);
    new TrackPileup("test_data/ds051.noindex.sam", gc);
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 32 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackPileupTest method canHandleZeroReads.

@Test
public void canHandleZeroReads() throws ClassNotFoundException, IOException, InvalidGenomicCoordsException, InvalidRecordException, SQLException {
    GenomicCoords gc = new GenomicCoords("chr1:1-1000", 80, null, null);
    TrackPileup tr = new TrackPileup("test_data/ear045.oxBS.actb.bam", gc);
    assertEquals(0, tr.getDepth(gc.getChrom(), gc.getFrom(), gc.getTo()).size());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 33 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackPileupTest method canCollectCoverageAtOnePos.

@Test
public void canCollectCoverageAtOnePos() throws ClassNotFoundException, IOException, InvalidGenomicCoordsException, InvalidRecordException, SQLException {
    GenomicCoords gc = new GenomicCoords("chr7:5588536-5588536", 80, null, null);
    TrackPileup tr = new TrackPileup("test_data/ear045.oxBS.actb.bam", gc);
    assertEquals(1, tr.getDepth(gc.getChrom(), gc.getFrom(), gc.getTo()).size());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 34 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackPileupTest method canProcessReadsWithMissingSequence.

@Test
public void canProcessReadsWithMissingSequence() throws ClassNotFoundException, IOException, InvalidGenomicCoordsException, InvalidRecordException, SQLException, InvalidColourException, InvalidConfigException {
    GenomicCoords gc = new GenomicCoords("chr7:1-1000", 80, null, null);
    TrackPileup tr = new TrackPileup("test_data/missingReadSeq.bam", gc);
    tr.setNoFormat(true);
    tr.printToScreen();
    assertTrue(tr.printToScreen().trim().startsWith("_"));
    assertEquals(1, (int) tr.getDepth(gc.getChrom(), gc.getFrom(), gc.getTo()).entrySet().iterator().next().getValue());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 35 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackPileupTest method canFilterReadsContainingVariants.

@Test
public void canFilterReadsContainingVariants() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException, InvalidColourException {
    GenomicCoords gc = new GenomicCoords("chr7:1000001-1000081", 100, null, "test_data/chr7.fa");
    TrackPileup tp = new TrackPileup("test_data/variant_reads.sam", gc);
    tp.setNoFormat(true);
    tp.setyMaxLines(10);
    // N. reads stacked in this interval before filtering
    assertEquals(10, tp.printToScreen().split("\n").length);
    tp.setVariantReadInInterval("chr7", 1000001, 1000001, true);
    System.err.println(tp.printToScreen());
    assertEquals(1, tp.printToScreen().trim().split("\n").length);
}
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