The second one was a typo on my part but this isn't giving the class or family information. The TRANSFAC files seem to have that info but I worry if they are differently annotated somehow.
I have a list of target IDs (think like KEGG ids or Taxids from blast) for TFs identified ffrom our data using JASPAR core databases (vertebrate and insect). I want to make some nice tables using this information but I find no easy way to extract the IDs names and class information from JASPAR.
For example I have a list of ids like:
MA0052.4
MA06602.1
MA0497.1
I want to get their associated TF name, class, and even family information which would be something like:
MA0052.4 MEF2A MADS box factors Regulators of differentiation
MA06602.1 Arid5a ARID ARID-related
MA0497.1 MEF2C MADS box factors Regulators of differentiation
But there seems to be no way to extract this info from JASPAR itself by providing a list. I have to insert these ID names one by one to get them and I have a list of 100s of IDs to go through. Anyone figured out a workaround for this?
2 answers
JASPAR provides a collection of all PFMs, one motif per file. This can be downloaded and then be queried with some simple bash:
# The targets
$ cat targets.txt
MA0052.4
MA06602.1
MA0497.1
# Download from https://jaspar.genereg.net/downloads/ and unzip, that creates many *.jaspar files
wget https://jaspar.genereg.net/download/data/2022/CORE/JASPAR2022_CORE_redundant_pfms_jaspar.zip
unzip JASPAR2022_CORE_redundant_pfms_jaspar.zip
# Query the files
while read p
do
find . -maxdepth 1 -name "${p}.jaspar" \
| xargs cat \
| head -n 1 \
| paste <(echo $p) <(cut -f2 /dev/stdin)
done < <(cat targets.txt)
# That's the output
MA0052.4 MEF2A
MA06602.1
MA0497.1 MEF2C
The 2nd one cannot be found.
Then take this as a template and modify it to work with the transfac files rather than the jaspar files. It's a great bash-fu training exercise, an essential skill for any analyst.
using a XSLT stylesheet:
for F in MA0052.4 MA0497.1 MA0662.1 ; do wget -O - -q "https://jaspar.genereg.net/matrix/${F}/" | xsltproc --html biostar9551867.xsl - 2> /dev/null ; done
MA0052.4 MEF2A MADS box factors Regulators of differentiation
MA0497.1 MEF2C MADS box factors Regulators of differentiation
MA0662.1 MIXL1 Homeo domain factors Paired-related HD factors
with biostar9551867.xsl :
Oh this is helpful - but I am unsure how do you get this xsl output?? Also I tried this but it didn't work :/
but I am unsure how do you get this xsl output??
I don't understand
Also I tried this but it didn't work
I don't understand where or what the 'xsl file is in the command: "xsltproc --html biostar9551867.xsl". Or is this a form of output that is available somewhere? I'm just not following what this line of code is doing.
biostar9551867.xsl is a XSLT spreadsheet . It's the file I provided in the link to gist.github.com . It takes as input the html page downloaded from jaspar on standard input ('-') and basically for each HTML input (line 4) it searches for the table containing the data you want (line 13). In that table it extracts the values for "matrix ID" (line 14) etc...
Log in to answer this question.