#!/usr/bin/perl

use strict;
use warnings;

use Getopt::Long;
use Bio::Assembly::IO;


my $aio = Bio::Assembly::IO->new(
	-file  => "KBrB056G23_vs_Bna_03_002_paired.bam",
	-refdb => "KBrB056G23.fasta",
);

my $assem = $aio->next_assembly;

print "There are [", $assem->get_nof_contigs, "] contigs in this assembly\n";

foreach my $contig ( $assem->all_contigs ) {
	print "\nCONTIG [", $contig->id(), "]\n";
	print "\tThere are [", $contig->num_sequences,
	  "] sequences in this contig\n";

	foreach my $seq ( $contig->each_seq ) {
		
		my $sequence = $seq->seq();
		print "[$sequence]\n";

		my $feature = $contig->get_seq_coord($seq);

		print join( "\t",
			$seq->id, $seq->strand, $seq->start, $seq->end, $feature->start,
			$feature->end, ),
		  "\n";
	}
}
