use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackIntervalFeatureTest method canReadFeaturesOfLengthOne.
@Test
public void canReadFeaturesOfLengthOne() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
GenomicCoords gc = new GenomicCoords("chr18:1-10000", 80, null, null);
TrackIntervalFeature tif = new TrackIntervalFeature("test_data/refSeqZero.bed", gc);
List<IntervalFeature> xset = tif.getFeaturesInInterval("chr1", 1, 100);
assertEquals(1, xset.size());
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackIntervalFeatureTest method canReadVCFTabix.
@Test
public void canReadVCFTabix() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
GenomicCoords gc = new GenomicCoords("chr18:1-10000", 80, null, null);
TrackIntervalFeature tif = new TrackIntervalFeature("test_data/CHD.exon.2010_03.sites.vcf.gz", gc);
List<IntervalFeature> xset = tif.getFeaturesInInterval("1", 1, 10000000);
assertEquals(9, xset.size());
IntervalFeature x = xset.get(1);
assertEquals("1", x.getChrom());
assertEquals(1108138, x.getFrom());
System.err.println(tif.printToScreen());
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackIntervalFeatureTest method canReadTabixVCFFromLocal.
@Test
public void canReadTabixVCFFromLocal() throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException {
String bgzFn = "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());
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackPileupTest method sameAsMpileup.
@Test
public void sameAsMpileup() throws ClassNotFoundException, IOException, InvalidGenomicCoordsException, InvalidRecordException, SQLException {
GenomicCoords gc = new GenomicCoords("chr7:5522059-5612125", 80, null, null);
TrackPileup tr = new TrackPileup("test_data/ear045.oxBS.actb.bam", gc);
// Pileup file created with:
// samtools mpileup -A -q 0 -Q 0 -x --ff 0 test_data/ear045.oxBS.actb.bam | cut -f 1-4 | gzip > test_data/ear045.oxBS.actb.pileup.gz
List<String> expList = this.gzipFileToList("test_data/ear045.oxBS.actb.pileup.gz");
// Positions are returned unsorted! We need to sort them first.
Map<Integer, Integer> depth = tr.getDepth(gc.getChrom(), gc.getFrom(), gc.getTo());
List<Integer> positions = new ArrayList<Integer>();
positions.addAll(depth.keySet());
Collections.sort(positions);
// mpileup and TrackPileup hit the same positions
assertEquals(expList.size(), depth.size());
// Same depth at same positions
int i = 0;
for (int obsPos : positions) {
int obsDepth = depth.get(obsPos);
int expPos = Integer.parseInt(Splitter.on("\t").splitToList(expList.get(i)).get(1));
int expDepth = Integer.parseInt(Splitter.on("\t").splitToList(expList.get(i)).get(3));
try {
assertEquals(expPos, obsPos);
assertEquals(expDepth, obsDepth);
} catch (AssertionError e) {
System.err.println("At iteration: " + i);
System.err.println(expList.get(i));
System.err.println("Observed depth: " + obsDepth);
throw e;
}
i++;
}
}
use of samTextViewer.GenomicCoords in project ASCIIGenome by dariober.
the class TrackPileupTest method canReloadTrack.
@Test
public void canReloadTrack() throws ClassNotFoundException, IOException, InvalidGenomicCoordsException, InvalidRecordException, SQLException {
GenomicCoords gc = new GenomicCoords("chr7:1-200", 80, null, null);
TrackPileup tr = new TrackPileup("test_data/pairs.sam", gc);
tr.reload();
}
Aggregations