generated from globalbioticinteractions/template-dataset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add make script and intermediate data products
- Loading branch information
Jorrit Poelen
committed
Dec 2, 2023
1 parent
8964d48
commit 3533a79
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
# | ||
# Script to retrieve the summary table of DoPI index of species interactions | ||
# 2023-12-01 | ||
# | ||
|
||
retrieve() { | ||
curl 'https://www.sussex.ac.uk/lifesci/ebe/dopi/ajax/search' --data-raw 'action=%22results%22&searchoptions=%5B%22yearsfrom--1867%22%2C%22yearsto--2019%22%5D'\ | ||
> dopi.txt | ||
} | ||
|
||
retrieve | ||
|
||
cat\ | ||
<(echo -e "sourceTaxonId\tsourceTaxonName\ttargetTaxonId\ttargetTaxonName\treferenceUrl\tnumberOfInteractions\tinteractionTypeId\tinteractionTypeName")\ | ||
<(cat dopi.txt\ | ||
| sed 's/\\n/\n/g'\ | ||
| sed 's/\\"/"/g'\ | ||
| sed 's+\\/+/+g'\ | ||
| sed 's+"<table>+<table>+g'\ | ||
| sed 's+<th>.*++g'\ | ||
| sed 's+^"$++g'\ | ||
| sed 's+<tr>+[+g'\ | ||
| sed 's+</tr>+],+g'\ | ||
| sed 's+</a></td>+"+g'\ | ||
| sed 's+<td><a href=++g'\ | ||
| sed 's+<td>.*</td>++g'\ | ||
| sed 's+ target="_blank">+, "+g'\ | ||
| tail -n+4\ | ||
| tr -d '\n'\ | ||
| sed 's+""+","+g'\ | ||
| sed 's+,</table>$+]+g'\ | ||
| sed 's+^],+[+g'\ | ||
| sed 's+#overview++g'\ | ||
| sed 's+search+https://www.sussex.ac.uk/lifesci/ebe/dopi/search+g'\ | ||
| jq --raw-output '.[] | @tsv'\ | ||
| sed 's+$+\thttp://purl.obolibrary.org/obo/RO_0002456\tpollinated by+g')\ | ||
| mlr --tsvlite reorder -f sourceTaxonId,sourceTaxonName,interactionTypeId,interactionTypeName,targetTaxonName,targetTaxonId,targetTaxonName,numberOfInteractions,referenceUrl\ | ||
| tee interactions.tsv |