C. Titus Brown
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: stamps2025 --- # Metagenomics intro IV: comprehensive metagenome content analysis and the challenge of bacterial strains (STAMPS 2025) Titus Brown July 17, 2025 ## Identifying _all_ overlapping genomes for a metagenome ``` conda activate sourmash mkdir -p ~/day3 cd ~/day3 sourmash prefetch -k 51 --scaled 10_000 \ /opt/shared-2/sourmash-mgx/SRR11125891.sig \ /opt/shared-2/sourmash-db/gtdb-rs226.k51.rocksdb \ -o SRR11125891.prefetch.csv ``` This calculates _all_ overlaps between the metagenome and the database, and will... take a few minutes. How many matches are there? Why, and what's going on? :sob: ## The challenge of bacterial strains! Let's take a step back, and look at one particular species - the one we chose to map to, which in NCBI land is `Methanobrevibacter smithii`, but in GTDB-land is known as `s__Methanocatella`. Let's pull out all the genome names that GTDB says belong to `s__Methanocatella`: ``` sourmash tax grep s__Methanocatella \ -t /opt/shared-2/sourmash-db/gtdb-rs226.lineages.csv \ -o methano.tax.csv ``` How many do we get? 349! Now let's grab these 349 genome sketches: ``` sourmash sig cat --picklist methano.tax.csv:ident:identprefix \ /opt/shared-2/sourmash-db/gtdb-rs226.k31.sig.zip \ -o methano.k31.sig.zip ``` and compare them: ``` sourmash compare methano.k31.sig.zip -o methano.cmp sourmash plot methano.cmp ``` Check out `methano.cmp.matrix.png` - what do we see? Let's ask how many of these match to our metagenome: ``` sourmash scripts manysearch \ methano.k31.sig.zip \ /opt/shared-2/sourmash-mgx/SRR11125891.sig \ -o SRR11125891.methano.manysearch.csv ``` and plot that presence diagram... ``` sourmash scripts presence_filter \ SRR11125891.methano.manysearch.csv \ -o SRR11125891.methano.presence.png \ -N 0 \ --detection-column-name containment ``` You will see this - what does it mean?? ![SRR11125891.methano.presence](https://hackmd.io/_uploads/H1-N2T8Ugx.png) ## Identifying a _usefully small_ set of overlapping genomes for a metagenome What 'gather' does is choose a minimal set of genomes necessary to represent the known content. It does that by (essentially) taking the genome with the largest fraction detected, and then removing anything that overlaps with it: a "greedy" approach of taking the best match, first. Let's run it again: ``` conda activate sourmash sourmash gather -k 51 --scaled 10_000 \ /opt/shared-2/sourmash-mgx/SRR11125891.sig \ /opt/shared-2/sourmash-db/entire-2025-07-11.k51.rocksdb \ --threshold-bp=0 \ -o SRR11125891.t0.gather.csv ``` Next, to illustrate the method of taxonomy construction, we're going to run `sourmash tax annotate`, which annotates the CSV file with taxonomic lineages: ``` sourmash tax annotate -g SRR11125891.t0.gather.csv \ -t /opt/shared-2/sourmash-db/entire-2025-07-11.lineages.sqldb ``` Check out our new file `SRR11125891.t0.gather.with-lineages.csv` - how does this differ from `SRR11125891.t0.gather.csv`? Hint - look at the last column... And finally we're going to run `taxburst` on it: ``` conda activate taxburst taxburst -F tax_annotate \ SRR11125891.t0.gather.with-lineages.csv \ -o SRR11125891.t0.taxburst.html ``` :::danger If `conda activate taxburst` doesn't work, you may need to run: ``` conda create -n taxburst -y python=3.12 ``` followed by ``` conda activate taxburst pip install -U taxburst ``` to install taxburst. Then run the taxburst command above. ::: ### Looking at the taxburst view Open the taxburst file. What we did was bring in all the genome level information - this is a pretty busy diagram, what with ~1500 genomes on it! Try decreasing the max depth here ;). ## What are other ways to deal with massive strain overlap? A common way to deal with genomes that have lots of shared sequence is to dereplicate them to "species representatives". This is an approach that GTDB uses to produce it's "reps" database, and it's also something that MetaPhlan and others do. I'm not sure I understand the consequences of doing things this way, however. But it's still an evolving field. ## Annotated bibliography Mash: fast genome and metagenome distance estimation using MinHash, Ondov et al. [link](https://genomebiology.biomedcentral.com/articles/10.1186/s13059-016-0997-x) The OG "let's use clever techniques to compare genomes using a subset of k-mers" paper that inspired sourmash :). Lightweight compositional analysis of metagenomes with FracMinHash and minimum metagenome covers, Irber et al., 2023. [link](https://www.biorxiv.org/content/10.1101/2022.01.11.475838v2). This is the core sourmash paper that explains how sourmash works and what 'sourmash gather' does.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully