Last active
January 18, 2020 13:38
-
-
Save jeanmanguy/5cd98ed4001117fee79c47c0d4b774e6 to your computer and use it in GitHub Desktop.
convert uniprot file to TSV [WIP]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0' encoding="UTF-8"?> | |
<xsl:stylesheet | |
xmlns:u="http://uniprot.org/uniprot" | |
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' | |
version='1.0' | |
> | |
<xsl:output method="text" encoding="UTF-8" /> | |
<xsl:variable name="separator" select="'	'" /> | |
<xsl:variable name="newline" select="' '" /> | |
<xsl:param name="quote">"</xsl:param> | |
<xsl:template match="/"> | |
<xsl:text>accession_number</xsl:text> | |
<xsl:value-of select="$separator" /> | |
<xsl:text>name</xsl:text> | |
<xsl:value-of select="$separator" /> | |
<xsl:text>protein_name</xsl:text> | |
<xsl:value-of select="$separator" /> | |
<xsl:text>gene_name</xsl:text> | |
<xsl:value-of select="$separator" /> | |
<xsl:text>EC</xsl:text> | |
<xsl:value-of select="$separator" /> | |
<xsl:text>COG</xsl:text> | |
<xsl:value-of select="$separator" /> | |
<xsl:text>sequence</xsl:text> | |
<xsl:value-of select="$newline" /> | |
<xsl:for-each select="//u:entry"> | |
<xsl:value-of select="$quote" /><xsl:value-of select="u:accession[1]" /><xsl:value-of select="$quote" /> | |
<xsl:value-of select="$separator" /> | |
<xsl:value-of select="$quote" /><xsl:value-of select="u:name[1]" /><xsl:value-of select="$quote" /> | |
<xsl:value-of select="$separator" /> | |
<xsl:value-of select="$quote" /><xsl:value-of select="u:protein/*/u:fullName[1]" /><xsl:value-of select="$quote" /> | |
<xsl:value-of select="$separator" /> | |
<xsl:value-of select="$quote" /><xsl:value-of select="u:gene/u:name[@type='primary' or @type='ordered locus']" /><xsl:value-of select="$quote" /> | |
<xsl:value-of select="$separator" /> | |
<xsl:value-of select="$quote" /><xsl:value-of select="u:dbReference[@type='EC']/@id" /><xsl:value-of select="$quote" /> | |
<xsl:value-of select="$separator" /> | |
<xsl:value-of select="$quote" /><xsl:value-of select="u:dbReference[@type='eggNOG' and u:property[@type='taxonomic scope' and @value='LUCA']]/@id" /><xsl:value-of select="$quote" /> | |
<xsl:value-of select="$separator" /> | |
<xsl:value-of select="$quote" /><xsl:value-of select="u:sequence[1]" /><xsl:value-of select="$quote" /> | |
<xsl:value-of select="$newline" /> | |
</xsl:for-each> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment