Search in sources :

Example 6 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method nextCanMoveToStartOfChrom.

@Test
public /**
 * This should address issues #50 where a feature starting at the begining
 * of the chrom is ignored
 */
void nextCanMoveToStartOfChrom() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
    GenomicCoords gc = new GenomicCoords("chr1:2000-3000", 80, null, null);
    String intervalFileName = "test_data/refSeqZero.bed";
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    GenomicCoords newGc = tif.coordsOfNextFeature(gc, false);
    // MEMO: Start of chrom is 0 in bed format but 1 in ASCIIGenome format
    assertEquals(1, (int) newGc.getFrom());
    // Backwards
    gc = new GenomicCoords("chr1:500-1000", 80, null, null);
    tif = new TrackIntervalFeature(intervalFileName, gc);
    newGc = tif.coordsOfNextFeature(gc, true);
    assertEquals(1, (int) newGc.getFrom());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 7 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canPrintRawLines.

@Test
public void canPrintRawLines() throws ClassNotFoundException, IOException, InvalidGenomicCoordsException, InvalidRecordException, SQLException, InvalidColourException, InvalidConfigException, InvalidCommandLineException {
    GenomicCoords gc = new GenomicCoords("chr1:1-40000", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature("test_data/hg19_genes_head.gtf", gc);
    tif.setPrintMode(PrintRawLine.CLIP);
    tif.setPrintRawLineCount(-1);
    assertEquals(20, tif.printLines().split("\n").length);
    tif.setPrintRawLineCount(5);
    // +1 for the string of omitted count.
    assertEquals(5 + 1, tif.printLines().split("\n").length);
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 8 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canPrintChromsomeNames.

@Test
public void canPrintChromsomeNames() throws ClassNotFoundException, IOException, InvalidGenomicCoordsException, InvalidRecordException, SQLException {
    String intervalFileName = "test_data/hg19_genes.gtf.gz";
    GenomicCoords gc = new GenomicCoords("7:5527151-5530709", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    assertTrue(tif.getChromosomeNames().size() > 10);
    tif = new TrackIntervalFeature("test_data/wgEncodeDukeDnase8988T.fdr01peaks.hg19.bb", gc);
    assertTrue(tif.getChromosomeNames().size() > 10);
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 9 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canReadBgzFileExtension.

@Test
public void canReadBgzFileExtension() throws ClassNotFoundException, IOException, InvalidGenomicCoordsException, InvalidRecordException, SQLException {
    GenomicCoords gc = new GenomicCoords("1:1-200000000", 80, null, null);
    // .bgz, without index
    String intervalFileName = "test_data/bgz_noindex.vcf.bgz";
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    assertTrue(tif.getIntervalFeatureList().size() > 0);
    // .bgz, with index
    intervalFileName = "test_data/bgz_index.vcf.bgz";
    tif = new TrackIntervalFeature(intervalFileName, gc);
    assertTrue(tif.getFeaturesInInterval("1", 1, 200000000).size() > 0);
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 10 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canAddNameToGTFTranscript.

@Test
public void canAddNameToGTFTranscript() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException, InvalidConfigException {
    String intervalFileName = "test_data/hg19_genes_head.gtf.gz";
    GenomicCoords gc = new GenomicCoords("chr1:11874-20000", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    tif.setNoFormat(true);
    assertTrue(tif.printToScreen().contains("NR_046018"));
}
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