當前位置: 首頁>>代碼示例>>Java>>正文


Java IntervalList類代碼示例

本文整理匯總了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;
}
 
開發者ID:REDetector,項目名稱:RED,代碼行數:18,代碼來源:BamFileParser.java

示例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);
}
 
開發者ID:TGenNorth,項目名稱:ISGPipeline,代碼行數:24,代碼來源:CoordsDupsInProcessFunction.java

示例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);
}
 
開發者ID:TGenNorth,項目名稱:ISGPipeline,代碼行數:19,代碼來源:CoordsCoverageInProcessFunction.java

示例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;
}
 
開發者ID:sing-group,項目名稱:bicycle,代碼行數:13,代碼來源:Tools.java

示例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;
}
 
開發者ID:REDetector,項目名稱:RED,代碼行數:15,代碼來源:BamFileParser.java

示例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);
}
 
開發者ID:TGenNorth,項目名稱:ISGPipeline,代碼行數:9,代碼來源:MarkDuplicates.java

示例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);
}
 
開發者ID:TGenNorth,項目名稱:ISGPipeline,代碼行數:9,代碼來源:LociStateCallerFactory.java

示例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;
}
 
開發者ID:TGenNorth,項目名稱:ISGPipeline,代碼行數:62,代碼來源:FindParalogs.java


注:本文中的net.sf.picard.util.IntervalList類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。