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


Java Feature.getEnd方法代码示例

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


在下文中一共展示了Feature.getEnd方法的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: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: computeGenomeCoverage

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
protected void computeGenomeCoverage() {
    int nBins = 1000;
    int[] starts = new int[nBins];
    int[] ends = new int[nBins];
    float[] values = new float[nBins];
    Arrays.fill(values, 0);

    Genome currentGenome = GenomeManager.getInstance().getCurrentGenome();
    double step = ((double) currentGenome.getNominalLength() / 1000) / nBins;
    for (int i = 0; i < nBins; i++) {
        starts[i] = (int) (i * step);
        ends[i] = (int) ((i + 1) * step);
    }


    for (String chr : currentGenome.getLongChromosomeNames()) {
        List<Feature> features = featureMap.get(chr);
        if (features != null) {
            long offset = currentGenome.getCumulativeOffset(chr);
            for (Feature f : features) {
                int genStart = (int) ((offset + f.getStart()) / 1000);
                int genEnd = (int) ((offset + f.getEnd()) / 1000);
                int binStart = (int) (genStart / step);
                int binEnd = (int) (genEnd / step);
                for (int i = binStart; i <= binEnd; i++) {
                    values[i] = values[i] + 1;
                }

            }
        }
    }

    coverageData.dataCache.put(Globals.CHR_ALL, new DataTile(starts, ends, values, null));
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:35,代码来源:FeatureCollectionSource.java

示例13: create

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
static DBFeature create(Feature feature){
    if(feature instanceof AbstractFeature){
        return create((AbstractFeature) feature);
    }
    return new DBFeature(feature.getChr(), feature.getStart(), feature.getEnd(), null, null, DEFAULT_COLOR);
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:7,代码来源:DBFeature.java

示例14: overlaps

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
public boolean overlaps(Feature anotherFeature) {

        return end >= anotherFeature.getStart() && start <= anotherFeature.getEnd() &&
                chromosome.equals(anotherFeature.getChr());

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

示例15: getFeatureEndForPacking

import htsjdk.tribble.Feature; //导入方法依赖的package包/类
/**
 * Some types of Features (splice junctions) should be packed on the same row even if start and end overlap.
 * This can be overridden in a subclass
 * @param feature
 * @return
 */
protected int getFeatureEndForPacking(Feature feature)
{
    return feature.getEnd();
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:11,代码来源:PackedFeatures.java


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