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

Updated script to current sourmash api (4.8.3) #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ccbaumler
Copy link

Tiny changes to the get-accessions-from-sbt.py file for building LCA tables. Now it works!

@@ -12,13 +12,13 @@ def main():
p.add_argument('-o', '--output', type=argparse.FileType('wt'))
args = p.parse_args()

db = sourmash_lib.load_sbt_index(args.sbt)
db = sourmash.load_file_as_index(args.sbt)

for n, leaf in enumerate(db.leaves()):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for n, leaf in enumerate(db.leaves()):
for n, leaf in enumerate(db.signatures()):

this should make it work for any sourmash database, not just SBTs. But also for SBTs :)

Oh, and you'd need to change leaf.data.name to just leaf.name, since leaf would now be a SourmashSignature object.

Probably better to just rename leaf to ss or something.

Copy link
Member

Choose a reason for hiding this comment

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

you could also grab db.manifest and iterate over rows; each element in rows is a dictionary containing row['name'] which will give you the info you want here, without actually loading the underlying sketch data.

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