本文整理汇总了Java中htsjdk.samtools.util.StringUtil.toUpperCase方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.toUpperCase方法的具体用法?Java StringUtil.toUpperCase怎么用?Java StringUtil.toUpperCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.samtools.util.StringUtil
的用法示例。
在下文中一共展示了StringUtil.toUpperCase方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeSequenceRecord
import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/**
* Create one SAMSequenceRecord from a single fasta sequence
*/
private SAMSequenceRecord makeSequenceRecord(final ReferenceSequence refSeq) {
final SAMSequenceRecord ret = new SAMSequenceRecord(refSeq.getName(), refSeq.length());
// Compute MD5 of upcased bases
final byte[] bases = refSeq.getBases();
for (int i = 0; i < bases.length; ++i) {
bases[i] = StringUtil.toUpperCase(bases[i]);
}
ret.setAttribute(SAMSequenceRecord.MD5_TAG, md5Hash(bases));
if (GENOME_ASSEMBLY != null) {
ret.setAttribute(SAMSequenceRecord.ASSEMBLY_TAG, GENOME_ASSEMBLY);
}
ret.setAttribute(SAMSequenceRecord.URI_TAG, URI);
if (SPECIES != null) {
ret.setAttribute(SAMSequenceRecord.SPECIES_TAG, SPECIES);
}
return ret;
}
示例2: calculateRefWindowsByGc
import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
public static int[] calculateRefWindowsByGc(final int windows, final File referenceSequence, final int windowSize) {
final ReferenceSequenceFile refFile = ReferenceSequenceFileFactory.getReferenceSequenceFile(referenceSequence);
ReferenceSequence ref;
final int [] windowsByGc = new int [windows];
while ((ref = refFile.nextSequence()) != null) {
final byte[] refBases = ref.getBases();
StringUtil.toUpperCase(refBases);
final int refLength = refBases.length;
final int lastWindowStart = refLength - windowSize;
final CalculateGcState state = new GcBiasUtils().new CalculateGcState();
for (int i = 1; i < lastWindowStart; ++i) {
final int windowEnd = i + windowSize;
final int gcBin = calculateGc(refBases, i, windowEnd, state);
if (gcBin != -1) windowsByGc[gcBin]++;
}
}
return windowsByGc;
}
示例3: getReference
import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
public byte[] getReference(ChromosomeInformationShare chr,
GenomeLocationParser parser) {
if (refBases == null) {
int start = location.getStart() > REFERENCE_EXTEND ? (location.getStart() - REFERENCE_EXTEND) : 1;
int end = location.getStop() + REFERENCE_EXTEND > chr.getLength() ? chr.getLength() : (location.getStop() + REFERENCE_EXTEND);
location = parser.createGenomeLocation(location.getContig(), start,
end);
refBases = chr.getBaseBytes(start - 1, end - 1);
StringUtil.toUpperCase(refBases);
}
return this.refBases;
}
示例4: normalizeBases
import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/**
* Convert bases in place into canonical form, upper case, and with no-call represented as N.
* @param bases
*/
static void normalizeBases(final byte[] bases) {
for (int i = 0; i < bases.length; ++i) {
bases[i] = StringUtil.toUpperCase(bases[i]);
if (bases[i] == '.') {
bases[i] = 'N';
}
}
}
示例5: Snp
import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
public Snp(final String name, final String chrom, final int pos, final byte allele1, final byte allele2,
final double maf, final List<String> fingerprintPanels) {
this.name = name;
this.chrom = chrom;
this.pos = pos;
this.allele1 = StringUtil.toUpperCase(allele1);
this.allele2 = StringUtil.toUpperCase(allele2);
this.maf = maf;
this.fingerprintPanels = fingerprintPanels == null ? new ArrayList<String>() : fingerprintPanels;
// Construct the genotypes for ease of comparison
this.genotypes[0] = DiploidGenotype.fromBases(allele1, allele1);
this.genotypes[1] = DiploidGenotype.fromBases(allele1, allele2);
this.genotypes[2] = DiploidGenotype.fromBases(allele2, allele2);
}
示例6: acceptRecord
import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
@Override
public void acceptRecord(final GcBiasCollectorArgs args) {
final SAMRecord rec = args.getRec();
if (logCounter < 100 && rec.getReadBases().length == 0) {
log.warn("Omitting read " + rec.getReadName() + " with '*' in SEQ field.");
if (++logCounter == 100) {
log.warn("There are more than 100 reads with '*' in SEQ field in file.");
}
return;
}
if (!rec.getReadUnmappedFlag()) {
if (referenceIndex != rec.getReferenceIndex() || gc == null) {
final ReferenceSequence ref = args.getRef();
refBases = ref.getBases();
StringUtil.toUpperCase(refBases);
final int refLength = refBases.length;
final int lastWindowStart = refLength - scanWindowSize;
gc = GcBiasUtils.calculateAllGcs(refBases, lastWindowStart, scanWindowSize);
referenceIndex = rec.getReferenceIndex();
}
addReadToGcData(rec, this.gcData);
if (ignoreDuplicates && !rec.getDuplicateReadFlag()) {
addReadToGcData(rec, this.gcDataNonDups);
}
} else {
updateTotalClusters(rec, this.gcData);
if (ignoreDuplicates && !rec.getDuplicateReadFlag()) {
updateTotalClusters(rec, this.gcDataNonDups);
}
}
}
示例7: collectReadData
import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
private void collectReadData(final SAMRecord record) {
// NB: for read count metrics, do not include supplementary records, but for base count metrics, do include supplementary records.
if (record.getSupplementaryAlignmentFlag()) return;
metrics.TOTAL_READS++;
readLengthHistogram.increment(record.getReadBases().length);
if (!record.getReadFailsVendorQualityCheckFlag()) {
metrics.PF_READS++;
if (isNoiseRead(record)) metrics.PF_NOISE_READS++;
if (record.getReadUnmappedFlag()) {
// If the read is unmapped see if it's adapter sequence
final byte[] readBases = record.getReadBases();
if (!(record instanceof BAMRecord)) StringUtil.toUpperCase(readBases);
if (adapterUtility.isAdapterSequence(readBases)) {
this.adapterReads++;
}
} else if(doRefMetrics) {
metrics.PF_READS_ALIGNED++;
if (record.getReadPairedFlag() && !record.getProperPairFlag()) metrics.PF_READS_IMPROPER_PAIRS++;
if (!record.getReadNegativeStrandFlag()) numPositiveStrand++;
if (record.getReadPairedFlag() && !record.getMateUnmappedFlag()) {
metrics.READS_ALIGNED_IN_PAIRS++;
// Check that both ends have mapq > minimum
final Integer mateMq = record.getIntegerAttribute(SAMTag.MQ.toString());
if (mateMq == null || mateMq >= MAPPING_QUALITY_THRESHOLD && record.getMappingQuality() >= MAPPING_QUALITY_THRESHOLD) {
++this.chimerasDenominator;
// With both reads mapped we can see if this pair is chimeric
if (ChimeraUtil.isChimeric(record, maxInsertSize, expectedOrientations)) {
++this.chimeras;
}
}
} else { // fragment reads or read pairs with one end that maps
// Consider chimeras that occur *within* the read using the SA tag
if (record.getMappingQuality() >= MAPPING_QUALITY_THRESHOLD) {
++this.chimerasDenominator;
if (record.getAttribute(SAMTag.SA.toString()) != null) ++this.chimeras;
}
}
}
}
}
示例8: doWork
import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
@Override
protected int doWork() {
IOUtil.assertFileIsReadable(INPUT);
IOUtil.assertFileIsWritable(OUTPUT);
// set up the reference and a mask so that we only count the positions requested by the user
final ReferenceSequenceFile ref = ReferenceSequenceFileFactory.getReferenceSequenceFile(INPUT);
final ReferenceSequenceMask referenceSequenceMask;
if (INTERVALS != null) {
IOUtil.assertFileIsReadable(INTERVALS);
final IntervalList intervalList = IntervalList.fromFile(INTERVALS);
referenceSequenceMask = new IntervalListReferenceSequenceMask(intervalList);
} else {
final SAMFileHeader header = new SAMFileHeader();
header.setSequenceDictionary(ref.getSequenceDictionary());
referenceSequenceMask = new WholeGenomeReferenceSequenceMask(header);
}
long nonNbases = 0L;
for (final SAMSequenceRecord rec : ref.getSequenceDictionary().getSequences()) {
// pull out the contig and set up the bases
final ReferenceSequence sequence = ref.getSequence(rec.getSequenceName());
final byte[] bases = sequence.getBases();
StringUtil.toUpperCase(bases);
for (int i = 0; i < bases.length; i++) {
// only investigate this position if it's within our mask
if (referenceSequenceMask.get(sequence.getContigIndex(), i+1)) {
nonNbases += bases[i] == SequenceUtil.N ? 0 : 1;
}
}
}
try {
final BufferedWriter out = IOUtil.openFileForBufferedWriting(OUTPUT);
out.write(nonNbases + "\n");
out.close();
}
catch (IOException ioe) {
throw new PicardException("Error writing to file " + OUTPUT.getAbsolutePath(), ioe);
}
return 0;
}
示例9: convertToUpperCase
import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/**
* Returns the uppercased version of the bases
*
* @param bases the bases
* @return the upper cased version
*/
static public void convertToUpperCase(final byte[] bases) {
StringUtil.toUpperCase(bases);
}