Skip to content

Skalo - #86

Merged
johnlees merged 44 commits into
masterfrom
skalo
Feb 5, 2025
Merged

johnlees merged 44 commits into
masterfrom
skalo

Conversation

@jhellewell14

Copy link
Copy Markdown
Collaborator

Hello @johnlees and @rderelle

Started a new branch as it was easier.

  • Merged code from the latest version of skalo into src/skalo
  • Added new dependencies from skalo into Cargo.toml
  • Added new Ska command called indel (although this could be called skalo instead? I don't really mind)
  • ska indel -i file_name.skf runs the skalo code that was in skalo's main.rs. I have verified this works on the example file that @rderelle provided
image

Question now is whether you would like people to only run skalo on provided .skf files or whether you'd like them to pass a list of fasta/q files and ska runs build internally before running indel.

jhellewell14 added 2 commits January 16, 2025 11:40
…, fixed model calls in skalo code. Package builds successfully
…ow run ska indel -i file.skf to run skalo. Have verified this works on example data
@jhellewell14 jhellewell14 mentioned this pull request Jan 16, 2025
@rderelle

Copy link
Copy Markdown
Collaborator

@jhellewell14 @johnlees

Thanks. To answer your 2 questions:
_ the command should be named either 'skalo' or 'graph' (indels are not inferred at the moment). I personally prefer the latter but it is for John to decide.
_ I think running skalo on provided skf files is just fine (I wasn't planning otehrwise).

@johnlees

Copy link
Copy Markdown
Member

How about ska lo? But I also like ska graph

@rderelle

Copy link
Copy Markdown
Collaborator

I'm equally fine with both. Pros:
_ ska lo: reference to the original name of the program
_ ska graph: perhaps more explicit name for users

@simonrharris @Leonardini any preference?

@johnlees

Copy link
Copy Markdown
Member

Question now is whether you would like people to only run skalo on provided .skf files or whether you'd like them to pass a list of fasta/q files and ska runs build internally before running indel.

Thinking about this a bit more, I think it's ok to explicitly separate build here, as you'd always also be running align or map

@johnlees johnlees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Easy fixes throughout:

  • Use log not print
  • Remove commented code

We need to have a think about the following:

  • Using IntT instead of u128
  • Use ska functions where they are already available, and avoid duplication
  • Whether we should use a struct in skalo/lib.rs (like the other subcommands/submodules) to simplify the logic

We should also add some tests

Let me know any initial thoughts. If needed we can have a quick call to discuss futher, decide what's worth doing and what's not, who should do what

Comment thread Cargo.toml Resolved
Comment thread src/cli.rs Outdated
#[arg(long, default_value_t = DEFAULT_STRAND)]
single_strand: bool,
},
Indel {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add doc for the CLI help here with /// above

@rderelle Might be easiest if you or I update the help and API docs before merge

Comment thread src/cli.rs

/// reference genome for SNP positioning
#[arg(short = 'r', long, help_heading = "input")]
reference: Option<PathBuf>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be Option<String>, consistent with reference in ska map

Comment thread src/cli.rs Resolved
Comment thread src/cli.rs Resolved
Comment thread src/skalo/read_graph.rs Resolved
Comment thread src/skalo/read_graph.rs Outdated
.map(|(length, _)| length)
}

// structure to hold state for each path in the stack

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// structure to hold state for each path in the stack
/// Holds state for each path in the stack

Comment thread src/skalo/utils.rs Resolved
Comment thread src/skalo/utils.rs Resolved
Comment thread src/skalo/utils.rs Resolved
@jhellewell14

Copy link
Copy Markdown
Collaborator Author

Have pushed further commits that remove commented code and change println! to log::info! throughout. Have marked relevant comments as resolved and will leave the unresolved ones for @johnlees or @rderelle to make decisions on

@rderelle

Copy link
Copy Markdown
Collaborator

we can have a chat next week anytime if needed.

…e some of the input functions. I also removed Config and DataInfo as global variables and pass references to the struct to the correct functions
@jhellewell14

Copy link
Copy Markdown
Collaborator Author

I've pushed a lot of changes that address 1) making the skalo code generic over UInt instead of all using u128. I had to add many skalo functions as trait methods for the UInt trait, I suspect some of these may be duplicated based on their names but it would be good for @johnlees @rderelle to take a look.

I also removed CONFIG and DATAINFO as global variables and pass them as references to the structs as necessary.

@johnlees johnlees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is looking really close. I think we just need to harmonise the encoding/decoding between ska and skalo to make the latter consistent with what we're already using

Comment thread src/cli.rs Resolved
Comment thread src/lib.rs Resolved
Comment thread src/ska_dict/bit_encoding.rs Resolved
Comment thread src/ska_dict/bit_encoding.rs Resolved
Comment thread src/ska_dict/bit_encoding.rs Resolved
Comment thread src/skalo/utils.rs Resolved
Comment thread src/skalo/utils.rs Resolved
Comment thread src/skalo/utils.rs Resolved
Comment thread src/skalo/utils.rs Resolved
Comment thread src/skalo/utils.rs Resolved
@johnlees

Copy link
Copy Markdown
Member

@rderelle we think the only things now needed before this is ready:

  • Docs. Definitely a short usage for ska lo at the top of lib.rs. Ideally all public functions with some description as in the rest of the package. You can run cargo doc --open to view and/or see the warnings when building.
  • Testing. I'm not too worried about making codecov happy or writing unit tests, but at least one test which runs ska lo with some toy data and checks the results are as expected. This is done for build and map etc, you can copy one of those examples to get started

Are you ok to do those things, as you're probably best placed to know what's best?

@rderelle

Copy link
Copy Markdown
Collaborator

when running SKA lo, the message " skalo v0.4.0" appears. We should consider removing it for consistency with other SKA functions.

@codecov

codecov Bot commented Jan 31, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 86.28821% with 157 lines in your changes missing coverage. Please review.

Project coverage is 93.20%. Comparing base (fba2840) to head (be4862f).
Report is 45 commits behind head on master.

Files with missing lines Patch % Lines
src/skalo/process_variants.rs 74.55% 71 Missing ⚠️
src/skalo/positioning.rs 76.10% 38 Missing ⚠️
src/skalo/read_graph.rs 92.30% 16 Missing ⚠️
src/skalo/output.rs 92.98% 8 Missing ⚠️
src/cli.rs 40.00% 6 Missing ⚠️
src/lib.rs 80.76% 5 Missing ⚠️
src/skalo/compaction.rs 94.79% 5 Missing ⚠️
src/skalo/utils.rs 91.48% 4 Missing ⚠️
src/ska_dict/bit_encoding.rs 95.83% 2 Missing ⚠️
src/skalo/extremities.rs 94.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #86      +/-   ##
==========================================
- Coverage   96.07%   93.20%   -2.88%     
==========================================
  Files          16       24       +8     
  Lines        2803     3943    +1140     
==========================================
+ Hits         2693     3675     +982     
- Misses        110      268     +158     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@johnlees johnlees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rderelle This is really close to being done, just two things on the test:

  • It doesn't appear that any of the code in positioning.rs is being run. Can you add a second command which also provides a reference genome to run it?
  • You added an expected result (test_skalo_snps.fas) but never actually check it is the same as the output from the command in the test. You can use sandbox.file_check() to do this. If the column order can change from run to run, also see var_hash()

@rderelle

rderelle commented Jan 31, 2025 •

Copy link
Copy Markdown
Collaborator

@johnlees Ok, I will add a reference genome and positioning so that the output is an ordered SNP alignment that will always be the same.

I'm afraid I don't know how to use sandbox.file_check() (I can't find it in other test.rs files). Also, without '-i', '-o' and '-r' in the command line, how can it run without knowing which file is which?

@rderelle

Copy link
Copy Markdown
Collaborator

Reference genome added for SNP positioning and SNP alignment updated. SKA now always outputs the same ordered/oriented SNP alignment (tested multiple times on my laptop).

@johnlees
johnlees merged commit 3ce160e into master Feb 5, 2025
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.

3 participants