@@ -59,8 +59,6 @@ void printUsage() {
59
59
stderr.writeln(" output to stdout only reference names and lengths in JSON" );
60
60
stderr.writeln(" -c, --count" );
61
61
stderr.writeln(" output to stdout only count of matching records, hHI are ignored" );
62
- stderr.writeln(" -U, --unmapped" );
63
- stderr.writeln(" output reads with RNAME = *; available for indexed BAM only" );
64
62
stderr.writeln(" -v, --valid" );
65
63
stderr.writeln(" output only valid alignments" );
66
64
stderr.writeln(" -S, --sam-input" );
@@ -107,7 +105,6 @@ bool with_header;
107
105
bool header_only;
108
106
bool reference_info_only;
109
107
bool count_only;
110
- bool unmapped_only;
111
108
bool skip_invalid_alignments;
112
109
bool is_sam;
113
110
@@ -140,7 +137,6 @@ int view_main(string[] args) {
140
137
" header|H" , &header_only,
141
138
" reference-info|I" , &reference_info_only,
142
139
" count|c" , &count_only,
143
- " unmapped|U" , &unmapped_only,
144
140
" valid|v" , &skip_invalid_alignments,
145
141
" sam-input|S" , &is_sam,
146
142
" show-progress|p" , &show_progress,
@@ -202,18 +198,6 @@ int sambambaMain(T)(T _bam, TaskPool pool, string[] args)
202
198
return 0 ;
203
199
}
204
200
205
- static if (is (T == SamReader)) {
206
- if (unmapped_only) {
207
- stderr.writeln(" --unmapped option is available only for indexed BAMs" );
208
- return - 1 ;
209
- }
210
- }
211
-
212
- if (unmapped_only && args.length > 2 ) {
213
- stderr.writeln(" --unmapped option can't be used together with regions" );
214
- return - 1 ;
215
- }
216
-
217
201
if (header_only && ! count_only) {
218
202
// write header to stdout
219
203
(new HeaderSerializer(stdout, format)).writeln(bam.header);
@@ -271,10 +255,7 @@ int sambambaMain(T)(T _bam, TaskPool pool, string[] args)
271
255
runProcessor(bam, reads, read_filter);
272
256
bar.finish();
273
257
} else {
274
- if (unmapped_only)
275
- runProcessor(bam, bam.unmappedReads(), read_filter);
276
- else
277
- runProcessor(bam, bam.reads! withoutOffsets(), read_filter);
258
+ runProcessor(bam, bam.reads! withoutOffsets(), read_filter);
278
259
}
279
260
} else { // SamFile
280
261
runProcessor(bam, bam.reads, read_filter);
@@ -286,12 +267,19 @@ int sambambaMain(T)(T _bam, TaskPool pool, string[] args)
286
267
if (args.length > 2 ) {
287
268
auto regions = map! parseRegion(args[2 .. $]);
288
269
289
- alias ReturnType ! (ReferenceSequence. opSlice ) AlignmentRange;
270
+ alias InputRange ! BamReadBlock AlignmentRange;
290
271
auto alignment_ranges = new AlignmentRange[regions.length];
291
272
292
273
size_t i = 0 ;
293
- foreach (ref r; regions) {
294
- alignment_ranges[i++ ] = bam[r.reference][r.beg .. r.end];
274
+ foreach (region_description; args[2 .. $]) {
275
+ AlignmentRange range;
276
+ if (region_description == " *" ) {
277
+ range = bam.unmappedReads().inputRangeObject;
278
+ } else {
279
+ auto r = parseRegion(region_description);
280
+ range = bam[r.reference][r.beg .. r.end].inputRangeObject;
281
+ }
282
+ alignment_ranges[i++ ] = range;
295
283
}
296
284
297
285
auto reads = joiner(alignment_ranges);
0 commit comments