pub fn run(
in_bam: String,
out_bam: String,
inverse: bool,
both_end: f64,
left_side: f64,
right_side: f64,
unalign: bool,
) -> Result<u8, String>Expand description
Workflow to process an input bam file and write the pass-filter alignments into a new bam file
§Arguments
in_bam: input bam fileout_bam: output bam fileinverse: boolean flag to indicate whether we want to write out the failed-filter alignments onlyboth_end: maximum fraction of total clipped bases relative to the read sequence length to consider as passleft_side: maximum fraction of of clipped bases on either side relative to the read sequence length to consider as passright_side: maximum fraction of of clipped bases on either side relative to the read sequence length to consider as pass
§Examples
use filter_clipped::run;
use rust_htslib::bam;
use rust_htslib::bam::Read;
fn count_bam(bam_file: String, expected_count: i32) {
// helper function to verify result
let mut bam_reader = bam::Reader::from_path(bam_file).unwrap();
let mut aln_count = 0;
for r in bam_reader.records() {
let _record = r.unwrap();
aln_count += 1;
}
assert_eq!(expected_count, aln_count);
}
let out_bam = "out.sam";
run(
"test/data/test.sam".to_string(),
out_bam.to_string(),
false,
0.1,
0.1,
0.1,
false,
);
count_bam(out_bam.to_string(), 6);