当前位置: 首页>>代码示例>>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;未经允许,请勿转载。