Skip to content

Instantly share code, notes, and snippets.

@AswinSSoman
Last active September 5, 2019 11:44
Show Gist options
  • Select an option

  • Save AswinSSoman/22e9d5fd45b881467d56c77adb15258c to your computer and use it in GitHub Desktop.

Select an option

Save AswinSSoman/22e9d5fd45b881467d56c77adb15258c to your computer and use it in GitHub Desktop.
BWA allignment of Lambda phage genome

1. Install Samtools

  • Samtools is a suite of programs for interacting with high-throughput sequencing data.

  • Download samtools-1.9, bcftools-1.9, htslib-1.9 from htslib.org

  • First install htslib-1.9

  • Unzip & go inside htslib folder in terminal and type the following.

    ./configure
     make
     sudo make install
    
  • Install samtools-1.9 & bcftools-1.9 using the same commands.

👉 Note:

  • If there are broken packages in the system like Albacore, it wont allow you to install new packages.
  • So force remove those packages using this link here.

2. Convert SAM to BAM

  • To do anything meaningful with alignment data:
    • first convert the SAM to its binary counterpart, BAM format using:

        samtools view -b lambda.sam > lambda.bam
      
    -b = output format in BAM

3. Sort the BAM

  • Current aligners produce alignments in random order with respect to their position in the reference genome.

  • It must be sorted such that the alignments occur in genome order, using:

          samtools sort lambda.bam -o lambda.sorted.bam
    

    -o = output file

4. index the sorted BAM

  • Indexing is done to quickly query or extract alignments.

           `samtools index lambda.sorted.bam`
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment