parulsharma
    • 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 New
    • 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 Note Insights Versions and GitHub Sync 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ICPPB 2024 Workshop: === ###### (Meta)Genomics for pathogen identification Metagenome classification using custom taxonomy databases created with LINtax === ###### Parul Sharma ###### July 2024 In this tutorial we will cover: [TOC] ## LINtax LINtax creates LIN (Life identification number) based taxonomy files for any given list of input genomes. Instead of traditional ranks, LIN-taxonomy is based on 20 thresholds/ranks of average nucleotide identity (ANI). These thresholds of similarity ranges from 70%-99.999%. The current default implementation of LIN thresholds are outlined below: ![image](https://hackmd.io/_uploads/r14M0HUwR.png) Traditional taxonomy considers 'species' as the lowest rank which corresponds to approximately 95% ANI. However, with LIN-taxonomy you get much more resolution and 14 more ranks at the sub-species level which allows for accurate outbreak level detection of pathogens. #### Creating custom taxonomy with LINtax Metagenome classifiers use taxonomy to improve classifications by reducing errors due to genome similarity. All taxonomic classifiers (metagenome classifiers that use taxonomy) make use of the NCBI Taxonomy database which retains the information in 2 files: `names.dmp` : stores all tax ranks and their names `nodes.dmp` : stores all the heirarchial relations between different ranks Using LINtax, users can create this taxonomy file structure for their list of input. Example input-file looks omething like this: | LIN | Species | Strain | FileName | Accession | |-----------------------------------|----------------------|-----------|--------------------------------------------------|-----------------| | 14,1,0,0,0,0,0,0,0,0,6,0,1,0,1,0,0,0,0,0 | Ralstoniasolanacearum | OE1_1 | GCF_001879565.1_ASM187956v1_genomic.fna | GCF_001879565.1 | | 14,1,0,0,0,0,0,0,0,0,6,0,1,0,0,0,0,0,0,0 | Ralstoniasolanacearum | PSS1308 | GCF_001870805.1_ASM187080v1_genomic.fna | GCF_001870805.1 | | 14,1,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0 | Ralstoniasolanacearum | FJAT_1458 | GCF_001887535.1_ASM188753v1_genomic.fna | GCF_001887535.1 | | 14,1,0,0,0,0,0,0,0,0,2,0,0,4,4,0,0,0,0,0 | Ralstoniasolanacearum | Pe_13 | GCF_012062595.1_ASM1206259v1_genomic.fna | GCF_012062595.1 | The current implementation of LINtax works with [Kraken2](https://github.com/DerrickWood/kraken2/wiki/Manual) and [krakenuniq](https://github.com/fbreitwieser/krakenuniq). #### Workflow for analysis ```mermaid graph LR create-taxonomy --> build-db --> classify --> report ``` [Click here](https://github.com/parul-sharma/LINtax) for more information. ## Ralstonia Case study :::info Can we detect the pathogen in a metagenome? Can we identify the correct strain? ::: We will use a pre-computed database to analyze 3 plant metagenome samples. The pre-computed database was build as a [kraken2](https://github.com/DerrickWood/kraken2/wiki/Manual) database using LIN-taxonomy structure with [lintax](https://github.com/parul-sharma/LINtax). To set-up everything for this tutorial: 1. Download the database using: - Kraken2 database ``` wget -O kraken2-db.tar.gz https://osf.io/u4tq8/download ``` - Extract the contents of the file : ``` tar xvf kraken2-db.tar.gz ``` 2. Download the rest of set-up : ``` git clone https://github.com/parul-sharma/LINtax.git ``` - Download lingroups file ``` wget -O LINgroups.txt https://osf.io/download/nqms2/ ``` - Download the samples: download Sample-0 wget -O Sample-0.fasta https://osf.io/r72cv/download - download Sample-II ``` wget -O Sample-II.fasta https://osf.io/xvytc/download ``` - download Sample-IV ``` wget -O Sample-IV.fasta https://osf.io/g4krs/download ``` With everything set-up. We can now analyze our samples. ### Lets start with sample-0 since we have the pre-computed database, we can directly use the 'classify' function to classify the sample (We can also directly use kraken2 commands to classify and then use lintax report to get the final report): :::info Sample-0: ::: Let's see what the input requirements are: ``` lintax classify -h ``` ``` ---------------------------------------------------------------------------------------- LINtax: Create custom taxonomy for metagenome classification ---------------------------------------------------------------------------------------- Usage: lintax classify [options] <input_files> Options: --db LINtax Database to use for classifications (make sure to run build before this step) [REQUIRED] --lins Text file containing lingroups (custom taxa) and their LIN prefixes [REQUIRED] -o or --output LINreport containing the results [REQUIRED] -h or --help Show usage Other options: -c or --confidence Specify the confidence threshold for kraken classification [optional] --paired For paired-end reads Example: for single reads - lintax classify --db /database/ --lins linfile.txt -o sample-results.tsv <sample.fastq> for paired reads - lintax classify --db /database/ --lins linfile.txt -o sample-results.tsv --paired <sample_1.fastq> <sample_2.fastq> ``` This tells us that we need the 'db', 'lins' and sepcify the output file. Let's analyze our sample: ``` lintax classify --db kraken2-db --lins LINgroups.txt -o sample0.LINreport -c 0.1 Sample-0.fasta ``` ``` Loading database information... done. 9204 sequences (37.44 Mbp) processed in 2.539s (217.5 Kseq/m, 884.81 Mbp/m). 0 sequences classified (0.00%) 9204 sequences unclassified (100.00%) ``` The above command shows that 0 sequences in our sample were classified. This is because Sample-0 is our control sample without any pathogenic reads! :::success Sample 0 : Control : No pathogenic reads detected! ::: This is what the final LINreport for this sample looks like (with no classification): ``` LINgroup_Name LINgroup_prefix Assigned_reads Percentage_assigned_reads Unique_Assigned_reads Percentage_unique_assigned_reads Total_reads_length A_Total_reads;B_PhylI 14,1,0,0,0,0,0,0,0,0 A_Total_reads;B_PhylI;C_seq14 14,1,0,0,0,0,0,0,0,0,3 A_Total_reads;B_PhylI;C_seq15 14,1,0,0,0,0,0,0,0,0,2 A_Total_reads;B_PhylI;C_seq34 14,1,0,0,0,0,0,0,0,0,6 A_Total_reads;B_PhylII 14,1,0,0,0,3,0 A_Total_reads;B_PhylII;C_IIA 14,1,0,0,0,3,0,1 A_Total_reads;B_PhylII;C_IIC 14,1,0,0,0,3,0,2 A_Total_reads;B_PhylII;C_IIB 14,1,0,0,0,3,0,0 A_Total_reads;B_PhylII;C_IIB;D_seq1&seq2 14,1,0,0,0,3,0,0,0,0,1,0,0,0,0 ``` :::info Adding -c (or --confidence) option is important! A '0.1' score equates to 10% confidence threshold and tells kraken2 to only accept those taxonomic ranks where this confidence threshold is met. [Read more about confidence thresholds] (https://github.com/DerrickWood/kraken2/wiki/Manual#confidence-scoring) For LINtax, in general, recommended confidence threshold is 0.1 for long reads and 0.3-0.4 for short reads. ::: ### Now let's look at `sampleII` We can run the same classify command to run sampleII with -c 0.1. ``` lintax classify --db kraken2-db --lins LINgroups.txt -o sampleII.LINreport -c 0.1 Sample-II.fasta ``` ``` Loading database information... done. 9204 sequences (37.73 Mbp) processed in 3.188s (173.2 Kseq/m, 710.08 Mbp/m). 812 sequences classified (8.82%) 8392 sequences unclassified (91.18%) ``` The output indicates that 812 reads (8.2%) were classified. Let's look at the LINreport to see what taxonomcic lineages were identified. ###### using `awk '$3 != 0'` to only select for those taxa where assigned reads were more than 0. ``` cat sampleII.LINreport | awk '$3 != 0' ``` ``` LINgroup_Name LINgroup_prefix Assigned_reads Percentage_assigned_reads Unique_Assigned_reads Percentage_unique_assigned_reads Total_reads_length A_Total_reads;B_PhylII 14,1,0,0,0,3,0 732 90.14778325123153 598 73.64532019704434 5557909 A_Total_reads;B_PhylII;C_IIB 14,1,0,0,0,3,0,0 134 16.502463054187192 79 9.729064039408868 708286 A_Total_reads;B_PhylII;C_IIB;D_seq1&seq2 14,1,0,0,0,3,0,0,0,0,1,0,0,0,0 16 1.9704433497536946 14 1.7241379310344827 115923 A_Total_reads;B_PhylII;C_IIB;D_seq1&seq2;E_seq1 14,1,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0 2 0.24630541871921183 2 0.24630541871921183 13897 Total_reads 812 ``` We see that all assigned reads follow the same taxonomic lineage-- leading to Phylotype II sequevar1 !!! This is our infected sample with the Select Agent pathogen! :::success Sample-II: Pathogenic sample; Select Agent Ientified! ::: ### Now let's look at sampleIV ``` lintax classify --db kraken2-db --lins LINgroups.txt -o sampleIV.LINreport -c 0.1 Sample-IV.fasta ``` ``` Loading database information... done. 9204 sequences (37.91 Mbp) processed in 3.206s (172.3 Kseq/m, 709.57 Mbp/m). 789 sequences classified (8.57%) 8415 sequences unclassified (91.43%) ``` We see that 789 reads (8.57% ot total) were classified for this sample. Let's look at the LINreport to see what taxonomcic lineages were identified. ``` cat sampleIV.LINreport | awk '$3!=0' ``` ``` LINgroup_Name LINgroup_prefix Assigned_reads Percentage_assigned_reads Unique_Assigned_reads Percentage_unique_assigned_reads Total_reads_length A_Total_reads;B_PhylIV 14,1,0,0,0,2,0,0,0 585 74.1444866920152 483 61.21673003802282 4654046 A_Total_reads;B_PhylIV;C_seq10 14,1,0,0,0,2,0,0,0,0,0,0 102 12.927756653992395 74 9.37896070975919 680687 Total_reads 789 ``` We find in this sample, all assigned reads follow the taxonomic lineage of Phylotype IV, sequevar 10 group --> This is not a Select agent pathogen. :::success Sample-IV: Pathogenic sample, but not Select Agent. :::

    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