Truncating BAM files with samtools

samtools view -h ../088006A_micro_1.bam | head -n 100000 | samtools view -bS – > little.bam

Posted in Uncategorized | Leave a comment

Nice samtools short tutorial

Here are some basic commands to get your started. For more information on the SAM/BAM format see this page.

Link | Posted on by | Leave a comment

How to split large FASTA file into a set of smaller equally sized files

When sequence data is large it often makes sense to analyze it in smaller chunks. This script divides a large FASTA file into a set of smaller equally sized files.

Link | Posted on by | Leave a comment

Split file based on the number of characters

split -b 60 filename.txt

Would split a file into multiple 60 byte (character) text files.

(It returns files in the format of xaa, xab, xac, xad, etc, each file having the specified number of bytes)

Posted in Uncategorized | Leave a comment

How to make bowtie2 output as bam

bowtie2 -p 8  -x /genome/index -1 pair2.fastq -2 pair2.fastq -U unpaired.fastq --very-sensitive -X 1000 -I 200 | samtools view -bS - > output.bam

Alternatively you can save only mapped reads, this will reduce size of bam file

bowtie2 -p 8  -x /genome/index -1 pair2.fastq -2 pair2.fastq -U unpaired.fastq --very-sensitive -X 1000 -I 200 | amtools view -bSF4 - > mapped.bam
Link | Posted on by | Leave a comment