本文整理了Java中psidev.psi.mi.jami.utils.XrefUtils
类的一些代码示例,展示了XrefUtils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XrefUtils
类的具体详情如下:
包路径:psidev.psi.mi.jami.utils.XrefUtils
类名称:XrefUtils
[英]Utility class for Xrefs
[中]外部参照的实用程序类
代码示例来源:origin: psidev.psi.mi.jami/jami-core
public static Xref createRefseqIdentity(String refseq){
return createIdentityXref(Xref.REFSEQ, Xref.REFSEQ_MI, refseq);
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
public static Xref createSecondaryXref(String databaseName, String id){
return createXrefWithQualifier(databaseName, null, id, Xref.SECONDARY, Xref.SECONDARY_MI);
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
protected void processAddedXrefEvent(Xref added) {
// the added identifier is imex and the current imex is not set
if (imexId == null && XrefUtils.isXrefFromDatabase(added, Xref.IMEX_MI, Xref.IMEX)){
// the added xref is imex-primary
if (XrefUtils.doesXrefHaveQualifier(added, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)){
imexId = added;
}
}
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
/**
* This method will return the first Xref from this database having :
* - identity qualifier
* - secondary identifier if no identity qualifier
* - first Xref from this database if no identity or secondary qualifier
* It will return null if there are no Xrefs with this database id/name
* @param refs : the collection of Xrefs
* @param dbId : the database id to look for
* @param dbName : the database name to look for
* @return the first identifier having this database name/id, null if no Xrefs with this database name/id
*/
public static Xref collectFirstIdentifierWithDatabase(Collection<? extends Xref> refs, String dbId, String dbName){
if (refs == null || (dbName == null && dbId == null)){
return null;
}
for (Xref xref : refs){
if (isXrefAnIdentifier(xref) && isXrefFromDatabase(xref, dbId, dbName)){
return xref;
}
}
return null;
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
/**
* This method will return the first Xref from this database having :
* - identity qualifier
* - secondary identifier if no identity qualifier
* - first Xref from this database if no identity or secondary qualifier
* It will return null if there are no Xrefs with this database id/name
* @param refs : the collection of Xrefs
* @param dbId : the database id to look for
* @param dbName : the database name to look for
* @param id
* @return the first identifier having this database name/id, null if no Xrefs with this database name/id
*/
public static Xref collectFirstIdentifierWithDatabaseAndId(Collection<? extends Xref> refs, String dbId, String dbName, String id){
if (refs == null || (dbName == null && dbId == null) || id == null){
return null;
}
for (Xref xref : refs){
if (isXrefAnIdentifier(xref) && doesXrefHaveDatabaseAndId(xref, dbId, dbName, id)){
return xref;
}
}
return null;
}
代码示例来源:origin: psidev.psi.mi.jami.bridges/jami-imexcentral
private void copyIdentifiersFromDelegate() {
List<Identifier> imexIdentifiers = this.delegate.getIdentifier();
for (Identifier identifier : imexIdentifiers){
if (identifier.getNs() == null || identifier.getAc() == null){
// nothing to do
}
else if (identifier.getNs().equals("pmid")){
super.getIdentifiers().add(XrefUtils.createPubmedIdentity(identifier.getAc()));
}
else if (identifier.getNs().equals("imex") && !identifier.getAc().equals("N/A")){
super.getXrefs().add(XrefUtils.createXrefWithQualifier(Xref.IMEX, Xref.IMEX_MI, identifier.getAc(), Xref.IMEX_PRIMARY, Xref.IMEX_PRIMARY_MI));
}
else if (identifier.getNs().equals("doi")){
super.getIdentifiers().add(XrefUtils.createDoiIdentity(identifier.getAc()));
}
else if (identifier.getNs().equals("jint")){
super.getIdentifiers().add(XrefUtils.createIdentityXref("jint", identifier.getAc()));
}
}
if (super.getImexId() == null && this.delegate.getImexAccession() != null && !this.delegate.getImexAccession().equals("N/A")){
super.getXrefs().add(XrefUtils.createXrefWithQualifier(Xref.IMEX, Xref.IMEX_MI, this.delegate.getImexAccession(), Xref.IMEX_PRIMARY, Xref.IMEX_PRIMARY_MI));
}
}
代码示例来源:origin: psidev.psi.mi.jami/jami-mitab
if (XrefUtils.doesXrefHaveQualifier(xref, null, DISPLAY_SHORT)){
displayShort = xref;
break;
else if (XrefUtils.doesXrefHaveQualifier(xref, null, DISPLAY_LONG)){
if (displayLong == null){
displayLong = xref;
else if (XrefUtils.doesXrefHaveQualifier(xref, Alias.GENE_NAME_MI, Alias.GENE_NAME)){
if (geneName == null){
geneName = xref;
else if (XrefUtils.doesXrefHaveQualifier(xref, null, SHORTLABEL)){
if (shortLabel == null){
shortLabel = xref;
代码示例来源:origin: psidev.psi.mi.jami/jami-core
protected void processRemovedXrefEvent(Xref removed) {
// the removed identifier is pubmed
if (imexId != null && imexId.equals(removed)){
Collection<Xref> existingImex = XrefUtils.collectAllXrefsHavingDatabaseAndQualifier(getXrefs(), Xref.IMEX_MI, Xref.IMEX, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY);
if (!existingImex.isEmpty()){
imexId = existingImex.iterator().next();
}
}
}
代码示例来源:origin: psidev.psi.mi/psimi-schema-validator
final Collection<Xref> pubmeds = XrefUtils.collectAllXrefsHavingDatabase(dbReferences, Xref.PUBMED_MI, Xref.PUBMED);
final Collection<Xref> dois = XrefUtils.collectAllXrefsHavingDatabase(dbReferences, Xref.DOI_MI, Xref.DOI);
boolean hasSeveralPrimary = false;
for (Xref pubmed : pubmeds){
if (XrefUtils.doesXrefHaveQualifier(pubmed, Xref.PRIMARY_MI, Xref.PRIMARY) ||
XrefUtils.doesXrefHaveQualifier(pubmed, Xref.IDENTITY_MI, Xref.IDENTITY)){
if (hasPrimary){
hasSeveralPrimary = true;
boolean hasSeveralPrimary = false;
for (Xref doi : dois){
if (XrefUtils.doesXrefHaveQualifier(doi, Xref.PRIMARY_MI, Xref.PRIMARY) ||
XrefUtils.doesXrefHaveQualifier(doi, Xref.IDENTITY_MI, Xref.IDENTITY)){
if (hasPrimary){
hasSeveralPrimary = true;
代码示例来源:origin: psidev.psi.mi.jami.bridges/jami-uniprot
p.getIdentifiers().add(XrefUtils.createUniprotSecondary(id.getValue()));
p.getXrefs().add(XrefUtils.createXrefWithQualifier(Xref.UNIPROTKB , Xref.UNIPROTKB_MI,
entry.getPrimaryUniProtAccession().getValue() , Xref.ISOFORM_PARENT, Xref.ISOFORM_PARENT_MI));
代码示例来源:origin: psidev.psi.mi.jami/jami-core
/**
* Collect all cross references having a specific database and qualifier
* @param refs
* @param dbId
* @param dbName
* @param qualifierId
* @param qualifierName
* @param id
* @return
*/
public static Collection<Xref> collectAllXrefsHavingDatabaseQualifierAndId(Collection<? extends Xref> refs, String dbId, String dbName, String id, String qualifierId, String qualifierName){
if (refs == null || refs.isEmpty()){
return Collections.EMPTY_LIST;
}
Collection<Xref> identifiers = new ArrayList<Xref>(refs.size());
for (Xref ref : refs){
if (isXrefFromDatabase(ref, dbId, dbName) && doesXrefHaveQualifierAndId(ref, qualifierId, qualifierName, id)){
identifiers.add(ref);
}
}
return identifiers;
}
代码示例来源:origin: psidev.psi.mi/psimi-schema-validator
Collection<psidev.psi.mi.jami.model.Xref> cabriReferences = XrefUtils.collectAllXrefsHavingDatabase(cellType.getIdentifiers(), RuleUtils.CABRI_MI_REF, RuleUtils.CABRI);
Collection<psidev.psi.mi.jami.model.Xref> cellReferences = XrefUtils.collectAllXrefsHavingDatabase(cellType.getIdentifiers(), RuleUtils.CELL_ONTOLOGY_MI_REF, RuleUtils.CELL_ONTOLOGY);
Collection<psidev.psi.mi.jami.model.Xref> allPubmeds = XrefUtils.collectAllXrefsHavingDatabaseAndQualifier(cellType.getXrefs(), psidev.psi.mi.jami.model.Xref.PUBMED_MI, psidev.psi.mi.jami.model.Xref.PUBMED, psidev.psi.mi.jami.model.Xref.PRIMARY_MI, psidev.psi.mi.jami.model.Xref.PRIMARY);
代码示例来源:origin: psidev.psi.mi.jami/jami-core
/**
* Remove all Xrefs having this database name/database id from the collection of xrefs
* @param refs : the collection of Xrefs
* @param dbId : the database id to look for
* @param dbName : the database name to look for
*/
public static void removeAllXrefsWithDatabase(Collection<? extends Xref> refs, String dbId, String dbName){
if (refs != null){
Iterator<? extends Xref> refIterator = refs.iterator();
while (refIterator.hasNext()){
if (isXrefFromDatabase(refIterator.next(), dbId, dbName)){
refIterator.remove();
}
}
}
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
/**
* Remove all Xrefs having this database name/database id from the collection of xrefs
* @param refs : the collection of Xrefs
* @param dbId : the database id to look for
* @param dbName : the database name to look for
* @param id
*/
public static void removeAllXrefsWithDatabaseAndId(Collection<? extends Xref> refs, String dbId, String dbName, String id){
if (refs != null){
Iterator<? extends Xref> refIterator = refs.iterator();
while (refIterator.hasNext()){
if (doesXrefHaveDatabaseAndId(refIterator.next(), dbId, dbName, id)){
refIterator.remove();
}
}
}
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
public static Publication createPublicationDoi(String doi){
return new DefaultPublication(XrefUtils.createDoiIdentity(doi));
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
/**
* Collect all cross references having a specific qualifier
* @param refs
* @param qualifierId
* @param qualifierName
* @return
*/
public static Collection<Xref> collectAllXrefsHavingQualifier(Collection<? extends Xref> refs, String qualifierId, String qualifierName){
if (refs == null || refs.isEmpty()){
return Collections.EMPTY_LIST;
}
Collection<Xref> identifiers = new ArrayList<Xref>(refs.size());
for (Xref ref : refs){
if (doesXrefHaveQualifier(ref, qualifierId, qualifierName)){
identifiers.add(ref);
}
}
return identifiers;
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
protected void processRemovedXrefEvent(Xref removed) {
// the removed identifier is pubmed
if (imexId != null && imexId.equals(removed)){
Collection<Xref> existingImex = XrefUtils.collectAllXrefsHavingDatabaseAndQualifier(getXrefs(), Xref.IMEX_MI, Xref.IMEX, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY);
if (!existingImex.isEmpty()){
imexId = existingImex.iterator().next();
}
}
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
/**
* Collect all cross references having a specific database
* @param refs
* @param dbId
* @param dbName
* @return
*/
public static Collection<Xref> collectAllXrefsHavingDatabase(Collection<? extends Xref> refs, String dbId, String dbName){
if (refs == null || refs.isEmpty()){
return Collections.EMPTY_LIST;
}
Collection<Xref> identifiers = new ArrayList<Xref>(refs.size());
for (Xref ref : refs){
if (isXrefFromDatabase(ref, dbId, dbName)){
identifiers.add(ref);
}
}
return identifiers;
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
/**
* Collect all cross references having a specific database
* @param refs
* @param dbId
* @param dbName
* @param id
* @return
*/
public static Collection<Xref> collectAllXrefsHavingDatabaseAndId(Collection<? extends Xref> refs, String dbId, String dbName, String id){
if (refs == null || refs.isEmpty()){
return Collections.EMPTY_LIST;
}
Collection<Xref> identifiers = new ArrayList<Xref>(refs.size());
for (Xref ref : refs){
if (doesXrefHaveDatabaseAndId(ref, dbId, dbName, id)){
identifiers.add(ref);
}
}
return identifiers;
}
代码示例来源:origin: psidev.psi.mi.jami/jami-core
protected void processAddedXrefEvent(Xref added) {
// the added identifier is imex and the current imex is not set
if (imexId == null && XrefUtils.isXrefFromDatabase(added, Xref.IMEX_MI, Xref.IMEX)){
// the added xref is imex-primary
if (XrefUtils.doesXrefHaveQualifier(added, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)){
imexId = added;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!