File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -338,3 +338,26 @@ pub fn bed_intersect(args: BEDIntersect) {
338338 }
339339 }
340340}
341+
342+ /// construct a pangenotype matrix
343+ #[ derive( FromArgs , PartialEq , Debug ) ]
344+ #[ argh( subcommand, name = "matrix" ) ]
345+ pub struct PangenotypeMatrix {
346+ /// the GAF file to use for genotyping
347+ #[ argh( positional) ]
348+ gaf_file : String ,
349+ }
350+
351+ pub fn pangenotype_matrix ( gfa : & flatgfa:: FlatGFA , args : PangenotypeMatrix ) {
352+ let matrix = ops:: pangenotype:: make_pangenotype_matrix ( gfa, vec ! [ args. gaf_file] ) ;
353+ for row in matrix {
354+ for col in row {
355+ if col {
356+ print ! ( "1" ) ;
357+ } else {
358+ print ! ( "0" ) ;
359+ }
360+ }
361+ println ! ( ) ;
362+ }
363+ }
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ enum Command {
4444 GafLookup ( cmds:: GAFLookup ) ,
4545 Bench ( cmds:: Bench ) ,
4646 BedIntersect ( cmds:: BEDIntersect ) ,
47+ PangenotypeMatrix ( cmds:: PangenotypeMatrix ) ,
4748}
4849
4950fn main ( ) -> Result < ( ) , & ' static str > {
@@ -146,6 +147,9 @@ fn main() -> Result<(), &'static str> {
146147 Some ( Command :: BedIntersect ( _sub_args) ) => {
147148 panic ! ( "Unreachable code" ) ;
148149 }
150+ Some ( Command :: PangenotypeMatrix ( sub_args) ) => {
151+ cmds:: pangenotype_matrix ( & gfa, sub_args) ;
152+ }
149153 None => {
150154 // Just emit the GFA or FlatGFA file.
151155 dump ( & gfa, & args. output ) ;
You can’t perform that action at this time.
0 commit comments