shaunpwilkinson / aphid

Analysis with Profile Hidden Markov Models
21 stars 4 forks source link

Added subsetPHMM function #6

Open CNuge opened 4 years ago

CNuge commented 4 years ago

Hi @shaunpwilkinson ,

I completed the code for the proposed addition (#5). Thanks for the help with understanding the object components. As you will see I've now included code for sub-setting all the relevant parts of the input PHMM. Please note that for the E, A, insertlengths, and map fields I reindex the names to correspond to the positions in the output PHMM object (i.e. the first profile position in the output PHMM is labelled position 1, as opposed to carrying through the labels of the previous profile). I figured having PHMM that don't start at position 1 could cause some issues or confusion. If you disagree the lines in the function using names and colnames can be eliminated.

I've elected to make subsetPHMM a standalone function for simplicity. If desired, you could alter this to make it a method for the PHMM class instead.

Thanks! Feel free to make any other alterations you deem necessary. No rush at all, but if/when you end up pushing the updated version of aphid to CRAN please let me know so that I can incorporate the updates into my own tools.

codecov-io commented 4 years ago

Codecov Report

Merging #6 into master will increase coverage by 0.12%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #6      +/-   ##
==========================================
+ Coverage   63.72%   63.85%   +0.12%     
==========================================
  Files          19       20       +1     
  Lines        4546     4498      -48     
==========================================
- Hits         2897     2872      -25     
+ Misses       1649     1626      -23
Impacted Files Coverage Δ
R/subsetPHMM.R 100% <100%> (ø)
R/generate.R 81.81% <0%> (-2.8%) :arrow_down:
R/derivePHMM.R 68.6% <0%> (-1.02%) :arrow_down:
R/align.R 66.76% <0%> (-0.48%) :arrow_down:
R/utils.R 42.48% <0%> (-0.38%) :arrow_down:
R/train.R 65.64% <0%> (-0.33%) :arrow_down:
src/ViterbiC.cpp 64.52% <0%> (-0.16%) :arrow_down:
src/utils.cpp 98% <0%> (-0.04%) :arrow_down:
R/print.R 0% <0%> (ø) :arrow_up:
src/map.cpp 100% <0%> (ø) :arrow_up:
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5860e69...97baf2a. Read the comment docs.