OLD | NEW |
1 library googleapis_beta.genomics.v1beta2; | 1 library googleapis_beta.genomics.v1beta2; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import "package:crypto/crypto.dart" as crypto; | 8 import "package:crypto/crypto.dart" as crypto; |
9 import 'package:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
10 import '../src/common_internal.dart' as common_internal; | 10 import '../src/common_internal.dart' as common_internal; |
(...skipping 3922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3933 return _json; | 3933 return _json; |
3934 } | 3934 } |
3935 } | 3935 } |
3936 | 3936 |
3937 | 3937 |
3938 /** | 3938 /** |
3939 * A read alignment describes a linear alignment of a string of DNA to a | 3939 * A read alignment describes a linear alignment of a string of DNA to a |
3940 * reference sequence, in addition to metadata about the fragment (the molecule | 3940 * reference sequence, in addition to metadata about the fragment (the molecule |
3941 * of DNA sequenced) and the read (the bases which were read by the sequencer). | 3941 * of DNA sequenced) and the read (the bases which were read by the sequencer). |
3942 * A read is equivalent to a line in a SAM file. A read belongs to exactly one | 3942 * A read is equivalent to a line in a SAM file. A read belongs to exactly one |
3943 * read group and exactly one read group set. | 3943 * read group and exactly one read group set. Generating a reference-aligned |
| 3944 * sequence string When interacting with mapped reads, it's often useful to |
| 3945 * produce a string representing the local alignment of the read to reference. |
| 3946 * The following pseudocode demonstrates one way of doing this: |
| 3947 * out = "" offset = 0 for c in read.alignment.cigar { switch c.operation { case |
| 3948 * "ALIGNMENT_MATCH", "SEQUENCE_MATCH", "SEQUENCE_MISMATCH": out += |
| 3949 * read.alignedSequence[offset:offset+c.operationLength] offset += |
| 3950 * c.operationLength break case "CLIP_SOFT", "INSERT": offset += |
| 3951 * c.operationLength break case "PAD": out += repeat("*", c.operationLength) |
| 3952 * break case "DELETE": out += repeat("-", c.operationLength) break case "SKIP": |
| 3953 * out += repeat(" ", c.operationLength) break case "CLIP_HARD": break } } |
| 3954 * return out |
| 3955 * Converting to SAM's CIGAR string The following pseudocode generates a SAM |
| 3956 * CIGAR string from the cigar field. Note that this is a lossy conversion |
| 3957 * (cigar.referenceSequence is lost). |
| 3958 * cigarMap = { "ALIGNMENT_MATCH": "M", "INSERT": "I", "DELETE": "D", "SKIP": |
| 3959 * "N", "CLIP_SOFT": "S", "CLIP_HARD": "H", "PAD": "P", "SEQUENCE_MATCH": "=", |
| 3960 * "SEQUENCE_MISMATCH": "X", } cigarStr = "" for c in read.alignment.cigar { |
| 3961 * cigarStr += c.operationLength + cigarMap[c.operation] } return cigarStr |
3944 */ | 3962 */ |
3945 class Read { | 3963 class Read { |
3946 /** | 3964 /** |
3947 * The quality of the read sequence contained in this alignment record. | 3965 * The quality of the read sequence contained in this alignment record. |
3948 * alignedSequence and alignedQuality may be shorter than the full read | 3966 * alignedSequence and alignedQuality may be shorter than the full read |
3949 * sequence and quality. This will occur if the alignment is part of a | 3967 * sequence and quality. This will occur if the alignment is part of a |
3950 * chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR | 3968 * chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR |
3951 * for this read will begin/end with a hard clip operator that will indicate | 3969 * for this read will begin/end with a hard clip operator that will indicate |
3952 * the length of the excised sequence. | 3970 * the length of the excised sequence. |
3953 */ | 3971 */ |
3954 core.List<core.int> alignedQuality; | 3972 core.List<core.int> alignedQuality; |
3955 | 3973 |
3956 /** | 3974 /** |
3957 * The bases of the read sequence contained in this alignment record. | 3975 * The bases of the read sequence contained in this alignment record, without |
3958 * alignedSequence and alignedQuality may be shorter than the full read | 3976 * CIGAR operations applied. alignedSequence and alignedQuality may be shorter |
3959 * sequence and quality. This will occur if the alignment is part of a | 3977 * than the full read sequence and quality. This will occur if the alignment |
3960 * chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR | 3978 * is part of a chimeric alignment, or if the read was trimmed. When this |
3961 * for this read will begin/end with a hard clip operator that will indicate | 3979 * occurs, the CIGAR for this read will begin/end with a hard clip operator |
3962 * the length of the excised sequence. | 3980 * that will indicate the length of the excised sequence. |
3963 */ | 3981 */ |
3964 core.String alignedSequence; | 3982 core.String alignedSequence; |
3965 | 3983 |
3966 /** | 3984 /** |
3967 * The linear alignment for this alignment record. This field will be null if | 3985 * The linear alignment for this alignment record. This field will be null if |
3968 * the read is unmapped. | 3986 * the read is unmapped. |
3969 */ | 3987 */ |
3970 LinearAlignment alignment; | 3988 LinearAlignment alignment; |
3971 | 3989 |
3972 /** The fragment is a PCR or optical duplicate (SAM flag 0x400) */ | 3990 /** The fragment is a PCR or optical duplicate (SAM flag 0x400) */ |
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5866 _json["metadata"] = metadata.map((value) => (value).toJson()).toList(); | 5884 _json["metadata"] = metadata.map((value) => (value).toJson()).toList(); |
5867 } | 5885 } |
5868 if (referenceBounds != null) { | 5886 if (referenceBounds != null) { |
5869 _json["referenceBounds"] = referenceBounds.map((value) => (value).toJson()
).toList(); | 5887 _json["referenceBounds"] = referenceBounds.map((value) => (value).toJson()
).toList(); |
5870 } | 5888 } |
5871 return _json; | 5889 return _json; |
5872 } | 5890 } |
5873 } | 5891 } |
5874 | 5892 |
5875 | 5893 |
OLD | NEW |