本文整理汇总了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);
}
}
示例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;
}
示例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;
}