当前位置: 首页>>代码示例>>Java>>正文


Java Feature.getStart方法代码示例

本文整理汇总了Java中htsjdk.tribble.Feature.getStart方法的典型用法代码示例。如果您正苦于以下问题:Java Feature.getStart方法的具体用法?Java Feature.getStart怎么用?Java Feature.getStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在htsjdk.tribble.Feature的用法示例。


在下文中一共展示了Feature.getStart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: query

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
@Override
public Iterator<Feature> query(String chr, int start, int end) throws IOException {

    // Tribble iterators must be closed, so we need to copy the features and insure closure before exiting.
    CloseableTribbleIterator<Feature> iter = null;
    try {
        iter = wrappedReader.query(chr, start, end);
        List<Feature> featureList = new ArrayList<Feature>();
        while (iter.hasNext()) {
            Feature f = iter.next();
            if (f.getStart() > end) {
                break;
            } else if (f.getEnd() < start) {
                continue;
            } else {
                featureList.add(f);
            }
        }
        return featureList.iterator();
    } finally {
        if(iter != null) iter.close();
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:24,代码来源:TribbleReaderWrapper.java

示例2: queryRaw

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
@Override
protected Iterator<Feature> queryRaw(String chr, int start, int end) throws IOException {

    // Tribble iterators must be closed, so we need to copy the features and insure closure before exiting.
    CloseableTribbleIterator<Feature> iter = null;
    try {
        iter = tribbleFeatureReader.query(chr, start, end);
        List<Feature> featureList = new ArrayList<Feature>();
        while (iter.hasNext()) {
            Feature f = iter.next();
            if (f.getStart() > end) {
                break;
            } else if (f.getEnd() < start) {
                continue;
            } else {
                featureList.add(f);
            }
        }
        return featureList.iterator();
    } finally {
        if (iter != null) iter.close();
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:24,代码来源:CachingFeatureReader.java

示例3: compare

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
public int compare(Feature feat1, Feature feat2) {

            // Prefer the shortest chromosome name.  Longer names are most likely "weird"
            // e.g.  chr1_gl000191_random
            int nameLen1 = feat1.getChr().length();
            int nameLen2 = feat2.getChr().length();
            if (nameLen1 != nameLen2) {
                return nameLen1 - nameLen2;
            }


            int len1 = (feat1.getEnd() - feat1.getStart());
            int len2 = (feat2.getEnd() - feat2.getStart());
            int toRet;
            if (!this.descending) {
                toRet = len1 - len2;
            } else {
                toRet = len2 - len1;
            }

            return toRet;

        }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:24,代码来源:FeatureDB.java

示例4: computeCoverage

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
private DataTile computeCoverage(String chr, int start, int end) {

            int nBins = (end - start) / windowSize + 1;
            int[] starts = new int[nBins];
            int[] ends = new int[nBins];
            for (int i = 0; i < nBins; i++) {
                starts[i] = start + i * windowSize;
                ends[i] = starts[i] + windowSize;
            }
            float[] values = new float[nBins];
            List<Feature> features = featureMap.get(chr);
            if (features != null) {
                for (Feature f : features) {
                    int startBin = f.getStart() / windowSize;
                    int endBin = f.getEnd() / windowSize;
                    for (int i = startBin; i < endBin; i++) {
                        values[i] = values[i] + 1;
                        dataMax = Math.max(dataMax, values[i]);
                    }
                }
            }
            return new DataTile(starts, ends, values, null);

        }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:25,代码来源:FeatureCollectionSource.java

示例5: processResult

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
@Override
public void processResult(Iterator<? extends Feature> searchResult) {
    ReferenceFrame frame = FrameManager.getDefaultFrame();
    Feature f = searchResult.next();

    String chr = GenomeManager.getInstance().getCurrentGenome().getCanonicalChrName(f.getChr());
    double newCenter = f.getStart();
    if (!chr.equals(frame.getChrName())) {
        // Switch chromosomes.  We have to do some tricks to maintain the same resolution scale.
        double range = frame.getEnd() - frame.getOrigin();
        int newOrigin = (int) Math.max(newCenter - range / 2, 0);
        int newEnd = (int) (newOrigin + range);
        frame.jumpTo(chr, newOrigin, newEnd);
    } else {
        frame.centerOnLocation(newCenter);
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:18,代码来源:FeatureSearcher.java

示例6: convertEnd

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
public static int convertEnd(Feature feature) {
	int end = feature.getEnd();
	if (end <= 0) {
		// If feature end cannot be determined (e.g. because a read is not
		// really aligned),
		// then treat this as a one base feature for indexing purposes.
		end = feature.getStart() + 1;
	}
	return end;
}
 
开发者ID:mulinlab,项目名称:vanno,代码行数:11,代码来源:BasicUtils.java

示例7: getVCInTrackerInLocus

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
protected List<VariantContext> getVCInTrackerInLocus(final RefMetaDataTracker tracker, final GenomeLoc loc){
    List<Feature> features = tracker.getValues(dbSNPBinding.getName());
    List<VariantContext> vcs = new ArrayList<>(features.size());
    for(Feature feature : features) {
        if(feature.getStart() == loc.getStart()) {
            vcs.add((VariantContext) ((GATKFeature.TribbleGATKFeature) feature).getUnderlyingObject());
        }
    }
    return vcs;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:11,代码来源:VariantOverlapAnnotator.java

示例8: checkSorted

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
public static void checkSorted(final File inputFile, final Feature lastFeature,
        final Feature currentFeature, Map<String, Feature> visitedChromos) {
    // if the last currentFeature is after the current currentFeature, exception out
    if (lastFeature != null && currentFeature.getStart() < lastFeature.getStart() && lastFeature
            .getContig().equals(currentFeature.getContig())) {
        throw new TribbleException.MalformedFeatureFile(
                "Input file is not sorted by start position. \n"
                        + "We saw a record with a start of " + currentFeature.getContig() + ":"
                        + currentFeature.getStart() + " after a record with a start of "
                        + lastFeature.getContig() + ":" + lastFeature.getStart(),
                inputFile.getAbsolutePath());
    }

    //should only visit chromosomes once
    final String curChr = currentFeature.getContig();
    final String lastChr = lastFeature != null ? lastFeature.getContig() : null;
    if (!curChr.equals(lastChr)) {
        if (visitedChromos.containsKey(curChr)) {
            String msg = "Input file must have contiguous chromosomes.";
            throw new TribbleException.MalformedFeatureFile(msg,
                    inputFile.getAbsolutePath());
        } else {
            visitedChromos.put(curChr, currentFeature);
        }
    }

}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:28,代码来源:IndexUtils.java

示例9: checkSorted

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
/**
 * Checks if two features of a FeatureFile are sorted
 * @param feature a current feature of a file to check
 * @param lastFeature a previous feature of a file to check
 * @param featureFile a file, thai is being checked
 */
public static void checkSorted(Feature feature, Feature lastFeature, FeatureFile featureFile) {
    if (feature.getStart() < lastFeature.getStart() && // Check if file is sorted
        lastFeature.getContig().equals(feature.getContig())) {
        throw new TribbleException.MalformedFeatureFile(
            "Input file is not sorted by start position. \n" +
            "We saw a record with a start of " + feature.getContig() + ":" +
            feature.getStart() + " after a record with a start of " +
            lastFeature.getContig() + ":" + lastFeature.getStart(), featureFile.getName());
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:17,代码来源:Utils.java

示例10: createTSSFile

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
/**
 * Create a bed file of "TSS regions", define as the 20 bp region downstream of the start of the feature.
 * <p/>
 * It is assume that iFile is sorted by start position.
 *
 * @param iFile
 * @param outputFile
 */
static void createTSSFile(String iFile, String outputFile) throws IOException {

    BufferedReader br = null;
    PrintWriter pw = null;

    try {
        br = new BufferedReader(new FileReader(iFile));
        pw = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
        FeatureParser parser = AbstractFeatureParser.getInstanceFor(new ResourceLocator(iFile), null);
        List<Feature> features = parser.loadFeatures(br, null);
        IGVBEDCodec codec = new IGVBEDCodec();


        Map<String, List<BasicFeature>> genes = new HashMap<String, List<BasicFeature>>();

        int lastTSS = -1;
        for (Feature f : features) {

            BasicFeature transcript = (BasicFeature) f;

            int tss = transcript.getStrand() == Strand.POSITIVE ? f.getStart() : f.getEnd();
            if (tss != lastTSS) {
                int tssEnd = transcript.getStrand() == Strand.POSITIVE ? tss + 20 : tss - 20;
                pw.println(transcript.getChr() + "\t" + Math.min(tss, tssEnd) + "\t" + Math.max(tss, tssEnd));
                lastTSS = tss;
            }


        }
    } finally {
        if (br != null) br.close();
        if (pw != null) pw.close();
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:43,代码来源:FeatureFileUtils.java

示例11: getOverlapPredicate

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
public static Predicate<Feature> getOverlapPredicate(final String chr, final int start, final int end) {
    Predicate<Feature> overlapPredicate = new Predicate<Feature>() {
        @Override
        public boolean apply(Feature object) {
            return chr.equals(object.getChr()) && object.getStart() <= end && object.getEnd() > start;
        }
    };
    return overlapPredicate;
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:10,代码来源:FeatureUtils.java

示例12: getAllFeaturesAt

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
/**
 * Return a feature from the supplied list at the given position.
 *
 * @param position
 * @param maxLength
 * @param features
 * @return
 */
public static List<Feature> getAllFeaturesAt(double position,
                                             double maxLength,
                                             double minWidth,
                                             List<? extends htsjdk.tribble.Feature> features) {

    List<Feature> returnList = null;

    double adjustedPosition = Math.max(0, position - maxLength);
    int startIdx = Math.max(0, getIndexBefore(adjustedPosition, features));
    for (int idx = startIdx; idx < features.size(); idx++) {
        Feature feature = features.get(idx);
        int start = feature.getStart() - (int) (minWidth / 2);

        if (start > position) {
            break;
        }

        int end = feature.getEnd() + (int) (minWidth / 2);

        if (position >= start && position <= end) {
            if (returnList == null) returnList = new ArrayList();
            returnList.add(feature);
        }
    }

    return returnList;
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:36,代码来源:FeatureUtils.java

示例13: compare

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
public int compare(Feature o1, Feature o2) {
    int genomeStart2 = o2.getStart();
    int genomeStart1 = o1.getEnd();
    if (genomeStart2 >= genomeStart1 && o2.getEnd() <= o1.getEnd()) {
        return 0;
    } else {
        return genomeStart1 - genomeStart2;
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:10,代码来源:FeatureUtils.java

示例14: getFeatureClosest

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
/**
 * Return the variant closest to the genomic position in the given reference frame, within the prescribed tolerance
 *
 * @param position
 * @param y           pixel position in panel coordinates (i.e. not track coordinates)
 * @param frameName
 * @param maxDistance
 * @return
 */
protected Variant getFeatureClosest(double position, int y, String frameName, double maxDistance) {

    PackedFeatures<IGVFeature> packedFeatures = packedFeaturesMap.get(frameName);

    if (packedFeatures == null) {
        return null;
    }

    Feature feature = null;
    List<IGVFeature> features;

    //We search only the specified row if y is a meaningful value.
    //Otherwise we search everything
    int row = ((y - top) / variantBandHeight);
    if (y < 0 || row >= getNumberOfFeatureLevels()) {
        features = packedFeatures.getFeatures();
    } else {
        features = packedFeatures.getRows().get(row).getFeatures();
    }

    if (features != null) {
        feature = FeatureUtils.getFeatureClosest(position, features);
    }
    if (feature == null ||
            ((position < feature.getStart() - maxDistance) || (position > feature.getEnd() + maxDistance))) {
        return null;
    } else {
        return (Variant) feature;
    }


}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:42,代码来源:VariantTrack.java

示例15: getLocus

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
/**
 * Return a locus from the gene (e.g. EGFR) or locus (e.g. chr1:1-100) string
 */
Locus getLocus(String geneOrLocusString) {
    Locus locus = Locus.fromString(geneOrLocusString);
    if (locus != null && locus.isValid()) {
        return locus;
    } else {
        // Maybe its a gene or feature
        Feature gene = FeatureDB.getFeature(geneOrLocusString);
        if (gene != null) {
            return new Locus(gene.getChr(), gene.getStart(), gene.getEnd());
        }
    }
    return null;
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:17,代码来源:GeneToLocusHelper.java


注:本文中的htsjdk.tribble.Feature.getStart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。