本文整理匯總了Java中net.sf.picard.util.IntervalList類的典型用法代碼示例。如果您正苦於以下問題:Java IntervalList類的具體用法?Java IntervalList怎麽用?Java IntervalList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IntervalList類屬於net.sf.picard.util包,在下文中一共展示了IntervalList類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getReadsForSite
import net.sf.picard.util.IntervalList; //導入依賴的package包/類
public List<SequenceRead> getReadsForSite(Site site) {
SAMFileReader samFileReader = new SAMFileReader(new File(bamPath));
Interval interval = new Interval(site.getChr(), site.getStart(), site.getEnd());
IntervalList intervalList = new IntervalList(samFileReader.getFileHeader());
intervalList.add(interval);
SamLocusIterator samLocusIterator = new SamLocusIterator(samFileReader, intervalList, true);
List<SequenceRead> siteList = new ArrayList<SequenceRead>();
for (SamLocusIterator.LocusInfo locusInfo : samLocusIterator) {
List<SamLocusIterator.RecordAndOffset> list = locusInfo.getRecordAndPositions();
for (SamLocusIterator.RecordAndOffset recordAndOffset : list) {
siteList.add(new SequenceRead(recordAndOffset.getRecord()));
}
}
samLocusIterator.close();
samFileReader.close();
return siteList;
}
示例2: run
import net.sf.picard.util.IntervalList; //導入依賴的package包/類
@Override
public void run() {
IoUtil.assertFileIsReadable(coordsFile);
IoUtil.assertFileIsReadable(referenceSequence);
IoUtil.assertFileIsWritable(outFile);
final ReferenceSequenceFile ref = ReferenceSequenceFileFactory
.getReferenceSequenceFile(referenceSequence);
final SAMFileHeader header = new SAMFileHeader();
header.setSequenceDictionary(ref.getSequenceDictionary());
final IntervalList intervalList = new IntervalList(header);
Iterator<Interval> iter = new CoordsDups(coordsFile);
while(iter.hasNext()){
intervalList.add(iter.next());
}
CloserUtil.close(iter);
intervalList.unique();
intervalList.write(outFile);
}
示例3: run
import net.sf.picard.util.IntervalList; //導入依賴的package包/類
@Override
public void run() {
final ReferenceSequenceFile ref = ReferenceSequenceFileFactory
.getReferenceSequenceFile(referenceSequence);
final SAMFileHeader header = new SAMFileHeader();
header.setSequenceDictionary(ref.getSequenceDictionary());
final IntervalList intervalList = new IntervalList(header);
Iterator<Interval> iter = new CoordsCoverage(coordsFile, referenceSequence);
while(iter.hasNext()){
intervalList.add(iter.next());
}
CloserUtil.close(iter);
intervalList.unique();
intervalList.write(outFile);
}
示例4: createSamLocusIterator
import net.sf.picard.util.IntervalList; //導入依賴的package包/類
private static SamLocusIterator createSamLocusIterator(
SAMFileReader reader,
IntervalList site, List<SamRecordFilter> filters) {
SamLocusIterator iterator;
iterator = new SamLocusIterator(reader, site, true);
iterator.setSamFilters(filters);
iterator.setEmitUncoveredLoci(false);
return iterator;
}
示例5: getDepth
import net.sf.picard.util.IntervalList; //導入依賴的package包/類
public List<Site> getDepth(String chr, int startPosition, int endPosition) {
SAMFileReader samFileReader = new SAMFileReader(new File(bamPath));
Interval interval = new Interval(chr, startPosition, endPosition);
IntervalList intervalList = new IntervalList(samFileReader.getFileHeader());
intervalList.add(interval);
SamLocusIterator samLocusIterator = new SamLocusIterator(samFileReader, intervalList, true);
List<Site> siteList = new ArrayList<Site>();
for (SamLocusIterator.LocusInfo locusInfo : samLocusIterator) {
siteList.add(new Site(locusInfo.getSequenceName(), locusInfo.getPosition(), locusInfo.getRecordAndPositions().size()));
}
samLocusIterator.close();
samFileReader.close();
return siteList;
}
示例6: createFromIntervalListFile
import net.sf.picard.util.IntervalList; //導入依賴的package包/類
public static MarkDuplicates createFromIntervalListFile(File f){
IntervalList list = IntervalList.fromFile(f);
OverlapDetector<Interval> overlapDetector = new OverlapDetector<Interval>(0,0);
for(Interval i: list.getUniqueIntervals()){
overlapDetector.addLhs(null, i);
}
return new MarkDuplicates(overlapDetector);
}
示例7: createFromIntervalList
import net.sf.picard.util.IntervalList; //導入依賴的package包/類
public static LociStateCaller createFromIntervalList(File f) throws IOException {
final IntervalList intervalList = IntervalList.fromFile(f);
final OverlapDetector<CalledState> overlapDetector = new OverlapDetector<CalledState>(0, 0);
for(final Interval interval: intervalList.getIntervals()){
overlapDetector.addLhs(CalledState.CALLABLE, interval);
}
return new LociStateCallerImpl(overlapDetector, CalledState.NO_COVERAGE);
}
示例8: doWork
import net.sf.picard.util.IntervalList; //導入依賴的package包/類
@Override
protected int doWork() {
// read in self coords file and create overlap detector
// process coords and query overlap detector using query coord
// if overlaps are found, grab overlapping region from reference coord
// add coord to interval list
// make interval list unique
IoUtil.assertFileIsReadable(SELF_COORDS);
IoUtil.assertFileIsReadable(REF_COORDS);
IoUtil.assertFileIsReadable(REFERENCE_SEQUENCE);
IoUtil.assertFileIsWritable(OUTPUT);
final ReferenceSequenceFile ref = ReferenceSequenceFileFactory.getReferenceSequenceFile(REFERENCE_SEQUENCE);
assertDictionaryExists(ref);
assertFastaIsIndexed(ref);
final SAMFileHeader header = new SAMFileHeader();
header.setSequenceDictionary(ref.getSequenceDictionary());
final IntervalList intervalList = new IntervalList(header);
OverlapDetector<Interval> overlapDetector = new OverlapDetector<Interval>(0, 0);
{
Iterator<Interval> coordsDupsIter = new CoordsDups(SELF_COORDS);
while (coordsDupsIter.hasNext()) {
Interval interval = coordsDupsIter.next();
overlapDetector.addLhs(interval, interval);
}
}
Iterator<CoordsRecord> coordsIter = new CoordsRecordIterator(REF_COORDS);
int refIndex = -1;
int queryIndex = -1;
//create overlap detector
while (coordsIter.hasNext()) {
CoordsRecord coord = coordsIter.next();
if (refIndex == -1) {
refIndex = determineReferenceCoordIndex(coord, ref.getSequenceDictionary());
queryIndex = refIndex == 1 ? 0 : 1;
}
final Interval refCoord = toInterval(coord.getCoord(refIndex));
final Interval qryCoord = toInterval(coord.getCoord(queryIndex));
if (refCoord.isNegativeStrand() && qryCoord.isNegativeStrand()) {
throw new IllegalStateException("Ref and Qry coords are both reversed");
}
final Collection<Interval> overlaps = overlapDetector.getOverlaps(qryCoord);
for (Interval overlap : overlaps) {
intervalList.add(translate(overlap, qryCoord, refCoord));
}
}
intervalList.unique();
intervalList.sort();
intervalList.write(OUTPUT);
return 0;
}