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!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.