|
|
@@ -88,7 +88,8 @@ impl Blast {
|
|
|
}
|
|
|
|
|
|
pub fn to_mapping(self) -> Option<Vec<Mapping>> {
|
|
|
- self.results.map(|res| res.iter().map(Mapping::from).collect())
|
|
|
+ self.results
|
|
|
+ .map(|res| res.iter().map(Mapping::from).collect())
|
|
|
}
|
|
|
|
|
|
pub fn to_json(self) -> anyhow::Result<String> {
|
|
|
@@ -216,6 +217,18 @@ impl BlastResult {
|
|
|
..s
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ pub fn to_bed(&self) -> String {
|
|
|
+ let info = format!("{}:{}-{}", self.subject_id, self.s_start, self.s_end);
|
|
|
+ [
|
|
|
+ self.query_id.to_string(),
|
|
|
+ self.q_start.to_string(),
|
|
|
+ self.q_end.to_string(),
|
|
|
+ info,
|
|
|
+ ]
|
|
|
+ .join("\t")
|
|
|
+ .to_string()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#[derive(Debug)]
|