Skip to content

Commit cf47b18

Browse files
committed
Run rustfmt on create_parsebio_per_sample_bams.rs.
Run `rustfmt` on `create_parsebio_per_sample_bams.rs`.
1 parent 550c6df commit cf47b18

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

rust/src/bin/create_parsebio_per_sample_bams.rs

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,16 @@ fn fix_chromosome_names_in_bam_header(header: &Header) -> Vec<u8> {
148148
.to_bytes()
149149
.split(|x| x == &b'\n')
150150
.filter(|x| !x.is_empty() && (x.starts_with(b"@HD\t") || x.starts_with(b"@SQ\t")))
151-
.map(|x| {
152-
match x.starts_with(b"@SQ\tSN:") {
153-
true => {
154-
match x[7..].strip_prefix(b"hg38_") {
155-
Some(y) => {
156-
let mut sq_line = b"@SQ\tSN:".to_vec();
157-
sq_line.extend(Vec::<u8>::from(y));
158-
sq_line
159-
}
160-
None => Vec::<u8>::from(x),
161-
}
151+
.map(|x| match x.starts_with(b"@SQ\tSN:") {
152+
true => match x[7..].strip_prefix(b"hg38_") {
153+
Some(y) => {
154+
let mut sq_line = b"@SQ\tSN:".to_vec();
155+
sq_line.extend(Vec::<u8>::from(y));
156+
sq_line
162157
}
163-
false => Vec::<u8>::from(x),
164-
}
158+
None => Vec::<u8>::from(x),
159+
},
160+
false => Vec::<u8>::from(x),
165161
})
166162
.collect::<Vec<Vec<u8>>>()
167163
.join(&b"\n"[..])
@@ -175,16 +171,14 @@ fn filter_bam_header(header: &Header, sublibrary: &str) -> Vec<u8> {
175171
.split(|x| x == &b'\n')
176172
.filter(|x| !x.is_empty() && !x.starts_with(b"@HD\t") && !x.starts_with(b"@SQ\t"))
177173
.map(Vec::<u8>::from)
178-
.map(|x| {
179-
match x.starts_with(b"@PG\tID:STAR") {
180-
true => {
181-
let mut pg_line = Vec::<u8>::from(&x[..11]);
182-
pg_line.extend(format!(".{}", &sublibrary).into_bytes());
183-
pg_line.extend(Vec::<u8>::from(&x[11..]));
184-
pg_line
185-
}
186-
false => x,
174+
.map(|x| match x.starts_with(b"@PG\tID:STAR") {
175+
true => {
176+
let mut pg_line = Vec::<u8>::from(&x[..11]);
177+
pg_line.extend(format!(".{}", &sublibrary).into_bytes());
178+
pg_line.extend(Vec::<u8>::from(&x[11..]));
179+
pg_line
187180
}
181+
false => x,
188182
})
189183
.collect::<Vec<Vec<u8>>>()
190184
.join(&b"\n"[..])

0 commit comments

Comments
 (0)