hi all, i'm relatively new to perl and i'm just starting off with my first script to create a text based alignment viewer using the Bio_Samtools perl module. What i'm trying to do is parse a sam file to get all the reads that overlap a certain genomic window from the reference fasta sequence file.
i have the following code to get all the reads that overlap a certain genomic window:
my @all_reads = $segment->features(
-type => 'match',
-seq_id => $seq_ids[0],
-start => $window_start,
-end => $window_end,
-filter => sub { shift->strand == -1 },
);
i'm trying to recreate the real read sequence from its cigar string by adding insertions to the read (with a ^ character) and deletions (with a - character). i'm not exactly sure how to do this, since i can't access the cigar string. it seems to be stored in a reference to an array. see the following code:
for my $read (@all_reads) {
print $read->qname,',',$read->aux_get("MD"), ',',$read->cigar_arra
+y,',', $read->strand, "\n";
};
i don't know how to display the reference to the array denoted by the $read->cigar_array part of the code. it prints out ARRAY(0x100a2d058) or something similar instead of the split cigar string. once i get this working, i would need to add my desired characters to the read sequence to get to create the raw read. does anyone have any help? thanks!