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

[Long-format table annotation Part 3] annotator R CLI #59

Merged
merged 101 commits into from
Jul 26, 2021

Commits on Jul 15, 2021

  1. Configuration menu
    Copy the full SHA
    0b316f4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    75769b5 View commit details
    Browse the repository at this point in the history
  3. Update README.md

    logstar committed Jul 15, 2021
    Configuration menu
    Copy the full SHA
    b750ed5 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2021

  1. Download annotation data

    Download `Gene_full_name` and `Protein_RefSeq_ID` from
    https://mygene.info/ using the mygene package.
    logstar committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    18ea05a View commit details
    Browse the repository at this point in the history
  2. Clean up ensg-gene-full-name-refseq-protein.tsv

    Remove rows that have both Gene_full_name and Protein_RefSeq_ID values
    missing.
    
    Write NA for missing values rather than "NA" or "", in order to be
    consistent with the data release.
    logstar committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    f40e997 View commit details
    Browse the repository at this point in the history
  3. Add echo commands in shell scripts

    Print messages after done running shell scripts.
    logstar committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    f941405 View commit details
    Browse the repository at this point in the history
  4. Sort mygene returned character values

    mygene API may return results in different orders, so sorting the values
    before output is necessary to reproduce previous results.
    logstar committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    96e8885 View commit details
    Browse the repository at this point in the history
  5. Update README.md

    Add long-format-table-utils module.
    logstar committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    80b794e View commit details
    Browse the repository at this point in the history
  6. Update README.md

    Describe how to update
    annotator/annotation-data/oncokb-cancer-gene-list.tsv.
    logstar committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    9784aae View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0a80994 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3adf7de View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4e5cdde View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2021

  1. Configuration menu
    Copy the full SHA
    bfc8470 View commit details
    Browse the repository at this point in the history
  2. Update README.md

    Update OncoKB annotation table source to
    analyses/long-format-table-utils/annotator/annotation-data/oncokb-cancer-gene-list.tsv
    logstar committed Jul 17, 2021
    Configuration menu
    Copy the full SHA
    9817edf View commit details
    Browse the repository at this point in the history
  3. Merge branch 'lft-utils-ann-data-download' into lft-utils

    Update README.md.
    logstar committed Jul 17, 2021
    Configuration menu
    Copy the full SHA
    e402fb9 View commit details
    Browse the repository at this point in the history
  4. Read annotation data

    logstar committed Jul 17, 2021
    Configuration menu
    Copy the full SHA
    2202441 View commit details
    Browse the repository at this point in the history
  5. Check no NA or duplicate in annotation key columns

    For an annotation table, NA or duplicate should not exist in the key
    column that is used to join_by for adding annotations to input table.
    logstar committed Jul 17, 2021
    Configuration menu
    Copy the full SHA
    b1da9d0 View commit details
    Browse the repository at this point in the history
  6. Rename ensg_hgsb_rmtl_df to ensg_rmtl_df

    Gene symbol is not added in this function, and gene symbol is required.
    
    It is also not necessary to check the gene_symbol column.
    logstar committed Jul 17, 2021
    Configuration menu
    Copy the full SHA
    5686fc1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ebda13b View commit details
    Browse the repository at this point in the history
  8. Require that input long_format_table is tibble

    The annotate_long_format_table function now only supports tibble,
    because handling data.frame or other types of table is complex, such as
    preserving rownames, orders, and column types.
    
    Support for other types of table could be added if required at a later
    point.
    logstar committed Jul 17, 2021
    Configuration menu
    Copy the full SHA
    2c044ed View commit details
    Browse the repository at this point in the history

Commits on Jul 18, 2021

  1. Use double quotes for strings

    logstar committed Jul 18, 2021
    Configuration menu
    Copy the full SHA
    9d0061f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c6b4553 View commit details
    Browse the repository at this point in the history
  3. Change is_gene_level_table param to add_Gene_type

    add_Gene_type is more informative.
    logstar committed Jul 18, 2021
    Configuration menu
    Copy the full SHA
    e168a0d View commit details
    Browse the repository at this point in the history
  4. Add add_OncoKB_columns parameter

    In annotate_long_format_table(), add a add_OncoKB_columns parameter.
    
    add_OncoKB_columns: TRUE or FALSE on whether to add OncoKB_cancer_gene
    and OncoKB_oncogene_TSG columns. Default value is FALSE.
    logstar committed Jul 18, 2021
    Configuration menu
    Copy the full SHA
    1eb2da3 View commit details
    Browse the repository at this point in the history

Commits on Jul 19, 2021

  1. Change default to add all annotation columns

    The interface of annotate_long_format_table is changed, so that all
    annotation columns are added by default, and the columns_to_add
    parameter can be passed to add only certain columns.
    
    The current interface annotate_long_format_table is designed to favor
    flexibility and readability over efficiency. The funciton can be further
    refactored to be more efficient, e.g. not check certain tables, process
    certain tables, or add certain columns if they are not required.
    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    d1a10ec View commit details
    Browse the repository at this point in the history
  2. Add a note about the order of added columns

    The order of added columns may not be the same as the values of
    columns_to_add, in annotate_long_format_table.
    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    92bd0a8 View commit details
    Browse the repository at this point in the history
  3. Order the columns of the annotated table

    In annotate_long_format_table, reorder the columns of the returned table
    to have the same column order as the input table and added columns in
    the order of columns_to_add parameter.
    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    51cbe37 View commit details
    Browse the repository at this point in the history
  4. Correct variable name

    Renamed to ensg_rmtl_df.
    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    492a30d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4983aff View commit details
    Browse the repository at this point in the history
  6. Refactor annotation part

    Only left_join an annotation table if it is required.
    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    79bc8ed View commit details
    Browse the repository at this point in the history
  7. Refactor annotation data processing with %>%

    Use %>% to chain multiple processing steps
    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    1eec9bd View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5a2811e View commit details
    Browse the repository at this point in the history
  9. Update README.md

    Add R API usage of long-format table annotator.
    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    fac1a84 View commit details
    Browse the repository at this point in the history
  10. Update README.md

    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    e64f82f View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    66e8a7c View commit details
    Browse the repository at this point in the history
  12. Update README.md

    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    c735ca8 View commit details
    Browse the repository at this point in the history
  13. Update README.md

    Add non-missing value descriptions for each annotation column.
    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    c409e1f View commit details
    Browse the repository at this point in the history
  14. Update README.md

    logstar committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    7e5a331 View commit details
    Browse the repository at this point in the history

Commits on Jul 20, 2021

  1. Update error message

    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    c2fa1d3 View commit details
    Browse the repository at this point in the history
  2. Add annotator-cli.R

    `source` annotator-api.R.
    
    Parse arguments.
    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    eac83e8 View commit details
    Browse the repository at this point in the history
  3. Add CLI options

    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    6820050 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7344502 View commit details
    Browse the repository at this point in the history
  5. Add CLI example usages

    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    d49344f View commit details
    Browse the repository at this point in the history
  6. Update README.md

    Add documentation for R CLI usage of long-format table annotator.
    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    2f4eeed View commit details
    Browse the repository at this point in the history
  7. Update README.md

    Revise annotator R API example usage, so the code does not rely on any
    loaded package.
    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    9387a22 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5b76fb0 View commit details
    Browse the repository at this point in the history
  9. Update README.md

    Remove data reading line in the CLI example.
    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    2a36e00 View commit details
    Browse the repository at this point in the history
  10. Update README.md

    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    721c043 View commit details
    Browse the repository at this point in the history
  11. Update README.md

    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    029b238 View commit details
    Browse the repository at this point in the history
  12. Update error message in download-annotation-data.R

    Co-authored-by: Jo Lynne Rokita <jharenza@gmail.com>
    logstar and jharenza authored Jul 20, 2021
    Configuration menu
    Copy the full SHA
    909277d View commit details
    Browse the repository at this point in the history
  13. Update error message in download-annotation-data.R

    Co-authored-by: Jo Lynne Rokita <jharenza@gmail.com>
    logstar and jharenza authored Jul 20, 2021
    Configuration menu
    Copy the full SHA
    80b6af7 View commit details
    Browse the repository at this point in the history
  14. Update error message in download-annotation-data.R

    Co-authored-by: Jo Lynne Rokita <jharenza@gmail.com>
    logstar and jharenza authored Jul 20, 2021
    Configuration menu
    Copy the full SHA
    a1399bc View commit details
    Browse the repository at this point in the history
  15. Specify input TSV format

    Added a note on TSV format in the help message:
    
    *NOTE** on the --input-long-format-table-tsv file: 1) the TSV file
    should use double quotes for field values thatneed escape, e.g. "NA" for
    string literal "NA" and "\t" for tab; 2) only unquoted NA field values
    are treated as missing values internally; 3) leading and trailing white
    spaces in field values are **NOT** trimmed before parsing.
    
    Changed parameters in read_tsv in order to preserve the TSV content. See
    comments for more details.
    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    4ef7685 View commit details
    Browse the repository at this point in the history
  16. Update README.md

    Add notes to CLI input TSV specifications that are implemented in the
    last commit.
    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    16d23b4 View commit details
    Browse the repository at this point in the history
  17. Rename update-long-format-table-utils.sh to run-update-long-format-ta…

    …ble-utils.sh
    
    README.md is also updated accordingly.
    
    This is suggested by @jharenza at
    d3b-center#55 (comment)
    , in order to follow the shell script name convention of analysis
    modules.
    logstar committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    090f080 View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2021

  1. Specify annotation data versions in README.md

    Add annotation data versions and data of the last update in the "Update
    downloaded data that are used in this module" section, as suggested by
    @jharenza at
    d3b-center#55 (comment)
    
    Combine gene and disease (/cancer_group) annotations into one table.
    
    Add additional notes on annotation data versions to the "Implementation
    of long-format table annotator" section.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    a183470 View commit details
    Browse the repository at this point in the history
  2. Update README.md

    Change the date of the last update of
    annotator/annotation-data/oncokb-cancer-gene-list.tsv to 07/16/2021.
    
    The 07/16/2021 annotator/annotation-data/oncokb-cancer-gene-list.tsv is
    identical to the previous 06/16/2021 version, even though the website at
    https://www.oncokb.org/cancerGenes has changed last update from
    06/16/2021 to 07/16/2021.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    5716523 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'lft-utils-ann-data-download' into lft-utils-ann-r-api

    Merge changes in the data downloading PR
    d3b-center#55 .
    
    Rename update-long-format-table-utils.sh to
    run-update-long-format-table-utils.sh .
    
    Specify annotation data versions in README.md.
    
    Change the date of the last update of
    annotator/annotation-data/oncokb-cancer-gene-list.tsv to 07/16/2021.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    64fb672 View commit details
    Browse the repository at this point in the history
  4. Merge branch 'lft-utils-ann-r-api' into lft-utils-ann-r-cli

    Merge changes in the data downloading PR
    d3b-center#55 .
    
    Rename update-long-format-table-utils.sh to
    run-update-long-format-table-utils.sh .
    
    Specify annotation data versions in README.md.
    
    Change the date of the last update of
    annotator/annotation-data/oncokb-cancer-gene-list.tsv to 07/16/2021.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    d61e21b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    03516c9 View commit details
    Browse the repository at this point in the history
  6. Remove test cases in download-annotation-data.R

    As suggested by @jharenza at
    <d3b-center#55 (comment)>,
    test cases should be removed from the source code file.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    6f76fae View commit details
    Browse the repository at this point in the history
  7. Add unit testing using the testthat package

    Run `bash run-tests.sh` to run all tests.
    
    In order to import a funciton for testing from an R file without running
    the whole file, a helper function import_function is defined at
    tests/helper_import_function.R, and the import_function is also tested
    in the tests/test_helper_import_function.R file.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    48a131d View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0773a1e View commit details
    Browse the repository at this point in the history
  9. Update README.md

    Add "Unit testing for long-format table annotator" section to descript
    how to use the unit testing framework.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    a08cf5f View commit details
    Browse the repository at this point in the history
  10. Update README.md

    Edit.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    796a26c View commit details
    Browse the repository at this point in the history
  11. Merge branch 'lft-utils-ann-data-download' into lft-utils-ann-r-api

    Merge changes from the data downloading PR
    <d3b-center#55>
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    6d6838c View commit details
    Browse the repository at this point in the history
  12. Merge branch 'lft-utils-ann-r-api' into lft-utils-ann-r-cli

    Merge changes from the data downloading PR
    <d3b-center#55>
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    5029d4b View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    29325c7 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    3fc592e View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    76dea21 View commit details
    Browse the repository at this point in the history
  16. Add note on requiring both Gene_Ensembl_ID and Gene_symbol

    Clarify the reasons for requiring both Gene_Ensembl_ID and Gene_symbol
    in annotator/annotator-api.R, as suggested by @jharenza at
    d3b-center#56 (review)
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    cb683a3 View commit details
    Browse the repository at this point in the history
  17. Update README.md

    Group notes on annotation data versions into a list.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    76b1322 View commit details
    Browse the repository at this point in the history
  18. Update README.md

    Note that the annotation columns to be added should not already exist in
    the table that needs to be annotated, as suggested by @NHJohnson at
    d3b-center#56 (review)
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    24ba5d2 View commit details
    Browse the repository at this point in the history
  19. Update README.md

    Note that that the names of the annotation columns will be standardized
    at a later point, as suggested by @jharenza at
    <d3b-center#56 (review)>,
    so it is recommended to use the annotation column names in this module
    for the results.
    logstar committed Jul 21, 2021
    Configuration menu
    Copy the full SHA
    e5a653c View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2021

  1. Change root criteria in rprojroot::find_root

    Add rprojroot::has_file(".git") as an alternative root criterion to
    handle linked git working trees created by `git worktree add` in
    rprojroot::find_root.
    
    Also fixed typo identified by @NHJohnson at
    d3b-center#56 (comment)
    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    fd99539 View commit details
    Browse the repository at this point in the history
  2. Remove git diff in run-download-annotation-data.sh

    git commands do not work in a linked working tree in a Docker
    image/container, because the linked working tree uses host absolute
    paths to locate the main working tree.
    
    Therefore, drop the git diff --stat command to improve compatibility
    with Docker image/container. The users could still use git diff --stat
    on host machine.
    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    a85a97d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2cdadf4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0f3d912 View commit details
    Browse the repository at this point in the history
  5. Refactor annotator-api.R using functional paradigm

    As suggested by @NHJohnson at
    <https://github.com/PediatricOpenTargets/OpenPedCan-analysis/pull/56/files#r674342194>,
    reduce code duplication by refactoring the annotate_long_format_table
    funtion in annotator-api.R with a functional paradigm. See comments in
    annotator-api.R for more details.
    
    The interface is not changed, so previous examples and descriptions
    should all still apply.
    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    3292b7f View commit details
    Browse the repository at this point in the history
  6. Add comments in test R files

    Explain where import_function is from.
    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    0cd9a8c View commit details
    Browse the repository at this point in the history
  7. Fix a bug that can add duplicated annotation cols

    Duplicated .x and .y annotation columns will be added in the following
    scenario:
    
    - annotation table has multiple columns
    
    - one or more annotatoin columns in the annotatoin table are in the
    columns_to_add vector
    
    - one or more other annotation columns in the annotation table are
    already in the table to be annotated, but these columns are not in the
    columns_to_add vector
    
    Fix this bug by joining only annotation columns that are not in the
    table to be annotated.
    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    81a041e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7e38c19 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    53f27fd View commit details
    Browse the repository at this point in the history
  10. Fix package version compatibility issues for tests

    As found by @NHJohnson at
    <d3b-center#56 (comment)>,
    some tests failed out side of the Docker image.
    
    See comments in annotator/tests/test_annotate_long_format_table.R for
    more details about the package version compatibility issues.
    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    e337abd View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    f9f6d17 View commit details
    Browse the repository at this point in the history
  12. Change root criteria in rprojroot::find_root

    Add rprojroot::has_file(".git") as an alternative root criterion to
    handle linked git working trees created by `git worktree add` in
    rprojroot::find_root.
    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    eca90e5 View commit details
    Browse the repository at this point in the history
  13. Properly handle -c '' CLI calls

    Previously, `-c ''` calls will fail because `""` is passed to API calls
    as required columns to add, which is unavailable.
    
    Now, `-c ''` calls will pass `character(0)` to API calls, so the output
    table will not have any additional annotation column.
    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    ebcc6ac View commit details
    Browse the repository at this point in the history
  14. Add tests for annotator-cli.R

    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    52ff63e View commit details
    Browse the repository at this point in the history
  15. Update README.md

    Add a note on the naming conventions of test files in the tsetthat
    package 2.1.1.
    logstar committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    a725257 View commit details
    Browse the repository at this point in the history

Commits on Jul 23, 2021

  1. Remove input file after running certain CLI tests

    Remove input files after running CLI tests, if the input files are
    created by tests as intermediate files, in order to ensure a clean start
    for the next test to run.
    logstar committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    9c4e47f View commit details
    Browse the repository at this point in the history
  2. Test CLI calls with unavailable input/output paths

    Should fail on annotator CLI calls with unavailable input files or
    output dirs.
    logstar committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    3e0ef2f View commit details
    Browse the repository at this point in the history
  3. Add comments for import_function usage

    Note that nested functions cannot be imported, and unnamed functions
    cannot be imported.
    logstar committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    2455609 View commit details
    Browse the repository at this point in the history
  4. Add tests for importing nested functions

    Should fail on importing functions that are nestedly defined in other
    expressions.
    logstar committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    365fcf9 View commit details
    Browse the repository at this point in the history
  5. Add tests on importing functions defined multiple times

    Should fail, even if the function is defined in different ways.
    logstar committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    0224e3b View commit details
    Browse the repository at this point in the history
  6. Test comments and line breaks for import_function

    Comments and line breaks should not change the behaviors of
    import_function.
    logstar committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    ea90284 View commit details
    Browse the repository at this point in the history
  7. Change test file context

    Corrected test helpfer function context.
    
    Added test/ prefix to test annotator/tests/test_annotator_cli.R.
    logstar committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    be21860 View commit details
    Browse the repository at this point in the history
  8. Put imported function in the importing environment

    Put the imported function in the same environment as the import_function
    being called, so the imported functions can call other imported
    functions. Also add a test for such use cases.
    logstar committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    85aa52f View commit details
    Browse the repository at this point in the history

Commits on Jul 24, 2021

  1. Specify envir = parent.frame() in eval call

    In import_function, envir = parent.frame() makes the
    environment(imported_function) to be the same as the import function
    being called.
    
    Even though the eval documentation says the default envir parameter is
    parent.frame(), leaving envir = parent.frame() in the eval call will
    surprisingly make the environment(imported_function) to be the same as
    the environment of the import_function call. The tests also fail without
    specifying envir = parent.frame(). Maybe this is caused by the place
    where parent.frame() is evaluated? If specified, parent.frame() is
    evaluated in the calling function; if not specified, parent.frame() is
    evaluated in the eval call environment?
    
    Examples executed in terminal R, in order to avoid RStudio customizations.
    > print(environment())
    <environment: R_GlobalEnv>
    >
    > foo <- function() {
    +   print(parent.frame())
    +   print(environment())
    +   return(eval(quote(function() { return(2) })))
    + }
    >
    > bar <- foo()
    <environment: R_GlobalEnv>
    <environment: 0x5645ead67670>
    > print(environment(bar))
    <environment: 0x5645ead67670>
    >
    > baz <- function() {
    +   print(parent.frame())
    +   print(environment())
    +   return(eval(quote(function() { return(2) }),
    +               envir = parent.frame()))
    + }
    >
    > qux <- baz()
    <environment: R_GlobalEnv>
    <environment: 0x5645ead5fec0>
    > print(environment(qux))
    <environment: R_GlobalEnv>
    logstar committed Jul 24, 2021
    Configuration menu
    Copy the full SHA
    2047329 View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2021

  1. Only replace NA with empty string in columns that have NA

    Previously, if replace_na_with_empty_string=TRUE in
    annotate_long_format_table, replace_na with empty string is applied to
    all columns, including columns that have no NA. If a non-character
    column that has no NA, its data type will be comverted to character,
    which may break backward compatibility of the JSON/JSONL tables that
    were generated without using the annotator API.
    
    Now, if replace_na_with_empty_string=TRUE in annotate_long_format_table,
    only replace NA with empty string in columns that have NA in them.  This
    will not change the value types of the columns that have no NA, so the
    output JSON/JSONL table will be backward compatible with the ones that
    were generated without using the annotator API.
    
    CLI help message is also changed accordingly.
    logstar committed Jul 25, 2021
    Configuration menu
    Copy the full SHA
    0545a41 View commit details
    Browse the repository at this point in the history
  2. Test annotator API replace_na_with_empty_string

    Test that replace_na_with_empty_string = TRUE replaces NA with "". Test
    that non-character columns without NA are not converted to character
    columns.
    
    Test that replace_na_with_empty_string = FALSE does not replace NA with
    "".
    logstar committed Jul 25, 2021
    Configuration menu
    Copy the full SHA
    f87a4c3 View commit details
    Browse the repository at this point in the history
  3. Test annotator CLI --replace-na-with-empty-string

    Test that --replace-na-with-empty-string replaces NA with "".
    
    Test that no --replace-na-with-empty-string does not replace NA with "".
    
    The --replace-na-with-empty-string does not need to be tested for column
    type conversions. The CLI write_tsv output table is the same even if a
    non-character column is converted to a character column before
    write_tsv, because "Values are only quoted if they contain a comma,
    quote or newline" (-- help("write_tsv", "readr") 1.3.1).
    logstar committed Jul 25, 2021
    Configuration menu
    Copy the full SHA
    dd72ce6 View commit details
    Browse the repository at this point in the history