Bioinformatics Recipe Cookbook

Results generated by running the recipe.

Parameters used during the run:

  • Accession number for the reference genome:AF086833
  • SRA run number:SRR1972739
Output Messages
Messages printed to the standard output stream:
---
Reference genome, AF086833
SRR Run, SRR1972739
---
Total alignments, 20740
Unmapped, 5461
echo Mapped, 15279
Proper pair, 15216
Reads on forward strand, 8936
Reads on reverse strand, 6343
Reads mapped but mate unmapped, 11
Reads in file 1 where mate is on reverse strand, 2947
Reads in file 2 on the forward strand where mate in file 1 is on reverse strand, 2975
----
Flags
Command: samtools flags MREVERSE,READ1
0x60	96	MREVERSE,READ1

Command: samtools flags 96
0x60	96	MREVERSE,READ1

--- Work strategy ---
Suppose you need: supplementary alignments from file 1
on the forward strand where the mate is on the reverse
First find flags for each attribute:

0x10	16	REVERSE
0x800	2048	SUPPLEMENTARY
0x20	32	MREVERSE
0x40	64	READ1

# Perform the filtering (long form):
samtools view -c -F 16 -f 2048 -f 32 -f 64 results.bam
7

# Perform the filtering (short form, all flags combined into one):
samtools view -c -F 16 -f 2144 results.bam
7
Other Messages
Messages printed to the standard error stream:
+ ACC=AF086833
+ SRR=SRR1972739
+ mkdir -p db
+ REF=db/AF086833.fa
+ READ1=SRR1972739_1.fastq
+ READ2=SRR1972739_2.fastq
+ efetch -db=nuccore -format=fasta -id=AF086833
+ fastq-dump -X 10000 --split-files SRR1972739
+ bwa index db/AF086833.fa
+ bwa mem db/AF086833.fa SRR1972739_1.fastq SRR1972739_2.fastq
+ samtools sort
+ samtools index results.bam
++ samtools view -c results.bam
+ ALN_COUNT=20740
++ samtools view -c -f 4 results.bam
+ UNMAP_COUNT=5461
++ samtools view -c -F 4 results.bam
+ MAPPED_COUNT=15279
++ samtools view -c -F 4 -f 2 results.bam
+ PROPER_PAIR=15216
++ samtools view -c -F 4 -F 16 results.bam
+ FORWARD_STRAND=8936
++ samtools view -c -F 4 -f 16 results.bam
+ REVERSE_STRAND=6343
++ samtools view -c -F 4 -f 8 results.bam
+ MUNMAP_COUNT=11
++ samtools view -c -F 4 -f 96 results.bam
+ FILE1_REV_COUNT=2947
++ samtools view -c -F 20 -f 160 results.bam
+ FILE2_REV_COUNT=2975
+ echo ---
+ echo 'Reference genome,' AF086833
+ echo 'SRR Run,' SRR1972739
+ echo ---
+ echo 'Total alignments,' 20740
+ echo 'Unmapped, 5461
echo Mapped, 15279'
+ echo 'Proper pair,' 15216
+ echo 'Reads on forward strand,' 8936
+ echo 'Reads on reverse strand,' 6343
+ echo 'Reads mapped but mate unmapped,' 11
+ echo 'Reads in file 1 where mate is on reverse strand,' 2947
+ echo 'Reads in file 2 on the forward strand where mate in file 1 is on reverse strand,' 2975
+ CMD1='samtools flags MREVERSE,READ1'
++ eval samtools flags MREVERSE,READ1
+++ samtools flags MREVERSE,READ1
+ RES1='0x60	96	MREVERSE,READ1'
+ CMD2='samtools flags 96'
++ eval samtools flags 96
+++ samtools flags 96
+ RES2='0x60	96	MREVERSE,READ1'
+ echo ----
+ echo Flags
+ echo 'Command: samtools flags MREVERSE,READ1'
+ echo '0x60	96	MREVERSE,READ1'
+ echo ''
+ echo 'Command: samtools flags 96'
+ echo '0x60	96	MREVERSE,READ1'
+ echo ''
+ echo '--- Work strategy ---'
+ echo 'Suppose you need: supplementary alignments from file 1'
+ echo 'on the forward strand where the mate is on the reverse'
+ echo 'First find flags for each attribute:'
+ echo ''
+ samtools flags REVERSE
+ samtools flags SUPPLEMENTARY
+ samtools flags MREVERSE
+ samtools flags READ1
+ echo ''
+ echo '# Perform the filtering (long form):'
+ CMD3='samtools view -c -F 16 -f 2048 -f 32 -f 64 results.bam'
++ eval samtools view -c -F 16 -f 2048 -f 32 -f 64 results.bam
+++ samtools view -c -F 16 -f 2048 -f 32 -f 64 results.bam
+ RES3=7
+ echo samtools view -c -F 16 -f 2048 -f 32 -f 64 results.bam
+ echo 7
+ echo ''
+ echo '# Perform the filtering (short form, all flags combined into one):'
+ CMD4='samtools view -c -F 16 -f 2144  results.bam'
++ eval samtools view -c -F 16 -f 2144 results.bam
+++ samtools view -c -F 16 -f 2144 results.bam
+ RES4=7
+ echo samtools view -c -F 16 -f 2144 results.bam
+ echo 7

Powered by the release 2.3.6