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