1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.utgenome.gwt.utgb.client.bio;
26
27
28
29
30
31
32
33 public class SAMReadFlag {
34
35 public static final int FLAG_PAIRED_READ = 0x001;
36 public static final int FLAG_MAPPED_IN_A_PROPER_PAIR = 0x002;
37 public static final int FLAG_QUERY_IS_UNMAPPED = 0x004;
38 public static final int FLAG_MATE_IS_UNMAPPED = 0x008;
39 public static final int FLAG_STRAND_OF_QUERY = 0x0010;
40 public static final int FLAG_STRAND_OF_MATE = 0x0020;
41 public static final int FLAG_IS_FIRST_READ = 0x0040;
42 public static final int FLAG_IS_SECOND_READ = 0x0080;
43 public static final int FLAG_NOT_PRIMARY = 0x0100;
44 public static final int FLAG_FAILS_QUALITY_CHECK = 0x0200;
45 public static final int FLAG_PCR_OR_OPTICAL_DUPLICATE = 0x0400;
46
47 public static boolean isPairedRead(int flag) {
48 return (flag & FLAG_PAIRED_READ) != 0;
49 }
50
51 public static boolean isMappedInProperPair(int flag) {
52 return (flag & FLAG_MAPPED_IN_A_PROPER_PAIR) != 0;
53 }
54
55 public static boolean isQueryUnmapped(int flag) {
56 return (flag & FLAG_QUERY_IS_UNMAPPED) != 0;
57 }
58
59 public static boolean isMateUnmapped(int flag) {
60 return (flag & FLAG_MATE_IS_UNMAPPED) != 0;
61 }
62
63 public static boolean isQueryForwardStrand(int flag) {
64 return (flag & FLAG_STRAND_OF_QUERY) == 0;
65 }
66
67 public static boolean isMateForwardStrand(int flag) {
68 return (flag & FLAG_STRAND_OF_MATE) == 0;
69 }
70
71 public static boolean isFirstRead(int flag) {
72 return (flag & FLAG_IS_FIRST_READ) != 0;
73 }
74
75 public static boolean isSecondRead(int flag) {
76 return (flag & FLAG_IS_SECOND_READ) != 0;
77 }
78
79 }