Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing of experiment IDs and names #38

Merged
merged 3 commits into from
Mar 18, 2022

Conversation

irisdianauy
Copy link
Contributor

@irisdianauy irisdianauy commented Mar 18, 2022

The previous parser uses , as a field separator, which does not behave as planned when an experiment name string uses a comma, as reported here. This fix replaces the field separator with a regular expresion for the desired field patterns. It also only accepts , when inside the second/last element (the experiment name) of the parsed string.

This, as far as tested, works using gawk (the default awk in codon as fg_atlas or fg_atlas_sc), but not in other awk versions, like mawk or the original awk.

Copy link
Member

@pinin4fjords pinin4fjords left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm that this does not work on Mac. I would suggest a much simpler solution- switch the jq filter to use TSV and use Awk with tabs separating fields. Could you confirm that the suggestion works, and do similarly with the other?

@@ -91,7 +91,7 @@ echo -e "\n#### Selected differential experiments\n" >> $releaseNotesFile
## parse list of new differential studies to get write experiment titles
curl 'https://wwwdev.ebi.ac.uk/gxa/json/experiments' | \
jq -r '.experiments | .[] | select(.loadDate | strptime("%d-%m-%Y") | mktime > '$last_release_epoch_time') | select(.rawExperimentType | test("DIFFERENTIAL"; "i")) | [.experimentAccession, .experimentDescription] | @csv' | \
awk -v FS="," '{ printf "- [%s](https://www.ebi.ac.uk/gxa/experiments/%s)\n", $2, $1}' | sed s/\"//g >> $releaseNotesFile
awk -v FPAT="^([^,]+)|(\"[^\"]+\")$" '{ printf "- [%s](https://www.ebi.ac.uk/gxa/experiments/%s)\n", $2, $1}' | sed s/\"//g >> $releaseNotesFile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
awk -v FPAT="^([^,]+)|(\"[^\"]+\")$" '{ printf "- [%s](https://www.ebi.ac.uk/gxa/experiments/%s)\n", $2, $1}' | sed s/\"//g >> $releaseNotesFile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in edd0bde, thanks!

gxa_helper/bin/gxa_release_data_stats.sh Outdated Show resolved Hide resolved
Copy link
Member

@pinin4fjords pinin4fjords left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@irisdianauy irisdianauy changed the title Use regex instead of field separator in parsing experiments Fix parsing of experiment IDs and names Mar 18, 2022
@irisdianauy irisdianauy merged commit 09c3e63 into master Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants