Package psidev.psi.mi.jami.tab.utils
Class MitabUtils
- java.lang.Object
-
- psidev.psi.mi.jami.tab.utils.MitabUtils
-
public class MitabUtils extends Object
Utilisty class for MitabWriter- Since:
10/06/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Field Summary
Fields Modifier and Type Field Description static String
AUTHOR_SUFFIX
ConstantAUTHOR_SUFFIX=" et al."
static String
COLUMN_SEPARATOR
ConstantCOLUMN_SEPARATOR="\t"
static String
COMMENT_PREFIX
ConstantCOMMENT_PREFIX="#"
static DateFormat
DATE_FORMAT
ConstantDATE_FORMAT
static String
DISPLAY_LONG
ConstantDISPLAY_LONG="display_long"
static String
DISPLAY_SHORT
ConstantDISPLAY_SHORT="display_short"
static String
EMPTY_COLUMN
ConstantEMPTY_COLUMN="-"
static String
FIELD_SEPARATOR
ConstantFIELD_SEPARATOR="|"
static String
LINE_BREAK
ConstantLINE_BREAK="System.getProperty(line.separator)"
static DateFormat
PUBLICATION_YEAR_FORMAT
ConstantPUBLICATION_YEAR_FORMAT
static String
RANGE_SEPARATOR
ConstantRANGE_SEPARATOR=","
static String
SHORTLABEL
ConstantSHORTLABEL="shortlabel"
static String[]
SPECIAL_CHARACTERS
ConstantSPECIAL_CHARACTERS="new String[]{FIELD_SEPARATOR,XREF_SEPAR"{trunked}
static String
TAXID
ConstantTAXID="taxid"
static String
UNKNOWN_DATABASE
ConstantUNKNOWN_DATABASE="unknown"
static String
UNKNOWN_ID
ConstantUNKNOWN_ID="unknown"
static String
UNKNOWN_NAME
ConstantUNKNOWN_NAME="unspecified name"
static String
UNKNOWN_TYPE
ConstantUNKNOWN_TYPE="unknown"
static String
XREF_SEPARATOR
ConstantXREF_SEPARATOR=":"
-
Constructor Summary
Constructors Constructor Description MitabUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String[]
buildHeader(MitabVersion version)
Build the header and return an array of String which is an array of column namesstatic MitabAlias[]
findBestShortNameAndFullNameFromAliases(Collection<MitabAlias> aliases)
Find the best alias to use as a shortname and fullName.static MitabXref
findBestShortNameFromAlternativeIdentifiers(Collection<MitabXref> altids)
Find the best id to use as a shortname.static String
findDbSourceForAlias(Alias alias)
The source of the Alias is uniprotkb if the alias type is gene name, gene name synonym, isoform synonym, locus name or orf name.static String
findDbSourceForAlias(ModelledParticipant participant, Alias alias)
The source of the Alias is uniprotkb if the alias type is gene name, gene name synonym, isoform synonym, locus name or orf name.static String
findDbSourceForAlias(ParticipantEvidence participant, Alias alias)
The source of the Alias is uniprotkb if the alias type is gene name, gene name synonym, isoform synonym, locus name or orf name.static boolean
isAnnotationAnInteractionTag(Annotation annot)
To know if a publication annotation is an interactionTagstatic String
unescapeDoubleQuote(String stringToReplace)
unescapeDoubleQuote.
-
-
-
Field Detail
-
LINE_BREAK
public static final String LINE_BREAK
ConstantLINE_BREAK="System.getProperty(line.separator)"
-
COLUMN_SEPARATOR
public static final String COLUMN_SEPARATOR
ConstantCOLUMN_SEPARATOR="\t"
- See Also:
- Constant Field Values
-
FIELD_SEPARATOR
public static final String FIELD_SEPARATOR
ConstantFIELD_SEPARATOR="|"
- See Also:
- Constant Field Values
-
EMPTY_COLUMN
public static final String EMPTY_COLUMN
ConstantEMPTY_COLUMN="-"
- See Also:
- Constant Field Values
-
XREF_SEPARATOR
public static final String XREF_SEPARATOR
ConstantXREF_SEPARATOR=":"
- See Also:
- Constant Field Values
-
RANGE_SEPARATOR
public static final String RANGE_SEPARATOR
ConstantRANGE_SEPARATOR=","
- See Also:
- Constant Field Values
-
COMMENT_PREFIX
public static final String COMMENT_PREFIX
ConstantCOMMENT_PREFIX="#"
- See Also:
- Constant Field Values
-
DATE_FORMAT
public static final DateFormat DATE_FORMAT
ConstantDATE_FORMAT
-
PUBLICATION_YEAR_FORMAT
public static final DateFormat PUBLICATION_YEAR_FORMAT
ConstantPUBLICATION_YEAR_FORMAT
-
UNKNOWN_DATABASE
public static final String UNKNOWN_DATABASE
ConstantUNKNOWN_DATABASE="unknown"
- See Also:
- Constant Field Values
-
UNKNOWN_TYPE
public static final String UNKNOWN_TYPE
ConstantUNKNOWN_TYPE="unknown"
- See Also:
- Constant Field Values
-
UNKNOWN_ID
public static final String UNKNOWN_ID
ConstantUNKNOWN_ID="unknown"
- See Also:
- Constant Field Values
-
UNKNOWN_NAME
public static final String UNKNOWN_NAME
ConstantUNKNOWN_NAME="unspecified name"
- See Also:
- Constant Field Values
-
AUTHOR_SUFFIX
public static final String AUTHOR_SUFFIX
ConstantAUTHOR_SUFFIX=" et al."
- See Also:
- Constant Field Values
-
TAXID
public static final String TAXID
ConstantTAXID="taxid"
- See Also:
- Constant Field Values
-
SHORTLABEL
public static final String SHORTLABEL
ConstantSHORTLABEL="shortlabel"
- See Also:
- Constant Field Values
-
DISPLAY_SHORT
public static final String DISPLAY_SHORT
ConstantDISPLAY_SHORT="display_short"
- See Also:
- Constant Field Values
-
DISPLAY_LONG
public static final String DISPLAY_LONG
ConstantDISPLAY_LONG="display_long"
- See Also:
- Constant Field Values
-
SPECIAL_CHARACTERS
public static final String[] SPECIAL_CHARACTERS
ConstantSPECIAL_CHARACTERS="new String[]{FIELD_SEPARATOR,XREF_SEPAR"{trunked}
-
-
Method Detail
-
buildHeader
public static String[] buildHeader(MitabVersion version) throws IllegalArgumentException
Build the header and return an array of String which is an array of column names- Parameters:
version
- aMitabVersion
object.- Returns:
- an array of
String
objects. - Throws:
IllegalArgumentException
- if any.
-
findDbSourceForAlias
public static String findDbSourceForAlias(Alias alias)
The source of the Alias is uniprotkb if the alias type is gene name, gene name synonym, isoform synonym, locus name or orf name. It is unknown otherwise.- Parameters:
alias
- aAlias
object.- Returns:
- the default dbsource for this alias
-
findDbSourceForAlias
public static String findDbSourceForAlias(ParticipantEvidence participant, Alias alias)
The source of the Alias is uniprotkb if the alias type is gene name, gene name synonym, isoform synonym, locus name or orf name. If the participant evidence has an interaction evidence with an experiment, publication and source, it will return the source shortname. It is unknown otherwise.- Parameters:
participant
- aParticipantEvidence
object.alias
- aAlias
object.- Returns:
- the default dbsource for this alias and participant
-
findDbSourceForAlias
public static String findDbSourceForAlias(ModelledParticipant participant, Alias alias)
The source of the Alias is uniprotkb if the alias type is gene name, gene name synonym, isoform synonym, locus name or orf name. If the participant has an modelled interaction with a source, it will return the source shortname. It is unknown otherwise.- Parameters:
participant
- aModelledParticipant
object.alias
- aAlias
object.- Returns:
- a
String
object.
-
unescapeDoubleQuote
public static String unescapeDoubleQuote(String stringToReplace)
unescapeDoubleQuote.
-
isAnnotationAnInteractionTag
public static boolean isAnnotationAnInteractionTag(Annotation annot)
To know if a publication annotation is an interactionTag- Parameters:
annot
- aAnnotation
object.- Returns:
- a boolean.
-
findBestShortNameAndFullNameFromAliases
public static MitabAlias[] findBestShortNameAndFullNameFromAliases(Collection<MitabAlias> aliases)
Find the best alias to use as a shortname and fullName. It will first collect the alias with display_short if it exists, otherwise display_long if it exists, otherwise gene name if it exists , otherwise shortlabel if it exists otherwise the alias with the shortest alias name.- Parameters:
aliases
- aCollection
object.- Returns:
- the best alias to use as a shortname
-
findBestShortNameFromAlternativeIdentifiers
public static MitabXref findBestShortNameFromAlternativeIdentifiers(Collection<MitabXref> altids)
Find the best id to use as a shortname. It will first collect the id with qualifier = display_short if it exists, otherwise qualifier = display_long if it exists, otherwise qualifier = gene name if it exists , otherwise qualifier = shortlabel if it exists otherwise null.- Parameters:
altids
- aCollection
object.- Returns:
- the best id to use as a shortname
-
-