An interactive 'dialog' generating a SAM Flag
The following shell script uses the dialog utility to generate a numeric Sam flag.
$ sh selectsam.sh
┌───────────────────────SAM FLAGS──────────────────────────┐
│ SELECT FLAGS │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ [X] 1 Read Paired │ │
│ │ [ ] 2 Read mapped in proper pair │ │
│ │ [X] 4 Read unmapped │ │
│ │ [ ] 8 Mate unmapped │ │
│ │ [ ] 16 Read reverse strand │ │
│ │ [X] 32 Mate reverse strand │ │
│ │ [ ] 64 First in pair │ │
│ │ [X] 128 Second in pair │ │
│ │ [ ] 256 Not primary alignment │ │
│ │ [ ] 512 Read fails platform/vendor quality checks │ │
│ │ [ ] 1024 Read is PCR or optical duplicate │ │
│ └─────↓(+)─────────────────────────────────────────────┘ │
│ │
│ │
├──────────────────────────────────────────────────────────┤
│ < OK > │
└──────────────────────────────────────────────────────────┘
$ 165
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dialog --stdout --title "SAM FLAGS" \ | |
--nocancel \ | |
--separate-output \ | |
--checklist "SELECT FLAGS" 20 60 11 \ | |
1 "Read Paired" off \ | |
2 "Read mapped in proper pair" off \ | |
4 "Read unmapped" off \ | |
8 "Mate unmapped" off \ | |
16 "Read reverse strand" off \ | |
32 "Mate reverse strand" off \ | |
64 "First in pair" off \ | |
128 "Second in pair" off \ | |
256 "Not primary alignment" off \ | |
512 "Read fails platform/vendor quality checks" off \ | |
1024 "Read is PCR or optical duplicate" off \ | |
| awk 'BEGIN { i=0;} {i+=int($1);} END {printf("%s\n",i);}' |
Source available at: https://github.com/lindenb/samtools-utilities/blob/master/script/selectflag.sh
That's it,
Pierre
1 comment:
should be part of SAMtools
Post a Comment