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


Java Genome类代码示例

本文整理汇总了Java中org.broad.igv.feature.genome.Genome的典型用法代码示例。如果您正苦于以下问题:Java Genome类的具体用法?Java Genome怎么用?Java Genome使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: calcSequence

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
public void calcSequence(Genome genome) {
    if (!this.isGenomePositionsSet()) {
        throw new IllegalStateException("Must set genome positions first");
    }
    int[] positions = this.getGenomePositions();
    String aas = "";
    for (int start : positions) {
        final byte[] nucSequence = genome.getSequence(chr, start, start + 1);
        if (nucSequence == null) {
            // No sequence.
        } else {
            aas += new String(nucSequence);
        }
    }

    if (strand == Strand.NEGATIVE) {
        aas = AminoAcidManager.getNucleotideComplement(aas);
    }

    this.sequence = aas;
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:22,代码来源:Codon.java

示例2: UCSCGeneTableCodec

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
public UCSCGeneTableCodec(Type type, Genome genome) {
    super(BasicFeature.class);

    this.genome = genome;
    this.type = type;
    switch (type) {
        case REFFLAT:
            break;
        case UCSCGENE:
            idColumn = 0;
            chrColumn = 1;
            strandColumn = 2;
            startColumn = 3;
            endColumn = 4;
            cdStartColumn = 5;
            cdEndColumn = 6;
            exonCountColumn = 7;
            startsBufferColumn = 8;
            endsBufferColumn = 9;
            nameColumn = 10;
            break;
        case GENEPRED:
            nameColumn = 12;
    }

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

示例3: doGCTtoIGV

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
private void doGCTtoIGV(String typeString, String ifile, File ofile, String probefile, int maxRecords, String tmpDirName, Genome genome) throws IOException {

        userMessageWriter.println("gct -> igv: " + ifile + " -> " + ofile.getAbsolutePath());

        File tmpDir = null;
        if (tmpDirName != null && tmpDirName.trim().length() > 0) {
            tmpDir = new File(tmpDirName);
            if (!tmpDir.exists()) {
                throw new PreprocessingException("Error: tmp directory: " + tmpDir.getAbsolutePath() + " does not exist.");
            }
        }

        ResourceLocator locator = new ResourceLocator(ifile);
        locator.setType(typeString);
        GCTtoIGVConverter.convert(locator, ofile, probefile, maxRecords, tmpDir, genome);

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

示例4: addFeature

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
public static void addFeature(NamedFeature feature, Genome genome) {

        final String name = feature.getName();
        if (name != null && name.length() > 0 && !name.equals(".")) {
            put(name, feature, genome);
        }
        if (feature instanceof IGVFeature) {
            final IGVFeature igvFeature = (IGVFeature) feature;
            final String id = igvFeature.getIdentifier();
            if (id != null && id.length() > 0) {
                put(id, feature, genome);
            }

            addByAttributes(igvFeature, genome);

            List<Exon> exons = igvFeature.getExons();
            if (exons != null) {
                for (Exon exon : exons) {
                    addByAttributes(exon, genome);
                }
            }
        }
    }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:24,代码来源:FeatureDB.java

示例5: loadSequenceNames

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
/**
 * Return the merged list of all sequence names, maintaining order.
 *
 * @return
 */
public void loadSequenceNames() throws IOException {
    // Use a set for quick comparison
    LinkedHashSet<String> names = new LinkedHashSet<String>(50);
    for (AlignmentReader reader : readers) {
        names.addAll(reader.getSequenceNames());
    }
    sequenceNames = new ArrayList<String>(names);

    Genome genome = GenomeManager.getInstance().getCurrentGenome();
    chrNameIndex = new HashMap<String, Integer>(sequenceNames.size());
    for (int i = 0; i < sequenceNames.size(); i++) {
        final String seqName = sequenceNames.get(i);
        String chr = genome == null ? seqName : genome.getCanonicalChrName(seqName);
        chrNameIndex.put(chr, i);
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:22,代码来源:MergedAlignmentReader.java

示例6: CoverageTrack

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
public CoverageTrack(ResourceLocator locator, String name, AlignmentTrack alignmentTrack, Genome genome) {
    super(locator, locator.getPath() + "_coverage", name);
    super.setDataRange(new DataRange(0, 0, 60));
    this.alignmentTrack = alignmentTrack;
    this.genome = genome;
    intervalRenderer = new IntervalRenderer();
    setMaximumHeight(40);

    setColor(coverageGrey);

    prefs = PreferenceManager.getInstance();
    snpThreshold = prefs.getAsFloat(PreferenceManager.SAM_ALLELE_THRESHOLD);
    autoScale = DEFAULT_AUTOSCALE;
    showReference = DEFAULT_SHOW_REFERENCE;
    //TODO  logScale = prefs.


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

示例7: DatasetDataSource

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
/**
 *
 * @param trackId
 * @param dataset
 * @param genome
 */
public DatasetDataSource(String trackId, Dataset dataset, Genome genome) {
    super(genome);
    this.trackId = trackId;
    this.dataset = dataset;

    // TODO -- remove this "instanceof" hack
    if (genome.getHomeChromosome().equals(Globals.CHR_ALL)) {
        if (dataset instanceof IGVDataset) {
            genomeSummaryData = ((IGVDataset) dataset).getGenomeSummary();
        } else {
            genomeSummaryData = new GenomeSummaryData(genome, new String[]{trackId});
            for (Chromosome chr : genome.getChromosomes()) {
                int[] startLocations = dataset.getStartLocations(chr.getName());
                if (!chr.getName().equals(Globals.CHR_ALL) && (startLocations != null) && (startLocations.length > 0)) {
                    Map<String, float[]> dMap = new HashMap<String, float[]>();
                    dMap.put(trackId, dataset.getData(trackId, chr.getName()));
                    genomeSummaryData.addData(chr.getName(), startLocations, dMap);
                }
            }
        }
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:29,代码来源:DatasetDataSource.java

示例8: CoverageCounter

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
/**
 * @param alignmentFile - path to the file to count
 * @param consumer      - the data consumer, in this case a TDF preprocessor
 * @param windowSize    - window size in bp, counts are performed over this window
 * @param extFactor     - the extension factor, read is artificially extended by this amount
 * @param wigFile       - path to the wig file (optional)
 * @param genome        - the Genome,  used to size chromosomes
 * @param queryString   - Locus query string, such as 1:1-1000. Only count the queried region. Set to null for entire genome
 * @param minMapQual    - Minimum mapping quality to include
 * @param countFlags    - Combination of flags for BASES, STRAND_SEPARATE, INCLUDE_DUPES, FIRST_IN_PAIR
 */
public CoverageCounter(String alignmentFile,
                       DataConsumer consumer,
                       int windowSize,
                       int extFactor,
                       File wigFile,
                       Genome genome,
                       String queryString,
                       int minMapQual,
                       int countFlags) {
    this.alignmentFile = alignmentFile;
    this.consumer = consumer;
    this.windowSize = windowSize;
    this.extFactor = extFactor;
    this.wigFile = wigFile;
    this.genome = genome;

    parseOptions(queryString, minMapQual, countFlags);

    //Count the number of output columns. 1 or 2 if not outputting bases
    //5 or 10 if are.
    int multiplier = outputBases ? nucleotides.length : 1;
    int datacols = (outputSeparate ? 2 : 1) * multiplier;

    buffer = new float[datacols];
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:37,代码来源:CoverageCounter.java

示例9: CufflinksDataSource

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
public CufflinksDataSource(List<? extends LocusScore> valueList, Genome genome) {

        chrAliasMap = new HashMap<String, String>();
        values = new HashMap<String, List<LocusScore>>();

        DownsampledDoubleArrayList sampledData = sampleValues(valueList, genome);

        // Sort
        for (List<LocusScore> chrValues : values.values()) {
            FeatureUtils.sortFeatureList(chrValues);
        }

        double[] sd = sampledData.toArray();
        if (sd.length > 0) {
            dataMin = Math.min(0, StatUtils.percentile(sd, 5));
            dataMax = StatUtils.percentile(sd, 95);
        } else {
            dataMin = 0;
            dataMax = 100;
        }

        calculateWholeGenomeScores(genome);
    }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:24,代码来源:CufflinksDataSource.java

示例10: sampleValues

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
/**
 * Sample the first 10,000 values to set scale
 * Also separate data into chromosomes
 * @param valueList
 * @param genome
 */
private DownsampledDoubleArrayList sampleValues(List<? extends LocusScore> valueList, Genome genome){
    DownsampledDoubleArrayList sampledData = new DownsampledDoubleArrayList(5000, 10000);
    for (LocusScore val : valueList) {
        String chr = val.getChr();

        List<LocusScore> chrValues = values.get(chr);
        if (chrValues == null) {
            chrValues = new ArrayList<LocusScore>();
            values.put(chr, chrValues);
            if (genome != null) {
                String alias = genome.getCanonicalChrName(chr);
                chrAliasMap.put(alias, chr);
            }


        }
        sampledData.add(val.getScore());
        chrValues.add(val);
    }
    return sampledData;
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:28,代码来源:CufflinksDataSource.java

示例11: init

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
private void init(String path, Genome genome) throws IOException {

        featureSourceMap = Collections.synchronizedMap(new HashMap());
        pathMap = new HashMap<String, String>();
        BufferedReader reader = null;

        try {
            reader = ParsingUtils.openBufferedReader(path);
            String nextLine;
            while ((nextLine = reader.readLine()) != null) {
                String f = nextLine.trim();
                if (!f.startsWith("#")) {
                    String[] tokens = Globals.whitespacePattern.split(nextLine);
                    if (tokens.length > 1)
                        pathMap.put(tokens[0], tokens[1]);
                }
            }
        } finally {
            if (reader != null) reader.close();
        }
    }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:22,代码来源:TribbleListFeatureSource.java

示例12: getChromosomeLength

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
private static int getChromosomeLength(String chrName) {
    Genome genome = getGenome();

    if (genome == null) {
        return 1;
    }

    if (chrName.equals("All")) {
        // TODO -- remove the hardcoded unit divider ("1000")
        return (int) (genome.getNominalLength() / 1000);
    } else {
        Chromosome chromosome = genome.getChromosome(chrName);
        if (chromosome == null) {
            log.error("Null chromosome: " + chrName);
            if (genome.getChromosomes().size() == 0) {
                return 1;
            } else {
                return genome.getChromosomes().iterator().next().getLength();
            }
        }
        return chromosome.getLength();
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:24,代码来源:ReferenceFrame.java

示例13: IndexedFeatureSource

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
private IndexedFeatureSource(AbstractFeatureReader basicReader, FeatureCodec codec, ResourceLocator locator,
                             Genome genome, boolean useCache) throws IOException {
    super(locator, basicReader, codec, genome, useCache);


    if (genome != null) {
        Collection<String> seqNames = reader.getSequenceNames();
        if (seqNames != null) {
            for (String seqName : seqNames) {
                String igvChr = genome.getCanonicalChrName(seqName);
                if (igvChr != null && !igvChr.equals(seqName)) {
                    chrNameMap.put(igvChr, seqName);
                }
            }
        }
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:18,代码来源:TribbleFeatureSource.java

示例14: Preprocessor

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
public Preprocessor(File outputFile,
                    Genome genome,
                    Collection<WindowFunction> windowFunctions,
                    int sizeEstimate,
                    StatusMonitor monitor) {

    this.outputFile = outputFile;
    this.genome = genome;
    this.windowFunctions = windowFunctions;
    this.sizeEstimate = sizeEstimate;
    this.genome = genome;
    this.statusMonitor = monitor;

    allDataStats = new ListAccumulator(allDataFunctions);
    if (statusMonitor == null) {
        PrintStream monStream = this.outputFile == null ? System.err : System.out;
        statusMonitor = new CommandLineStatusMonitor(monStream);
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:20,代码来源:Preprocessor.java

示例15: computeLocationScale

import org.broad.igv.feature.genome.Genome; //导入依赖的package包/类
/**
 * Recalculate the locationScale, based on {@link #initialLocus}, {@link #origin}, and
 * {@link #widthInPixels}
 * DOES NOT alter zoom value
 */
protected synchronized void computeLocationScale() {
    Genome genome = getGenome();

    //Should consider getting rid of this. We don't have
    //a chromosome length without a genome, not always a problem
    if (genome != null) {

        // The end location, in base pairs.
        // If negative, we use the whole chromosome
        int setEnd = -1;
        if (this.initialLocus != null) setEnd = this.initialLocus.getEnd();

        if (setEnd > 0 && widthInPixels > 0) {
            this.locationScale = ((setEnd - origin) / widthInPixels);
            this.initialLocus = null;
        } else {
            double virtualPixelSize = getTilesTimesBinsPerTile();
            double nPixel = Math.max(virtualPixelSize, widthInPixels);
            this.locationScale = (((double) getChromosomeLength()) / nPixel);
        }
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:28,代码来源:ReferenceFrame.java


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