CBG Genetics
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
    • 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 No publishing access yet

      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.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      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
    • Make a copy
    • Transfer ownership
    • Delete this note
    • 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 Help
Menu
Options
Make a copy 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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
  • 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- title: OLD HybSeq Protocol tags: HybSeq --- # Chicago Botanic Garden Lab HybSeq Protocol ![Hybpiper wiki](https://raw.githubusercontent.com/wiki/mossmatters/HybPiper/img/HybPiper_Infographic.png) #### Go to the HybPiper wiki here: [Hybpiper Wiki](https://github.com/mossmatters/HybPiper) ## Step 1: Get Familiar with the Server This is where your data is stored and analysis will be run Instruction for[ CBG Server](https://docs.google.com/document/d/1ZBrGCZjWsCS2B3qS80d3i5OF2j999T47GHZCIYLZD7A/edit?usp=sharing) ## Step 2: Check the quality of your data We do this using [Fast QC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/) and MultiQC Example Reports: * Good Illumina Data * Bad Illumina Data * Adapter dimer contaminated run * Small RNA with read-through adapter * Reduced Representation BS-Seq * PacBio * 454 **1)** To use we will need to start by installing miniconda 2 (latest version is miniconda 3, but this installs python3, which is not compatible with hybpiper, so we need miniconda) ```bash= ! yes ``` Answer ‘YES’ to prompts and it will install, and close terminal window and re-open, log back in **:warning: If you don't allow the initilization (by typing "yes") when prompted, you will not be able to use conda without manually starting the initilizer. To manually start the initializer do the following:** ```bash= ! source /home/<username>/miniconda2/bin/activate conda init ``` Now conda is the base environment so you should see the following whenever you login to the server: ```bash= (base) [<username>@Fabronia ~]$ ``` **2)** To install FastQC, type ```bash= ! - /conda install -c bioconda fastqc ``` **3)** Then go to your home directory with the samples and make a new folder to hold the reports. For the [name] you may call it whatever you'd like, e.g. `cd /home/fastqc/`. ```bash= ! cd /home/[name]/ mkdir fastqc ``` **4)** To run FastQC on one sample: ```bash= ! fastqc [sample name].fastq.gz --outdir=fastqc/ ``` `--outdir=fastqc/` is how you tell FastQC where to put the output files. Make sure to put the name of the folder you created in step 3. This will produce an HTML and a zip file, both containing the same contents. Opening the HTML file will open a webpage containing the FastQC information. Details on what each section means can be found **[here](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/Help/)**. **5\)** To run FastQC on a whole folder of samples: ```bash= ! fastqc *.fastq.gz --outdir=fastqc/ ``` The `*` simply refers to run the command on any file that ends in `.fastq.gz`. Also, if you'd like to be able to screen the operation, you can type `screen fastqc *.fastq.gz --outdir=fastqc/`. ## Step 3: Trim data to just quality read (TRIMMOMATIC) **Trimmomatic** is a tool that is used to trim the ends of our reads. You can specify what to trim, such as the adapters, leading/trailing base pairs with low quality reads, etc. Read more on the <i class="fa fa-github"></i> ++[trimmomatic github page](https://github.com/usadellab/Trimmomatic)++. ### Installing Trimmomatic Installing trimmomatic is as simple as downloading it from ++[their website](http://www.usadellab.org/cms/?page=trimmomatic)++. Download the ++binary++ version of their most recent release, and extract it to wherever you'd like. ### Using Trimmomatic **1\)** Run 1 accession (R1 and R2) to test trimmomatic using the following: ```bash= ! $ java -jar /[path to trimmomatic folder]/trimmomatic-0.39.jar PE -phred33 [input file 1] [input file 2] [output file 1] [output file 2] [output file 3] [output file 4] ILLUMINACLIP:/[path to trimmomatic folder]/adapters/[specific adapter]:2:30:10 LEADING:3 TAILING:3 SLIDINGWINDOW:5:20 MINLEN:36 ``` - The input file names must follow a naming convention - *_R1_001.fastq *and* *_R2_001.fastq - *.f.fastq *and* *.r.fastq - *.1.sequence.txt *and* *.2.sequence.txt - The specific adapter to insert in the `[specific adapter]` field depends on what was used in the sequencing lab. In my case we used `TruSeq3-PE.fa`. :::spoiler > Trimmomatic Arguments - `-threads 6` tells trimmomatic how many CPU threads to use - `-phred33` refers to the quality metric that the reads use - `LEADING:3, TRAILING:3` tells trimmomatic to cut off the first and last 3 nucleotides - `SLIDINGWINDOW:5:20` tells trimmomatic to perform a sliding window of size 15 (I think?) - `MINLEN:36` reads must be at least 36 nucleotides long to not be discarded immediately - `brighamia_trimmomatic.sh` is just the name of the shell script I give ::: **2\)** Run trimmomatic on an entire folder of reads - To do this make a shell script with a ```for``` loop using the code below: - First, copy the code below and paste it into a text editor. - Change the name of the output shell (.sh) script in a text editor. The name of the output shell script is designated after the >> (in this case, the name of the shell script being generated is ```brighamia_trimmomatic.sh```). For running on the server, this is the same code with Fabronia pathname for Trimmomatic. If working on a different server or on a personal computer, adjust the pathname for Trimmomatic. ```bash= ! for R1 in *R1_001* do R2=${R1//R1_001.fastq.gz/R2_001.fastq.gz} R1paired=${R1//.fastq/_paired.fastq} R1unpaired=${R1//.fastq/_unpaired.fastq} R2paired=${R2//.fastq/_paired.fastq} R2unpaired=${R2//.fastq/_unpaired.fastq} echo java -jar /opt/Software/Trimmomatic-0.39/trimmomatic-0.39.jar PE -phred33 $R1 $R2 $R1paired $R1unpaired $R2paired $R2unpaired ILLUMINACLIP:/opt/Software/Trimmomatic-0.39/adapters/TruSeq3-PE.fa:2:30:10 LEADING:3 TRAILING:3 SLIDINGWINDOW:5:20 MINLEN:36 >> impatiens_trimmomatic.sh done ``` - Copy the revised code from the text editor and paste it into terminal and press `enter`. **:warning:Make sure you are in the folder containing the raw reads! If unsure, type the following code to see if the files are in the directory:** `ls -1` - Now that the shell script should be in the same directory as your raw reads, set up a screen using the following code: ```bash= Screen -S <name> ``` - Now run the shell script using the following code: ```bash sh <shell_script_name>.sh ``` **:bulb: If the above code doesn't work, you may have a permissions issue so try the code below:** ```bash= $ chmod a+x <shell_script_name>.sh $ bash <shell_script_name>.sh ``` ## Step 4: Preparation for HybPiper **1)** Housekeeping: Some file names can be excessively long. Now is the time to "clean up" the names to make them easier to work with **Example of current names** * 5b_S86_L002_R2_001_paired.fastq.gz * 5b_S86_L002_R1_001_paired.fastq.gz * 5b_S86_L002_R2_001_unpaired.fastq.gz * 5b_S86_L002_R1_001_unpaired.fastq.gz * 5b_S86_L002_R2_001.fastq.gz * 5b_S86_L002_R1_001.fastq.gz ```bash= ! #removing the "_001" for file in *.fastq.gz do mv -i "${file}" "${file/R2_001/R2}" done #removing the 001 for R1 for file in *.fastq.gz do mv -i "${file}" "${file/R1_001/R1}" done #removing the "_L002_" for file in *.fastq.gz do mv -i "${file}" "${file/_L002_/_}" done #double check that this got them all, some files may have slightly different numbers like L001 #Removing the S123 for file in *.fastq.gz do mv -i "${file}" "${file/_S*_R/_R}" done for file in *.reads.fasta do mv -i "${file}" "${file/combined.fasta_reads/combined_reads}" done ``` **Example of cleaned names** * 5b_S86_R2_paired.fastq.gz * 5b_S86_R1_paired.fastq.gz * 5b_S86_R2_unpaired.fastq.gz * 5b_S86_R1_unpaired.fastq.gz * 5b_S86_R2.fastq.gz * 5b_S86_R1.fastq.gz This will save time when doing loops and other scripts **2)** Before starting HybPiper we need to concatenate the unpaired reads. Use the `cat` command to do this. Modify and use the following code: ```bash= ! for i in 162-1 Abeid2627 ambanizanensis andringitensis anovensis auricoma; do cat "$i"_R1_unpaired.fastq "$i"_R2_unpaired.fastq > "$i"_unpaired.fastq done cat [file1]_R1_001_unpaired.fastq.gz [file2]_R2_002_unpaired.fastq.gz > [Prefix]_unpaired.fastq.gz ``` **3)** You might need to unzip all the files before proceeding. ```bash= ! gunzip *.gz ``` **4)** Check version of python ```python --version```. You should be using Python 2.7.3. If it is a later version do the following: ```bash= conda deactivate ``` Now check python version ```python --version``` again. **5)** In some cases the issue when people are working offsite have issues with your environment. Johnathan looked at a hidden “profile” to indicate the path to find hybpiper. Some people need to have this updated. ## Step 5: Running HybPiper > At this point, make sure you have Hybpiper downloaded. **HybPiper** is a pipeline meant to capture sequences from libraries using baits. The [**HybPiper wiki**](https://github.com/mossmatters/HybPiper/wiki) goes over installation & tutorial. To run Hybpiper you will need the following files: - Baits file - Paired reads files - Unpaired reads files - Possibly a names file ### Step 5.1: reads_first.py-Exonerate :::info :female-construction-worker: Behind the scenes reads_first.py is a wrapper script that: * Can check if all dependencies are installed correctly. (--check-depend) * Creates sub-directories. * Calls downstream analyses This script will call, in order: * Blastx (or BWA) * Distribute_reads_to_targets.py (or distribute_reads_to_targets_bwa.py) - After a BWA search of the raw reads against the target sequences, the reads are sorted according to the successful hits, and distributes the reads into FASTA files ready for assembly. * Distribute_targets.py - Given a file containing all of the "baits" for a target enrichment, create separate FASTA files with all copies of that bait. Multiple copies of the same bait can be specified using a "-" delimiter. * Run SPAdes assembler. * exonerate_hits.py - This script generates alignments of SPAdes contigs against the target sequence. ::: **1)** Run the python file `reads_first.py` using the following code on **one** accession: > The first step in the pipeline is running a python file called **reads first**. This python script does a lot of heavy lifting, including mapping the reads, assembling contigs, and then assigning contigs to the baits. It uses: **Both paired end reads (R1, R2), the concatenated unpaired reads**, and a **baits file**. ```bash=1 ! $ cd <directory_with_reads_paired_and_unpaired_and_baits_file> $ python /opt/Software/HybPiper/reads_first.py -r BRIN-001_R1_paired_dd.fastq BRIN-001_R2_paired_dd.fastq --unpaired BRIN-001_unpaired.fastq -b brighamia_baits.fasta --prefix BRIN-001 --bwa ``` :warning: Change the names of the `.fastq` and `baits.fasta` files as well as the name of the output folder (`--prefix BRIN-001`) in the code above. :::spoiler Arguments in the script: `reads_first.py` - `-r` This specifies the paired end reads files - `--unpaired` This specifies the unpaired read file - `-b` This specifies the baits file - `--prefix` reads_first.py creates an output directory (a folder). This will be the name of the folder - `--bwa` This tells reads_first.py that we are using nucleotide sequences and not amino acid sequences ::: :::danger **Error:** Traceback (most recent call last): File "/opt/Software/HybPiper/distribute_reads_to_targets_bwa.py", line 4, in module from Bio import SeqIO ImportError: No module named Bio real 0m0.100s user 0m0.013s sys 0m0.008s [CMD] time python /opt/Software/HybPiper/distribute_reads_to_targets_bwa.py USDA-05_S26_unpaired.bam /home/AGrinage/Cleaned_reads/USDA-05_S26_unpaired.fastq Traceback (most recent call last): File "/opt/Software/HybPiper/distribute_reads_to_targets_bwa.py", line 4, in module from Bio import SeqIO ImportError: No module named Bio real 0m0.019s user 0m0.012s sys 0m0.007s ERROR: Something went wrong with distributing reads to gene directories. ::: :::info :bulb: SOLUTION: Check dependencies ```python /opt/Software/HybPiper/reads_first.py --check-depend``` In this case we need to install biopython ```conda install biopython``` ::: **2)** Run Hybpiper on an entire folder of reads - To do this make a shell script with a `for` loop using the code below: - First, copy the code below and paste it into a text editor. - Change the name of the baits file (Here it is:`brighamia_baits.fasta`) in a text editor. ```bash= ! for file in *R1_paired* do file2=${file//R1/R2} file3=${file//R1paired_dd.fastq/unpaired.fastq} file4=${file//R1_paired_dd.fastq/} echo python /opt/Software/HybPiper/reads_first.py -r $file $file2 --unpaired $file3 -b brighamia_baits.fasta --prefix $file4 --bwa >> reads_first.sh done ``` :::danger **Error:** "Records in Fastq files should start with '@' character") ValueError: Records in Fastq files should start with '@' character real 0m1.607s user 0m1.554s sys 0m0.067s ERROR: Something went wrong with distributing reads to gene directories. ::: - Copy the revised code from the text editor and paste it into terminal and press `enter`. **:warning:Make sure you are in the folder containing the raw reads! If unsure, type the following code to see if the files are in the directory:** `ls -1` - Now that the shell script should be in the same directory as your raw reads, set up a screen using the following code: ```bash= Screen -S <name> ``` - Now run the shell script using the following code: ```bash= sh reads_first.sh ``` > This process is very CPU intensive and will take a while. There is also a lot of information your terminal will output as it's running. For every individual, reads_first will create one folder containing the file outputs. These file outputs will include sequences that were successfully mapped and assembled. ### Step 5.2: Checking for paralogs ``` /opt/Software/HybPiper/paralog_investigator.py $name; done < name_file.txt ``` ### Step 5.3: Intronerate ```bash= for dir in */ do echo python3 /opt/Software/HybPiper/intronerate.py --prefix $dir >> intronerate.sh done ``` ### Step 5.4: Retrieve Supercontigs (Introns+Exons), Introns, Amino Acids > This script will get the sequences generated from multiple runs of the HybSeqPipeline (reads_first.py). Have all of the runs in the same directory (sequence_dir). It retreives all the gene names from the bait file used in the run of the pipeline. It will output unaligned fasta files, one per gene, to current directory. :::info Note: You must specify whether you want the protein (aa) or nucleotide (dna) sequences. You can also specify 'intron' to retreive the intron sequences, or 'supercontig' to get intron and exon sequences. ::: #### Retrieve the supercontigs (introns + exons) ```bash= python /opt/Software/HybPiper/retrieve_sequences.py Angiosperms353_targetSequences.fasta . supercontig ``` #### Retrieve the introns ```bash= python /opt/Software/HybPiper/retrieve_sequences.py Angiosperms353_targetSequences.fasta . intron ``` #### Retrieve the dna sequences (exons) ```bash= python /opt/Software/HybPiper/retrieve_sequences.py Angiosperms353_targetSequences.fasta . dna ``` #### Retrieve the amino acids ```bash= python /opt/Software/HybPiper/retrieve_sequences.py Angiosperms353_targetSequences.fasta . aa ``` --- ## Step 6: Post-Hybpiper ### 6.1: Alignment Make alignments on fasta files (supercontig, introns, or exons) using [MAFFT](https://https://mafft.cbrc.jp/alignment/software/). #### Step 1: ```cd``` into the directory with the input (supercontigs, introns, or exons) fasta files #### Step 2: Run MAFFT on a screen for all files in directory ```bash= screen for i in *.fasta; do mafft --auto ${i} > ${i%.*}_mafft.fasta; done ``` You should now have separate gene alignments with the following suffix: ```_mafft.fasta``` ### 6.2: Generate coalescence tree using ASTRAL #### 6.2.1: Gene trees Make gene trees using the previously generated mafft alignment files as the input. We will be using [IQ Tree](https://http://www.iqtree.org/doc/Home) to generate a series of maximum likelihood gene trees. ##### Step 1: Check that you are in the directory with the alignments using ```pwd```. ##### Step 2: Make a screen ```bash= screen -S gene_trees ``` > Where "gene_trees" is the name of the screen. ##### Step 3: Generate shell script to run IQ Tree on all gene alignments ```bash= for file in *_mafft.fasta* do echo /opt/Software/iqtree-1.6.9-Linux/bin/iqtree -s $file -nt AUTO -m TEST -bb 1000 -wbtl >> iqtree.sh done ``` > Now you should have a shell script named ```iqtree.sh```. ##### Step 4: Execute shell script ```iqtree.sh``` ```bash= sh iqtree.sh ``` > IQ tree generates the following output files: .bionj, .ckp.gz, .contree, .log, .mldist, .model.gz, . splits.nex, . ufboot, .iqtree, .treefile The .ufboot --> bootstrap trees, .iqtree --> summary file containing consensus tree, .treefile --> consensus tree in newick format. Use the .treefile for the input file for ASTRAL. #### 6.2.2: Running ASTRAL ##### Step 1: Generate input file containing all gene trees. ```bash= cat *.treefile > in.tree ``` ``` Note: Make sure you are in the directory containing the gene trees ".treefile". ``` ##### Step 2: Remove gene identifiers from accession names :warning: Do this step if accessions have gene names in the names. If the gene names are in the names for each accession, ASTRAL will interpret each accession/gene as distinct from the same accession with a different gene. ```bash= ! sed -i 's/-....:/:/g' /ADD/LOCATION/OF/IN/FILE/in.tree ``` ##### Step 3: Start a screen ```bash= screen -S #choose a name ``` ##### Step 4: Run Astral ```bash= java -jar /opt/Software/ASTRAL/Astral/astral.5.5.6.jar -i in.tree -o out.tre 2>out.log ``` --- ### Statistical Summary of Reads visit #### Sequence length - get_seq_lengths.py A heatmap is one way to get a quick glance of the overall success of HybPiper in recovering coding sequences. To generate the heatmap, we first need to collect the length of coding sequence recovered by HybPiper for each gene and sample. This uses the script get_seq_lengths.py: ```bash= # ran Katie's Data python /opt/Software/HybPiper/get_seq_lengths.py Angiosperms353_targetSequences.fasta namelist.txt dna > test_seq_lengths.txt ``` * The test_seq_lengths.txt * First Line is names of each gene. * Second line has the length of the target gene, averaged over each "source" for that gene. * The rest are the length of the sequence recovered by HybPiper for each gene. * If there was no sequence for a gene, a 0 is entered. #### Sequence stats hybpiper_stats.py This script will summarize target enrichment and gene recovery efficiency for a set of samples. The output is a text file with one sample per line and the following statistics: ```bash= # ran Katie's Data python /opt/Software/HybPiper/hybpiper_stats.py test_seq_lengths.txt namelist.txt > test_stats.txt ``` * Number of reads * Number of reads on target * Percent reads on target * Number of genes with reads * Number of genes with contigs * Number of genes with sequences * Number of genes with sequences > 25% of the target length * Number of genes with sequences > 50% of the target length * Number of genes with sequences > 75% of the target length * Number of genes with sequences > 150% of the target length * Number of genes with paralog warnings NOTE: The number of reads and percent reads on target will only be reported if mapping was done using BWA. ### Intronerate --- ## Troubleshooting ### Issues with running HybPiper #### reads_first.py > In this section, errors that are given will not be verbose (i.e., the errors here will be summarized versions, and you might need to dig through terminal output to find the error that matches). :::danger **Error: No Module named Bio** - At the root of it, this error means that the reads_first.py script was unable to locate the BioPython package (shorthand Bio). This could be for a number of reasons: - It is not installed. This won't be true if you ran `reads_first.py --check-depend` as in the the earlier parts of this workflow. - The more likely issue is that it is installed, but reads_first.py can't find it. A common issue is that there are multiple versions of python installed on your computer/server, and while Biopython is installed in one version, reads_first.py is using a different version. - Try typing `python -V` into terminal, and then type `python3 -V`. If your terminal outputs 2 different python versions, this may be the issue. - If the above is true, type `python` into termianl, and your terminal will become a python script environment, denoted by `>>>`. Type `import Bio` and press enter. If nothing happens, then *this* python version is where BioPython is installed. If termianl outputs an error along the lines of `Error: Module Not Found`, then Biopython is probably installed on the other version of python. At any time, type `quit()` to exit the python environment. If python isn't installed in this version, try typing `python3` in terminal to open up another python environment, this time using the other version. If `import Bio` still gives `Error: Module Not Found`, then BioPython might not be properly installed. :::

    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
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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