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


Java StringUtil.isBlank方法代码示例

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


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

示例1: getBaseName

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/** Returns read baseName and asserts correct pair read name format:
 * <ul>
 * <li> Paired reads must either have the exact same read names or they must contain at least one "/"
 * <li> and the First pair read name must end with "/1" and second pair read name ends with "/2"
 * <li> The baseName (read name part before the /) must be the same for both read names
 * <li> If the read names are exactly the same but end in "/2" or "/1" then an exception will be thrown 
 * </ul>
 */
String getBaseName(final String readName1, final String readName2, final FastqReader freader1, final FastqReader freader2) {
    String [] toks = getReadNameTokens(readName1, 1, freader1);
    final String baseName1 = toks[0] ;
    final String num1 = toks[1] ;

    toks = getReadNameTokens(readName2, 2, freader2);
    final String baseName2 = toks[0] ;
    final String num2 = toks[1];

    if (!baseName1.equals(baseName2)) {
        throw new PicardException(String.format("In paired mode, read name 1 (%s) does not match read name 2 (%s)", baseName1,baseName2));
    }

    final boolean num1Blank = StringUtil.isBlank(num1);
    final boolean num2Blank = StringUtil.isBlank(num2);
    if (num1Blank || num2Blank) {
        if(!num1Blank) throw new PicardException(error(freader1,"Pair 1 number is missing (" +readName1+ "). Both pair numbers must be present or neither."));       //num1 != blank and num2   == blank
        else if(!num2Blank) throw new PicardException(error(freader2, "Pair 2 number is missing (" +readName2+ "). Both pair numbers must be present or neither.")); //num1 == blank and num =2 != blank 
    } else {
        if (!num1.equals("1")) throw new PicardException(error(freader1,"Pair 1 number must be 1 ("+readName1+")"));
        if (!num2.equals("2")) throw new PicardException(error(freader2,"Pair 2 number must be 2 ("+readName2+")"));
    }

    return baseName1 ;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:34,代码来源:FastqToSam.java

示例2: initialize

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
@Override
public int initialize() {
	if(StringUtil.isBlank(this.polyXtag)) {
		LOG.error("Empty tag");
		return -1;
		}
	if(StringUtil.isBlank(this.referenceUri))
		{
		LOG.error("Undefined Reference");
		return -1;
		}
	LOG.info("opening reference "+this.referenceUri);
	try {
		this.referenceGenome =new ReferenceGenomeFactory().
				open(this.referenceUri);
	} catch (final IOException e) {
		LOG.error(e);
		return -1;
		}
	return 0;
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:22,代码来源:VCFPolyX.java

示例3: select

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
private void select(final Set<String> atts,final PreparedStatement pstmt) throws SQLException
{
final ResultSet row=pstmt.executeQuery();
while(row.next())
	{
	final StringBuilder sb=new StringBuilder();
	this.expression.eval(row,sb);
	final  String s=sb.toString();
	if(StringUtil.isBlank(s)) continue;
	atts.add(s);
	}
row.close();
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:14,代码来源:VcfUcsc.java

示例4: beginXml

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
@Override
void beginXml(final XMLStreamWriter w) throws XMLStreamException {
	final String u = this.getURL();
	if(StringUtil.isBlank(u)) return;
	w.writeStartElement("a");
	w.writeAttribute("title",this.toString());
	w.writeAttribute("target","_blank");
	w.writeAttribute("href",u);
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:10,代码来源:VcfToTable.java

示例5: initialize

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
@Override
public int initialize() {
	if(StringUtil.isBlank(this.infoName)) {
		LOG.error("undefined option for infoName");
		return -1;
		}
	return 0;
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:9,代码来源:VcfMoveFiltersToInfo.java

示例6: getToken

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
public String getToken() {
if(StringUtil.isBlank(this.tag))
	{
	this.tag=this.biwWigFile;
	int i=this.tag.lastIndexOf(File.separator);
	if(i!=-1) this.tag=this.tag.substring(i+1);
	i=this.tag.indexOf('.');
	if(i!=-1) this.tag=this.tag.substring(0,i);
	if(StringUtil.isBlank(this.tag)) throw new JvarkitException.UserError("Bad TAG for "+this.biwWigFile);
	LOG.info("setting tag to "+this.tag+" for "+this.biwWigFile);
	}
return this.tag;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:14,代码来源:VCFBigWig.java

示例7: open

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/** open any kind of reference */
public ReferenceGenome open(final String ref) throws IOException
	{
	if(StringUtil.isBlank(ref)) throw new IllegalArgumentException("null/empty arg");
	return (IOUtil.isUrl(ref))?
		openDAS(new URL(ref)):
		openFastaFile(new File(ref))
		;
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:10,代码来源:ReferenceGenomeFactory.java

示例8: getSOTermsStrings

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
public Set<String> getSOTermsStrings()
{
final String EFF=getSOTermsString();
if(StringUtil.isBlank(EFF)) return Collections.emptySet();

final String EFF2;
if(EFF2SO.containsKey(EFF)) {
	EFF2 = EFF2SO.get(EFF);
	}
else
	{
	EFF2 =EFF.toLowerCase();
	}
return Collections.singleton(EFF2);
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:16,代码来源:SnpEffPredictionParser.java

示例9: getTagDescription

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/** returns SAM attribute definition. Never null */
private String getTagDescription(final String attName) {
	if(attName.equals(ColorUtils.YC_TAG)) {
		return "IGV Color tag";
		}
	if(attName.startsWith("X") ||
		attName.startsWith("Y") ||
		attName.startsWith("Z"))
		{
		return "Reserved for end users";
		}
	final String value = this.tags.get(attName);
	return StringUtil.isBlank(value)?"Unknown":value;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:15,代码来源:PrettySam.java

示例10: getAllele

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/** return ALT allele if found in Codon_Change ( e.g: Tga/Cga), may be null */
public Allele getAllele()  {
	String s = getCodonChange();
	if(StringUtil.isBlank(s)) return null;
	final int slash = s.indexOf("/");
	if(slash==-1) return null;
	s = s.substring(slash+1).replaceAll("[^A-Z]+","");// remove all lower case
	if(StringUtil.isBlank(s)) return null;
	return Allele.create(s,false);
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:11,代码来源:SnpEffPredictionParser.java

示例11: getURL

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
protected String getURL()  	{
final String str= this.toString();
if(StringUtil.isBlank(str)) return null;
if(Pattern.compile("rs[0-9]+").matcher(str.toLowerCase()).matches())
	{
	return "https://www.ncbi.nlm.nih.gov/projects/SNP/snp_ref.cgi?rs="+str.substring(2);
	}
else if(
		Pattern.compile("ENS[TPGR][0-9]+").matcher(str.toUpperCase()).matches() ||
		Pattern.compile("ENSEST[TGP][0-9]+").matcher(str.toUpperCase()).matches() 

		)
	{
	return "http://www.ensembl.org/Multi/Search/Results?species=all;idx=;q="+str.toUpperCase()+";species=;site=ensembl";
	}
else if(Pattern.compile("[XN][MR]_[0-9\\.]+").matcher(str.toUpperCase()).matches())
	{
	return "https://www.ncbi.nlm.nih.gov/nuccore/"+str;
	}
else if(Pattern.compile("[NX]P_[0-9\\.]+").matcher(str.toUpperCase()).matches())
	{
	return "https://www.ncbi.nlm.nih.gov/protein/"+str;
	}
else if(Pattern.compile("CCDS[0-9\\.]+").matcher(str.toUpperCase()).matches())
	{
	return "https://www.ncbi.nlm.nih.gov/CCDS/CcdsBrowse.cgi?REQUEST=CCDS&GO=MainBrowse&DATA="+str;
	}
return null;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:30,代码来源:VcfToTable.java

示例12: fillPositions

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
protected Map<Integer,Counter<String>> fillPositions(final List<SAMRecord> records,final int begin1,final int end1)
{
final Map<Integer,Counter<String>> pos2sample2depth = new HashMap<>();
for(final SAMRecord rec:records) {
	final Cigar cigar = rec.getCigar();
	if(cigar==null) continue;
	final String sample = partition(rec);
	if(StringUtil.isBlank(sample)) continue;
	
	int pos1= rec.getAlignmentStart();
	for(final CigarElement ce:cigar) {
		if(pos1>=end1) break;
		final CigarOperator op= ce.getOperator();
		if(op.consumesReferenceBases())
			{
			final int L=ce.getLength();
			if(op.consumesReadBases())
				{
				for(int i=0;i< L && pos1+i<end1;++i)
					{
					final int nx = pos1 + i;
					if(nx>=begin1 && nx< end1)
						{
						Counter<String> sample2coverage = pos2sample2depth.get(nx);
						if(sample2coverage==null) {
							sample2coverage = new Counter<String>();
							pos2sample2depth.put(nx, sample2coverage);
							}
						sample2coverage.incr(sample);
						}
					}
				}
			pos1+=L;
			}
		}
	
	}
return pos2sample2depth;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:40,代码来源:Bam2Wig.java

示例13: process

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
@Override
public List<VariantContext> process(final List<VariantContext> variants) throws Exception {
	final Predicate<VariantContext> pred = this.getPredicate();
	final String filterName = this.getFilterName();
	if(pred == null || variants.isEmpty()) return variants;
	if(StringUtil.isBlank(filterName)) 
		{
		return variants.stream().
				filter(pred).
				collect(Collectors.toList());
		}
	
	return variants.stream().map(V->{
		if(pred.test(V)) {
			if(V.isFiltered()) return V;
			return new VariantContextBuilder(V).
					passFilters().
					make();
			}
		else
			{
			return new VariantContextBuilder(V).
					filter(filterName).
					make();
			}
		}).collect(Collectors.toList());
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:28,代码来源:AbstractVariantContextFilterProcessor.java

示例14: getAmpParamValue

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/** return '&api_key=xxxxx' or empty string if no key is defined */
public String getAmpParamValue() {
	final String s=this.getApiKey();
	if(StringUtil.isBlank(s)) return "";
	return "&"+PARAM+"="+s;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:7,代码来源:NcbiApiKey.java

示例15: getTitle

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
private String getTitle() {
return StringUtil.isBlank(this.title)?
	   getHeaderText():
	   this.title;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:6,代码来源:JfxUtils.java


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