Search in sources :

Example 21 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canShowHideFeatureByRegexFilters.

@Test
public void canShowHideFeatureByRegexFilters() throws InvalidGenomicCoordsException, IOException, ClassNotFoundException, InvalidRecordException, SQLException {
    String intervalFileName = "test_data/hg19_genes_head.gtf.gz";
    GenomicCoords gc = new GenomicCoords("chr1:10000-100000", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    tif.setNoFormat(true);
    tif.setShowHideRegex(Pattern.compile(Filter.DEFAULT_SHOW_REGEX.getValue()), Pattern.compile("\texon\t"));
    assertEquals(3, tif.getIntervalFeatureList().size());
    tif.setShowHideRegex(Pattern.compile("WASH7P"), Pattern.compile("^$"));
    assertTrue(tif.getIntervalFeatureList().size() == 11);
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 22 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canShowAndHide_findNextRegex.

@Test
public void canShowAndHide_findNextRegex() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
    GenomicCoords gc = new GenomicCoords("chr1:1", 80, null, null);
    String intervalFileName = "test_data/hg19_genes_head.gtf.gz";
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    tif.setShowHideRegex(Pattern.compile(".*exon.*"), Pattern.compile(".*DDX11L1.*"));
    GenomicCoords curr = tif.findNextMatch(gc, Pattern.compile(".*gene_id.*"));
    assertEquals(14362, (int) curr.getFrom());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 23 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canChangeFeatureName2.

@Test
public void canChangeFeatureName2() throws Exception {
    // GFF with features that are not transcript (e.g. "chromosome")
    String intervalFileName = "test_data/Homo_sapiens.GRCh38.86.chromosome.7.gff3.gz";
    GenomicCoords gc = new GenomicCoords("7:1-1000", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature(intervalFileName, gc);
    tif.setNoFormat(true);
    assertTrue(tif.printToScreen().contains("chromosome:7"));
    tif.setGtfAttributeForName("Alias");
    System.err.println(tif.printToScreen());
    assertTrue(tif.printToScreen().contains("CM000669"));
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 24 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canReadFromHTTP.

@Test
public void canReadFromHTTP() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
    GenomicCoords gc = new GenomicCoords("chr1:1-1000", 80, null, null);
    TrackIntervalFeature tif = new TrackIntervalFeature("https://raw.githubusercontent.com/dariober/ASCIIGenome/master/test_data/refSeq.bed", gc);
    assertEquals("http", tif.getFilename().substring(0, 4));
    assertEquals(2, tif.getIntervalFeatureList().size());
}
Also used : GenomicCoords(samTextViewer.GenomicCoords) Test(org.junit.Test)

Example 25 with GenomicCoords

use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.

the class TrackIntervalFeatureTest method canReadTabixVCFFromHTTP.

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