Search in sources :

Example 41 with GenomicCoords

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);
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 42 with GenomicCoords

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());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 43 with GenomicCoords

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();
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 44 with GenomicCoords

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"));
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 45 with GenomicCoords

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());
}
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