Search in sources :

Example 16 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canStackFeaturesInOneLine.

@Test
public void canStackFeaturesInOneLine() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
    String intervalFileName = "test_data/overlapped.bed";
    GenomicCoords gc = new GenomicCoords("chr1:1-70", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    tif.setNoFormat(true);
    tif.setFeatureDisplayMode(FeatureDisplayMode.ONELINE);
    String exp = ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>          <<<<<<<<<<";
    assertEquals(exp, tif.printToScreen().trim());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 17 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canHandleGFFWithoutSupeFeatures.

@Test
public void canHandleGFFWithoutSupeFeatures() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException, InvalidColourException, InvalidConfigException {
    // We have a GFF with only exons. Since there are no "transcripts", there is nothing to group by.
    // See also issue #74.
    GenomicCoords gc = new GenomicCoords("chr1:11800-20000", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature("test_data/issue74.gff3.gz", gc);
    tif.setNoFormat(true);
    assertEquals(10, tif.intervalFeatureList.size());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 18 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canAddNameToGFFTranscript.

@Test
public void canAddNameToGFFTranscript() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException, InvalidConfigException {
    String intervalFileName = "test_data/Homo_sapiens.GRCh38.86.ENST00000331789.gff3";
    GenomicCoords gc = new GenomicCoords("7:5527151-5530709", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    tif.setNoFormat(true);
    assertTrue(tif.printToScreen().contains("ACTB-001"));
    tif.setNoFormat(false);
    assertTrue(tif.printToScreen().trim().startsWith("["));
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 19 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canColorGTFFeaturesByRegex.

@Test
public void canColorGTFFeaturesByRegex() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException, InvalidColourException {
    GenomicCoords gc = new GenomicCoords("chr1:1-100000", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature("test_data/hg19_genes_head.gtf", gc);
    // This is to populate the ideograms.
    tif.printToScreen();
    List<Argument> colorForRegex = new ArrayList<Argument>();
    colorForRegex.add(new Argument("DDX11L1", "216", false));
    tif.setColorForRegex(colorForRegex);
    assertTrue(tif.printToScreen().contains("216"));
    colorForRegex.clear();
    // 233:grey7 (almost black)
    colorForRegex.add(new Argument("WASH7P", "233", false));
    tif.setColorForRegex(colorForRegex);
    assertTrue(tif.printToScreen().contains("233"));
    assertTrue(tif.printToScreen().contains("216"));
    // Foreground color
    assertTrue(tif.printToScreen().contains("253"));
    // Reset default
    tif.setColorForRegex(null);
    assertTrue(!tif.printToScreen().contains("216"));
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 20 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canReadUnsortedVCFFromHTTP.

@Test
public void canReadUnsortedVCFFromHTTP() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
    GenomicCoords gc = new GenomicCoords("1:1-1142000", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature("https://raw.githubusercontent.com/dariober/ASCIIGenome/master/test_data/CHD.exon.2010_03.sites.unsorted.vcf", gc);
    assertEquals("http", tif.getFilename().substring(0, 4));
    assertEquals(3, tif.getIntervalFeatureList().size());
}
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