File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -91,11 +91,16 @@ impl DnaToChaos for fasta::Record {
9191pub fn draw < R : io:: Read > ( source : R , destination : Option < PathBuf > ) -> anyhow:: Result < ( ) > {
9292 let mut reader = fasta:: Reader :: new ( BufReader :: new ( source) ) ;
9393
94- for result in reader. records ( ) {
94+ for ( count , result) in reader. records ( ) . enumerate ( ) {
9595 let record = result?;
96- let chaos = record. record_to_chaos ( ) ;
97- chaos. draw ( destination. clone ( ) ) ?;
96+ if count == 0 {
97+ let chaos = record. record_to_chaos ( ) ;
98+ chaos. draw ( destination. clone ( ) ) ?;
99+ } else {
100+ anyhow:: bail!( "Cannot draw from multi-sequence fasta" ) ;
101+ }
98102 }
103+
99104 Ok ( ( ) )
100105}
101106
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ pub struct DrawArgs {
7878 /// Input sequence file in FASTA format
7979 pub file : PathBuf ,
8080
81- /// Output file
81+ /// Output file name (.png), defaults to sequence ID
8282 #[ arg( short, value_parser = validate_image_output) ]
8383 pub output : Option < PathBuf > ,
8484}
@@ -131,7 +131,7 @@ fn validate_image_output(s: &str) -> Result<PathBuf, String> {
131131 ) ) ;
132132 }
133133 } else {
134- return Err ( "Output file must have an extension" . to_string ( ) ) ;
134+ return Err ( "Output file must have png extension (.png) " . to_string ( ) ) ;
135135 }
136136
137137 Ok ( mp)
You can’t perform that action at this time.
0 commit comments