|
|
@@ -101,6 +101,18 @@ impl Blast {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ pub fn to_bed(&self) -> anyhow::Result<String> {
|
|
|
+ if let Some(results) = &self.results {
|
|
|
+ let mut lines = Vec::new();
|
|
|
+ for result in results.iter() {
|
|
|
+ lines.push(result.to_bed());
|
|
|
+ }
|
|
|
+ Ok(lines.join("\n"))
|
|
|
+ } else {
|
|
|
+ Err(anyhow!("No results"))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
pub fn save_file(self, file_path: &str) -> anyhow::Result<()> {
|
|
|
let data = self.to_json()?;
|
|
|
let mut file = File::create(file_path)?;
|