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


Java BucketUtils.fileSize方法代碼示例

本文整理匯總了Java中org.broadinstitute.hellbender.utils.gcs.BucketUtils.fileSize方法的典型用法代碼示例。如果您正苦於以下問題:Java BucketUtils.fileSize方法的具體用法?Java BucketUtils.fileSize怎麽用?Java BucketUtils.fileSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.broadinstitute.hellbender.utils.gcs.BucketUtils的用法示例。


在下文中一共展示了BucketUtils.fileSize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processFasta

import org.broadinstitute.hellbender.utils.gcs.BucketUtils; //導入方法依賴的package包/類
@VisibleForTesting static List<SVKmer> processFasta( final int kSize,
                                                     final int maxDUSTScore,
                                                     final String fastaFilename) {
    try ( BufferedReader rdr = new BufferedReader(new InputStreamReader(BucketUtils.openFile(fastaFilename))) ) {
        final List<SVKmer> kmers = new ArrayList<>((int) BucketUtils.fileSize(fastaFilename));
        String line;
        final StringBuilder sb = new StringBuilder();
        final SVKmer kmerSeed = new SVKmerLong();
        while ( (line = rdr.readLine()) != null ) {
            if ( line.charAt(0) != '>' ) sb.append(line);
            else if ( sb.length() > 0 ) {
                SVDUSTFilteredKmerizer.canonicalStream(sb,kSize,maxDUSTScore,kmerSeed).forEach(kmers::add);
                sb.setLength(0);
            }
        }
        if ( sb.length() > 0 ) {
            SVDUSTFilteredKmerizer.canonicalStream(sb,kSize,maxDUSTScore,kmerSeed).forEach(kmers::add);
        }
        return kmers;
    }
    catch ( IOException ioe ) {
        throw new GATKException("Can't read high copy kmers fasta file "+fastaFilename, ioe);
    }
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:25,代碼來源:FindBadGenomicKmersSpark.java

示例2: readKmersFile

import org.broadinstitute.hellbender.utils.gcs.BucketUtils; //導入方法依賴的package包/類
/**
 * Read a file of kmers.
 * Each line must be exactly
 * {@link org.broadinstitute.hellbender.tools.spark.sv.StructuralVariationDiscoveryArgumentCollection.FindBreakpointEvidenceSparkArgumentCollection#KMER_SIZE}
 * characters long, and must match [ACGT]*.
 */
public static Set<SVKmer> readKmersFile(final String kmersFilePath, final int kSize) {
    Utils.nonNull(kmersFilePath, "provided path for file containing kmers is null");
    Utils.validateArg(kSize > 0, "provided k-size is non positive: " + kSize);

    final Set<SVKmer> kmers;

    try ( final BufferedReader rdr =
                  new BufferedReader(new InputStreamReader(BucketUtils.openFile(kmersFilePath))) ) {
        final long fileLength = BucketUtils.fileSize(kmersFilePath);
        kmers = new HopscotchSet<>((int)(fileLength/(kSize+1)));
        String line;
        while ( (line = rdr.readLine()) != null ) {
            if ( line.length() != kSize ) {
                throw new GATKException("SVKmer kill set contains a line of length " + line.length() +
                        " but we were expecting K = " + kSize);
            }

            final SVKmerizer kmerizer = new SVKmerizer(line, kSize, 1, new SVKmerLong(kSize));
            if ( !kmerizer.hasNext() ) {
                throw new GATKException("Unable to kmerize the kmer kill set string '" + line + "'.");
            }

            kmers.add(kmerizer.next());
        }
    }
    catch ( final IOException ioe ) {
        throw new GATKException("Unable to read kmers from " + kmersFilePath, ioe);
    }

    return kmers;
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:38,代碼來源:SVFileUtils.java

示例3: readIntervalsFile

import org.broadinstitute.hellbender.utils.gcs.BucketUtils; //導入方法依賴的package包/類
/** Read intervals from file. */
public static List<SVInterval> readIntervalsFile(final String intervalsFilePath,
                                                 final Map<String, Integer> contigNameMap ) {
    Utils.nonNull(intervalsFilePath, "provided intervals file path is null");
    Utils.nonNull(contigNameMap, "provided map for contig index lookup is null");

    final List<SVInterval> intervals;
    try ( final BufferedReader rdr =
                  new BufferedReader(new InputStreamReader(BucketUtils.openFile(intervalsFilePath))) ) {
        final long sizeGuess = BucketUtils.fileSize(intervalsFilePath)/25; // 25 is a guess on file line length
        intervals = new ArrayList<>((int)sizeGuess);
        String line;
        int lineNo = 0;
        while ( (line = rdr.readLine()) != null ) {
            ++lineNo;
            if (line.startsWith(REFERENCE_GAP_INTERVAL_FILE_COMMENT_LINE_PROMPT)) {
                continue;
            }
            final String[] tokens = line.split("\t");
            if ( tokens.length != 3 ) {
                throw new GATKException("Interval file " + intervalsFilePath + " line " +
                        lineNo + " did not contain 3 columns: " + line);
            }
            try {
                final Integer contigId = contigNameMap.get(tokens[0]);
                if ( contigId == null ) throw new GATKException("contig name " + tokens[0] + " not in dictionary");
                final int start = Integer.valueOf(tokens[1]);
                final int end = Integer.valueOf(tokens[2]);
                intervals.add(new SVInterval(contigId, start, end));
            }
            catch ( final Exception e ) {
                throw new GATKException("Unable to parse interval file " + intervalsFilePath + " line " + lineNo + ": " + line, e);
            }
        }
    }
    catch ( final IOException ioe ) {
        throw new GATKException("Unable to read intervals from " + intervalsFilePath, ioe);
    }
    return intervals;
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:41,代碼來源:SVFileUtils.java


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