From e9c81f9f40187bc4701ac539d110003e92b9ca69 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Mon, 2 Mar 2020 02:55:00 +0000 Subject: Described the first analysis phase with a demo subMakefile Until now, there was no explanation on an actual analysis phase, therefore with this commit an example scenario with a readable Makefile is included. The Data lineage graph was also simplified to both be more readable, and also to correspond to this new explanation and subMakefile. Some random edits/typos were also corrected and some references added for discussion. --- reproduce/analysis/config/INPUTS.mk | 2 +- reproduce/analysis/make/analysis-1.mk | 78 +++++++++++++++++++++++ reproduce/analysis/make/download.mk | 8 +-- reproduce/analysis/make/menke2020.mk | 78 ----------------------- reproduce/analysis/make/top-make.mk | 2 +- reproduce/software/config/installation/texlive.mk | 3 +- 6 files changed, 86 insertions(+), 85 deletions(-) create mode 100644 reproduce/analysis/make/analysis-1.mk delete mode 100644 reproduce/analysis/make/menke2020.mk (limited to 'reproduce') diff --git a/reproduce/analysis/config/INPUTS.mk b/reproduce/analysis/config/INPUTS.mk index 9332df3..b1cf546 100644 --- a/reproduce/analysis/config/INPUTS.mk +++ b/reproduce/analysis/config/INPUTS.mk @@ -9,7 +9,7 @@ # this notice are preserved. This file is offered as-is, without any # warranty. -MK20DATA = menke-etal-2020.xlsx +MK20DATA = menke20.xlsx MK20MD5 = 8e4eee64791f351fec58680126d558a0 MK20SIZE = 1.9MB MK20URL = https://www.biorxiv.org/content/biorxiv/early/2020/01/18/2020.01.15.908111/DC1/embed/media-1.xlsx diff --git a/reproduce/analysis/make/analysis-1.mk b/reproduce/analysis/make/analysis-1.mk new file mode 100644 index 0000000..9d0018e --- /dev/null +++ b/reproduce/analysis/make/analysis-1.mk @@ -0,0 +1,78 @@ +# Use the data from Menke 2020 (DOI:10.1101/2020.01.15.908111) as a +# demonstration analysis for this paper. This is a relevant paper because +# it provides good statistics about the status of reproducibility in +# scientific publications. +# +# Copyright (C) 2020 Mohammad Akhlaghi +# +# This Makefile is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This Makefile is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. See . + + + + +# Save the "Table 3" spreadsheet from the downloaded `.xlsx' file into a +# simple plain-text file that is easy to use. +a1dir = $(BDIR)/analysis-1 +mk20tab3 = $(a1dir)/menke20-table-3.txt +$(a1dir):; mkdir $@ +$(mk20tab3): $(indir)/menke20.xlsx | $(a1dir) + + # Set a base-name for the table-3 data. + base=$(basename $(notdir $<))-table-3 + + # Unfortunately XLSX I/O only works when the input and output are + # in the directory it is running. So first, we need to switch to + # the input directory, run it, then put our desired output where we + # want and delete the extra files. + topdir=$$(pwd) + cd $(indir) + xlsxio_xlsx2csv $(notdir $<) + cp $(notdir $<)."Table 3 All by journal by year".csv $$base.csv + rm $(notdir $<).*.csv + cd $$topdir + + # Read the necessary information. Note that we are dealing with a + # CSV (comma-separated value) file. But when there are commas in a + # string, quotation signs are put around it. The `FPAT' values is + # fully described in the GNU AWK manual. In short, it ensures that + # if there is a comma in the middle of double-quotes, it doesn't + # count as a delimter. + echo "# Column 1: YEAR [counter, i16] Year of journal's publication." > $@.tmp + echo "# Column 2: NUM_PAPERS [counter, i16] Number of studied papers in that journal." >> $@.tmp + echo "# Column 3: NUM_ID_TOOLS [counter, i16] Number of software/tools that were identified." >> $@.tmp + echo "# Column 4: JOURNAL_NAME [string, str150] Name of journal." >> $@.tmp + awk 'NR>1{printf("%-10d%-10d%-10d %s\n", $$2, $$3, $$(NF-1)*$$NF, $$1)}' \ + FPAT='([^,]+)|("[^"]+")' $(indir)/$$base.csv >> $@.tmp + + # Set the temporary file as the final target. This was done so if + # there is any possible crash in the steps above, this rule is + # re-run (its final target isn't rebuilt). + mv $@.tmp $@ + + + + + +# Main LaTeX macro file +$(mtexdir)/analysis-1.tex: $(mk20tab3) | $(mtexdir) + + # Count the total number of papers in their study. + v=$$(awk '!/^#/{c+=$$2} END{print c}' $(mk20tab3)) + echo "\newcommand{\menkenumpapers}{$$v}" > $@ + + # Count how many unique journals there were in the study. Note that + # the `31' comes because we put 10 characters for each numeric + # column and separated the last numeric column from the string + # column with a space. If the number of numeric columns change in + # the future, the `31' also has to change. + v=$$(awk 'BEGIN{FIELDWIDTHS="31 10000"} !/^#/{print $$2}' \ + $(mk20tab3) | uniq | wc -l) + echo "\newcommand{\menkenumjournals}{$$v}" >> $@ diff --git a/reproduce/analysis/make/download.mk b/reproduce/analysis/make/download.mk index 7e61cb8..e4f2ccd 100644 --- a/reproduce/analysis/make/download.mk +++ b/reproduce/analysis/make/download.mk @@ -49,11 +49,11 @@ # progress at every moment. $(indir):; mkdir $@ downloadwrapper = $(bashdir)/download-multi-try -inputdatasets = $(indir)/menke-etal-2020.xlsx +inputdatasets = $(indir)/menke20.xlsx $(inputdatasets): $(indir)/%: | $(indir) $(lockdir) # Set the necessary parameters for this input file. - if [ $* = menke-etal-2020.xlsx ]; then + if [ $* = menke20.xlsx ]; then origname=$(MK20DATA); fullurl=$(MK20URL); mdf=$(MK20MD5); else echo; echo; echo "Not recognized input dataset: '$*.fits'." @@ -93,5 +93,5 @@ $(inputdatasets): $(indir)/%: | $(indir) $(lockdir) # # It is very important to mention the address where the data were # downloaded in the final report. -$(mtexdir)/download.tex: $(pconfdir)/INPUTS.mk | $(mtexdir) - echo > $@ +$(mtexdir)/download.tex: $(indir)/menke20.xlsx | $(mtexdir) + echo "\newcommand{\menketwentyurl}{$(MK20URL)}" > $@ diff --git a/reproduce/analysis/make/menke2020.mk b/reproduce/analysis/make/menke2020.mk deleted file mode 100644 index 4dd9897..0000000 --- a/reproduce/analysis/make/menke2020.mk +++ /dev/null @@ -1,78 +0,0 @@ -# Use the data from Menke 2020 (DOI:10.1101/2020.01.15.908111) as a -# demonstration analysis for this paper. This is a relevant paper because -# it provides good statistics about the status of reproducibility in -# scientific publications. -# -# Copyright (C) 2020 Mohammad Akhlaghi -# -# This Makefile is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This Makefile is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. See . - - - - -# Save the "Table 3" spreadsheet from the downloaded `.xlsx' file into a -# simple plain-text file that is easy to use. -mk20dir = $(BDIR)/menke2020 -mk20tab3 = $(mk20dir)/table-3.txt -$(mk20dir):; mkdir $@ -$(mk20tab3): $(indir)/menke-etal-2020.xlsx | $(mk20dir) - - # Set a base-name for the table-3 data. - base=$(basename $(notdir $<))-table-3 - - # Unfortunately XLSX I/O only works when the input and output are - # in the directory it is running. So first, we need to switch to - # the input directory, run it, then put our desired output where we - # want and delete the extra files. - topdir=$$(pwd) - cd $(indir) - xlsxio_xlsx2csv $(notdir $<) - cp $(notdir $<)."Table 3 All by journal by year".csv $$base.csv - rm $(notdir $<).*.csv - cd $$topdir - - # Read the necessary information. Note that we are dealing with a - # CSV (comma-separated value) file. But when there are commas in a - # string, quotation signs are put around it. The `FPAT' values is - # fully described in the GNU AWK manual. In short, it ensures that - # if there is a comma in the middle of double-quotes, it doesn't - # count as a delimter. - echo "# Column 1: YEAR [counter, i16] Year of journal's publication." > $@.tmp - echo "# Column 2: NUM_PAPERS [counter, i16] Number of studied papers in that journal." >> $@.tmp - echo "# Column 3: NUM_ID_TOOLS [counter, i16] Number of software/tools that were identified." >> $@.tmp - echo "# Column 4: JOURNAL_NAME [string, str150] Name of journal." >> $@.tmp - awk 'NR>1{printf("%-10d%-10d%-10d %s\n", $$2, $$3, $$(NF-1)*$$NF, $$1)}' \ - FPAT='([^,]+)|("[^"]+")' $(indir)/$$base.csv >> $@.tmp - - # Set the temporary file as the final target. This was done so if - # there is any possible crash in the steps above, this rule is - # re-run (its final target isn't rebuilt). - mv $@.tmp $@ - - - - - -# Main LaTeX macro file -$(mtexdir)/menke2020.tex: $(mk20tab3) | $(mtexdir) - - # Count the total number of papers in their study. - v=$$(awk '!/^#/{c+=$$2} END{print c}' $(mk20tab3)) - echo "\newcommand{\menkenumpapers}{$$v}" > $@ - - # Count how many unique journals there were in the study. Note that - # the `31' comes because we put 10 characters for each numeric - # column and separated the last numeric column from the string - # column with a space. If the number of numeric columns change in - # the future, the `31' also has to change. - v=$$(awk 'BEGIN{FIELDWIDTHS="31 10000"} !/^#/{print $$2}' \ - $(mk20tab3) | uniq | wc -l) - echo "\newcommand{\menkenumjournals}{$$v}" >> $@ diff --git a/reproduce/analysis/make/top-make.mk b/reproduce/analysis/make/top-make.mk index 29bcd83..6dd322f 100644 --- a/reproduce/analysis/make/top-make.mk +++ b/reproduce/analysis/make/top-make.mk @@ -113,7 +113,7 @@ endif makesrc = initialize \ download \ verify \ - menke2020 \ + analysis-1 \ paper diff --git a/reproduce/software/config/installation/texlive.mk b/reproduce/software/config/installation/texlive.mk index c918748..6760eba 100644 --- a/reproduce/software/config/installation/texlive.mk +++ b/reproduce/software/config/installation/texlive.mk @@ -23,4 +23,5 @@ texlive-packages = tex fancyhdr ec newtx fontaxes xkeyval etoolbox xcolor \ trimspaces pdftexcmds pdfescape letltxmacro bitset \ mweights \ \ - alegreya enumitem fontspec lastpage listings + alegreya enumitem fontspec lastpage listings environ \ + tcolorbox -- cgit v1.2.1