Tracy Teal
    • 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
    # STAMPS mothur commands **This document is the commands that we'll run in mothur during the tutorial** 1. Log on to the MBL campus machines ``` ssh username@class.mbl.edu ssh username@class-host ``` 2. Create a directory for this tutorial and go into that directory. ``` mkdir mothur_tutorial cd mothur_tutorial ``` 3. Copy the data needed for the tutorial into this directory and go into that directory. ``` cp -r /class/stamps-shared/mothur_data . cd mothur_data ``` 4. Unzip the files and move a few files around ``` unzip MiSeqSOPData.zip unzip Trainset9_032012.pds.zip unzip Silva.bacteria.zip # move the silva.bacteria.fasta file to this directory mv silva.bacteria/silva.bacteria.fasta MiSeq_SOP/ # move the training set data into the MiSeq directory mv trainset9_032012.pds.* MiSeq_SOP/ ``` 5. Go into the MiSeq_SOP directory ``` cd MiSeq_SOP ``` 6. Start mothur version ``` module load mothur/1.39.5 mothur ``` ### mothur SOP Now we'll generally follow the mothur MiSeq SOP [https://www.mothur.org/wiki/MiSeq_SOP](https://www.mothur.org/wiki/MiSeq_SOP) The following commands will be at the 'mothur' command line ``` mothur > ``` 1. We have paired end data from this sequencing, so the first thing we'll do is assemble the pairs together to make contigs. The file **stability.files** is the file that has the information about what pairs go together and what the sample name is. We use the infromation in that file to do the assembling. If you have all your data in one directory and the beginning of your sequence name is something meaningful, you can use the mothur command ```make.file``` to create that file. Or you can create it by hand or another script. Here we'll start with that file to make the contigs. ``` make.contigs(file=stability.files, processors=8) ``` 2. Get information about the files ``` summary.seqs(fasta=stability.trim.contigs.fasta) ``` 3. Sequences should be about 250 base pairs, so we want to get rid of any sequence that are too long because they are likely errors. Also, work here at the Bay Paul Center showed that if there are any ambiguous base pairs in the sequence it's likely to be poor quality, so we'll remove sequences that have ambiguous base pairs. ``` screen.seqs(fasta=stability.trim.contigs.fasta, group=stability.contigs.groups, maxambig=0, maxlength=275) ``` 4. Here we'll type out the names of the files in the commands, but mothur remembers that last time you defined a particular variable, like the fasta file. You can see the current state of that memory with ```get.current```. ``` get.current() ``` 5. To make things easier to process, we want to reduce the number of sequences we're working with. There are a lot of repeated sequenes, so, we can just keep the unique sequences in the FASTA file we're working with, and create a new file where we keep track of how many times we see these unique sequences in each sample. We'll use this information at the end when we're calculating the number of times we see each OTU in each sample. ``` unique.seqs(fasta=stability.trim.contigs.good.fasta) count.seqs(name=stability.trim.contigs.good.names, group=stability.contigs.good.groups) ``` 6. See a summary ``` summary.seqs(count=stability.trim.contigs.good.count_table) ``` 7. The next step is to align these sequences to a reference. We have the reference from Silva, but it's the full length of the 16S gene, and we don't need all that. So we're going to create a shorter version of the reference to use for the next steps. Because we know the primers we used, we know our sequence is between positions 11894 and 25319. ``` pcr.seqs(fasta=silva.bacteria.fasta, start=11894, end=25319, keepdots=F, processors=8) ``` 8. Now align our sequences to this reference and look at summary.seqs. We see that now our sequences have different start and end points, because they're aligned onto this reference. ``` align.seqs(fasta=stability.trim.contigs.good.unique.fasta, reference=silva.bacteria.pcr.fasta) summary.seqs(fasta=stability.trim.contigs.good.unique.align, count=stability.trim.contigs.good.count_table) ``` 9. We're just going to keep the sequences that meet our expectations with alignment and aren't too short. We're also going to eliminate any sequences that have homopolymers longer than 8 because they are likely erroneous. ``` screen.seqs(fasta=stability.trim.contigs.good.unique.align, count=stability.trim.contigs.good.count_table, summary=stability.trim.contigs.good.unique.summary, start=1968, end=11550, maxhomop=8) summary.seqs(fasta=current, count=current) ``` 10. Filter the sequences to remove any overhangs at the end and any columns that only contain a gap in all the sequences. ``` filter.seqs(fasta=stability.trim.contigs.good.unique.good.align, vertical=T, trump=.) ``` 11. Now that things are aligned, we might have more identical sequences, so run unique.seqs again. ``` unique.seqs(fasta=stability.trim.contigs.good.unique.good.filter.fasta, count=stability.trim.contigs.good.good.count_table) ``` 12. Pre-cluster the sequences. Basically identifying sequences that are only 2 or fewer base pairs different. Speeds things up since clustering has more than this many differences anyway. ``` pre.cluster(fasta=stability.trim.contigs.good.unique.good.filter.unique.fasta, count=stability.trim.contigs.good.unique.good.filter.count_table, diffs=2) ``` 13. Look for chimeric sequences. Here's we'll use 'uchime' for the chimera algorithm, but there are several. The mothur SOP uses 'vsearch'. ``` chimera.uchime(fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.fasta, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.count_table, dereplicate=t) ``` 14. Remove the sequences identified as chimeric ``` remove.seqs(fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.fasta, accnos=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.accnos) summary.seqs(fasta=current, count=current) ``` 15. Classify the sequences. We want to identify any that are classifying outside bacteria, since that's not what the primers are supposed to amplify, so those sequences should be removed. ``` classify.seqs(fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.fasta, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.count_table, reference=trainset9_032012.pds.fasta, taxonomy=trainset9_032012.pds.tax, cutoff=80) ``` 16. Remove those undesirable sequences ``` remove.lineage(fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.fasta, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.count_table, taxonomy=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pds.wang.taxonomy, taxon=Chloroplast-Mitochondria-unknown-Archaea-Eukaryota) summary.tax(taxonomy=current, count=current) ``` 17. **A bit of a side note:** Assessing error rates. We can use the Mock community data to assess error rates, because we know how many unique sequences we should expect. First, pull out just the Mock community sequences. ``` get.groups(count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.pick.count_table, fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.fasta, groups=Mock) ``` 18. Check the error rate ``` seq.error(fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.fasta, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.pick.pick.count_table, reference=HMP_MOCK.v35.fasta, aligned=F) ``` 19. We can also do our OTU clustering for just these sequences to see how many OTUs we have found in the mock community. (We expect 20) ``` dist.seqs(fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.fasta, cutoff=0.03) cluster(column=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.dist, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.pick.pick.count_table) make.shared(list=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.opti_mcc.list, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.pick.pick.count_table, label=0.03) rarefaction.single(shared=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.opti_mcc.shared) ``` 20. **Back to our regular workflow** Remove the Mock community data, because we don't want that in our community analysis. ``` remove.groups(count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.pick.count_table, fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.fasta, taxonomy=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pds.wang.pick.taxonomy, groups=Mock) ``` 21. Create a distance matrix. This will be used for clustering. ``` dist.seqs(fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.fasta, cutoff=0.03) ``` 22. Cluster the sequences. We'll use 'cluster-split'. ``` cluster.split(fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.fasta, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.pick.pick.count_table, taxonomy=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pds.wang.pick.pick.taxonomy, splitmethod=classify, taxlevel=4, cutoff=0.03) ``` 23. Create a file with that has the OTUs in each group. ``` make.shared(list=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.opti_mcc.unique_list.list, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.pick.pick.count_table, label=0.03) ``` 24. We likely want to know who these OTUs are , so we can classify the sequences ``` classify.otu(list=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.opti_mcc.unique_list.list, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.denovo.uchime.pick.pick.pick.count_table, taxonomy=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pds.wang.pick.pick.taxonomy, label=0.03) ``` 25. Now we want to know how many sequences we have in each sample. ``` count.groups(shared=current) ``` 26. We use this information to do sub-sampling. *Insert discussion on sub-sampling*. Create a sub-sampled file for our further OTU analyses. ``` sub.sample(shared=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pick.pick.opti_mcc.unique_list.shared, size=2436) ``` 27. Now we've created a 'shared' file which is the name of each sample as rows and each OTU as a column. In each cell is the count of the number of times that OTU was found in that sample (after sub-sampling). We can use this file for further statistical analysis. This is the shared file that we produced: [stability.shared](https://raw.githubusercontent.com/tracykteal/mothur-tutorial/gh-pages/stability.shared) (Right or control click to download) This is a subsampled file: [subsampled.shared](https://raw.githubusercontent.com/tracykteal/mothur-tutorial/gh-pages/subsampled.shared) Let's take a look at these files. You can get them from the server, or download them from here. ### Running mothur in batch mode Once you’ve run through mothur with your shiny new data, you’re get to a point where you’re happy with a certain set of parameters. Now you might want to set mothur up in batch mode. That’s where you make a file with a bunch of commands and then just run that file. We have one of those files already in our data directory: stability.batch When you’re doing this the fact that mothur remembers what files you used last is great, because you don’t have to type it all out. Let’s try making our own. We’ll go back on the server and use nano. ``` nano mothur_script.m ``` Put the first couple of commands we run in to a file, along with comments about what we are doing. ``` # make contigs make.contigs(file=stability.files, processors=8) # screen the data screen.seqs(fasta=stability.trim.contigs.fasta, group=stability.contigs.groups, maxambig=0, maxlength=275) ``` We’re using the ‘full path’ of the file names here so there’s no confusion. Now we run the file ``` mothur mothur_script.m ``` This will run all the commands in the file one after the other. Hooray! We don't have to sit around to wait to run them one at a time. This also is particularly important if you're submitting jobs on a HPC. ### What to do with a shared file? What questions do you want to ask about your data? Discussion on the types of questions people have ### How can we go about answering these questions and doing data exploration? Lots of the techniques we're learning in this class! R is particularly powerful for data analysis, explortion and visualization. For a quick overview, there's a statistical package called PAST. [Download it here](https://folk.uio.no/ohammer/past/) - We can take our shared file and bring it into PAST. - We need to do some things to our data to be able to do this though. We need to remove a couple of columns and add labels.

    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