-
Notifications
You must be signed in to change notification settings - Fork 0
sum up snv
Script for summarizing variation ant single specified position in SAM/BAM file.
It's output is simple and self-descriptive:
Position 3436:
Coverage: 53
A: 0 | 0,0%
T: 1 | 1,9%
G: 1 | 1,9%
C: 51 | 96,2%
*: 0 | 0,0%
, where '*'
is a gap.
In the verbose mode, the script also prints a tab-separated table of three columns: read_name
, base
, base_quality
, for example:
cbef4273-758c-41de-87f3-b923a94039c4 A 27
0bc23ebf-2669-4eaf-9dfe-86db4779ea4c G 23
28f6d93b-deeb-41ee-8175-a635f3d4c94c A 17
0975f99f-d20e-489b-8ce9-42ec5d43b439 G 6
1a3ad162-3429-47c1-92a1-682ee3aefac4 G 25
Position 3436:
Coverage: 5
A: 2 | 40,0%
T: 0 | 0,0%
G: 0 | 0,0%
C: 3 | 60,0%
*: 0 | 0,0%
- samtools;
- the script is written in AWK, so you need AWK to use it;
The script is tested on GNU Awk 5.0.1.
The script does not understand following CIGAR operations: =XPN
.
samtools view <BAM/SAM> | awk -f sum_up_snv.awk pos=<POS>
samtools view my_mapping.bam | awk -f sum_up_snv.awk pos=1067
samtools view my_mapping.bam | awk -f sum_up_snv.awk pos=1067 verbose=1
samtools view <BAM/SAM> <RNAME> | awk -f sum_up_snv.awk pos=<POS>
Example:
samtools view my_mapping.bam chr1 | awk -f sum_up_snv.awk pos=1067
samtools view <BAM/SAM> <RNAME>:<POS>-<POS> | awk -f sum_up_snv.awk pos=<POS>
Example:
samtools view my_mapping.bam chr1:1067-1067 | awk -f sum_up_snv.awk pos=1067