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

MRG: enable multithreaded sketching to zip file (manysketch) #88

Merged
merged 24 commits into from
Sep 7, 2023
Merged

Conversation

bluegenes
Copy link
Contributor

@bluegenes bluegenes commented Sep 2, 2023

Includes #96.

Enable manysketch to zipfile (that can then be used to make rocksdb index).

This PR adds:

  • write sourmash manifest for zipfile
  • handle identical md5sums (add _i to filenames and make sure it's reflected in the internal_location)
  • use param string(s) to allow the full range of sketch values.
  • take in sketch fromfile input
  • properly name sigs from sketch fromfile
  • adjust protein ksize*3 for proper prot sketching

Notes:

  • Adding a manifest required a bit more tricky thread handling (and use of Arc), since we need to collect all the manifest info from the signatures while looping, and then write the manifest at the end, just before closing the zip and joining the writer thread.
  • Only builds dna --> dna, protein--> protein sigs (not translated). Translated could be added in the future.
  • does not allow param string input from fromfile_csv

Usage

To run manysketch, you need to build a csv file with columns name,genome_filename,protein_filename (fa.csv, below). You can then run:

sourmash scripts manysketch fa.csv -o fa.zip

The output will be written to fa.zip

You can check if all signatures were written properly with

sourmash sig summarize fa.zip

To modify sketching parameters, use --param-str or -p and provide valid param string(s)

sourmash scripts manysketch fa.csv -o fa.zip -p k=21,k=31,k=51,scaled=1000,abund -p protein,k=10,scaled=200

@bluegenes bluegenes changed the title EXP: enable multithreaded manysketch (sketchall) within rust WIP: enable multithreaded manysketch (sketchall) within rust Sep 3, 2023
@bluegenes bluegenes changed the title WIP: enable multithreaded manysketch (sketchall) within rust WIP: enable multithreaded sketching to zip file (manysketch) Sep 4, 2023
@bluegenes bluegenes changed the title WIP: enable multithreaded sketching to zip file (manysketch) MRG: enable multithreaded sketching to zip file (manysketch) Sep 5, 2023
@bluegenes
Copy link
Contributor Author

@ctb ready for review

@ctb
Copy link
Collaborator

ctb commented Sep 5, 2023

nifty! will dig in later, but one request and one suggestion -

  • request: could you update the docs with some minimal execution info?
  • suggestion: could you give some benchmarks?

well, and a third thought - might be good to start an issue with upgrade suggestions, like "enable protein sketching" or whatever comes to mind.

bluegenes and others added 4 commits September 6, 2023 18:32
* manifest writing working! need to fix format, though

* closer but still not right

* working manifest!!!

* param_str working, except for protein?

* upd test; add manifest test

* fix moltype manifest write

* mult params; ensure only unique param combinations

* upd test

* add some usage docs

* better wording

* a few more param checks

* keep duplicated md5sum sigs

* working csv read, but only using genome_filename

* working csv read with dna and protein files

* ignore duplicated rows, add prot tests

* handle protein ksize *3

* upd doc for csv instead of txt

* fix basename for test

* force past Ns in dna sequence

* eprintln instead of error, given no env_logger

* also check csv header

* prettier print err

* skip incompatible fastas entirely

* better reporting

* round reporting percentage
@ctb ctb merged commit 0488bd6 into main Sep 7, 2023
1 check passed
@ctb ctb deleted the try-sketch branch September 7, 2023 01:43
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.

2 participants