chasewnelson / SNPGenie

Program for estimating πN/πS, dN/dS, and other diversity measures from next-generation sequencing data
GNU General Public License v3.0
100 stars 37 forks source link

sliding_window script requires different headers than between_group output file generates #52

Open passdan opened 3 years ago

passdan commented 3 years ago

Hi! Have been running SNPgenie for a while and now testing the sliding_window script however have come across a few issues. See attached the file I'm attempting to use for testing, with the following command: Rscript SNPGenie_sliding_windows.R between_group_codon_results.txt N S 40 1 1000 50 NONE 6 > btw_test.txt between_group_codon_results.txt

The first two issues are labeling bugs, the third I can't work out but I'm wondering if it just doesn't like the between_group output file? I'd be interested to know if you can reproduce this, and what could be going on? Thanks!

  1. 1: Unknown or uninitialised column: codon_num.

This occurs because the column in the file outputted by betweengroup testing is named just 'codon'. Renaming the column in the output file passes this.

  1. Error: Problem with `filter()` input `..1`.
    ℹ Input `..1` is `num_defined_seqs >= MIN_DEFINED_CODONS`.
    ✖ object 'num_defined_seqs' not found

    Again, column name issue. I changed the line to match on heading, but not a proper fix

    #codon_data_filtered <- filter(codon_data, num_defined_seqs >= MIN_DEFINED_CODONS)
    codon_data_filtered <- filter(codon_data, num_defined_codons_g1 >= MIN_DEFINED_CODONS)
  2. Here I can't identify the issue.

    Error: Assigned data `*vtmp*` must be compatible with existing data.
    ℹ Error occurred for column `sw_start`.
    ✖ Can't convert <character> to <double>.
    Backtrace:
     █
    1. ├─base::`[<-`(...)
    2. ├─tibble:::`[<-.tbl_df`(...)
    3. │ └─tibble:::tbl_subassign(x, i, j, value, i_arg, j_arg, substitute(value))
    4. │   └─tibble:::tbl_subassign_row(x, i, value, value_arg)
    5. │     ├─base::withCallingHandlers(...)
    6. │     └─vctrs::`vec_slice<-`(`*tmp*`, i, value = value[[j]])
    7. │       └─(function () ...
    8. │         └─vctrs::vec_default_cast(...)
    9. │           └─vctrs::stop_incompatible_cast(...)
    10. │             └─vctrs::stop_incompatible_type(...)
    11. │               └─vctrs:::stop_incompatible(...)
    12. │                 └─vctrs:::stop_vctrs(...)
    13. │                   └─rlang::abort(message, class = c(class, "vctrs_error"), ...)
    14. │                     └─rlang:::signal_abort(cnd)
    15. │                       └─base::signalCondition(cnd)
    16. └─(function (cnd) ...
    Execution halted
singing-scientist commented 3 years ago

Greetings @passdan ! Apologies, as this script is brand new and not yet tested on the between-group output. I would be very happy to fix the bugs and update both the script and documentation — would you be willing to provide an example output file? Let me know!

Chase

passdan commented 3 years ago

Hi Chase

Thanks! Yep, I can see it's still all under development but works great so far!

There's a between_group_codon_result.txt file attached above but I think it's got hidden. Attaching here:

between_group_codon_results.txt

Regards, Dan

singing-scientist commented 3 years ago

Thanks again for your patience and for testing this out on the between group results! I have substantially updated the sliding window script for use with all three codon result types — pooled, within-group, and between-group. I tried to anticipate a few problems and added some extra checks and errors or warnings. Please re-download and let me know if it works for you.

Yours, Chase

passdan commented 3 years ago

Thanks for this Chase, I'll have some tests as soon as possible and see how it all goes!