Good day! I am just starting my adventures in perl and stongly need your help. At the moment I am busy with mapping of certain motifs in human genes. There are some genes saved in the file called sequence.txt (in FASTA format) and some amount of binding sites in motif.txt. The thing I want to do is to count the length of the fragment for every gene if it has any of the binding sites from motif.txt. This current script does not work in the way I would like it. How should it be changed?
$string_filename = 'sequence.txt'; open(FILE, $string_filename) || die("Couldn't read file $string_filena +me\n"); $motif_filename = 'motif.txt'; open(MOTIF, $motif_filename) || die("Couldn't read file $motif_filenam +e\n"); local $/ = "\n>"; while (my $seq = <FILE>) { chomp $seq; $seq =~ s/^>*.+\n//; $seq =~ s/\n//g; $R = length $seq; $motif = <MOTIF>; chomp $motif; $motif =~ s/^>*.+\n//; $motif =~ s/\n//g; if ( $seq =~ /$motif/ ) { ## insert actual binding site $M = $'; $W = length $M; if ( $seq =~ /[A-Z]/) { ## exon start $K = $`; $Z = length $K; $x = $W + $Z - $R; print "\n\ the distance is the following: $x\n\n"; } else { print "\n\ I couldn't find the start codon.\n\n"; } } else { print "\n\ I couldn't find the binding site.\n\n"; } } close MOTIF; close FILE; exit;
Struggling this problem I recognised that it can be solved better using BioPerl module. I read carefully the installation instructions for Windows here http://www.bioperl.org/wiki/Installing_Bioperl_on_Windows#Installation_using_CPAN_or_manual_installation. It seems to be rather simple bur I failed plenty of times trying to do it. I used PPM in ActivePerl 5.12. I have added all the repository listed in the table. And when I select View >> All Packages there is no bioperl available. So this is a problem and I can't recognise what I am doing wrong. Will you be so kind to suggest we the way to modify my perl script or help with BioPerl installation? Thanks a lot!

In reply to How to find any of many motifs? by Nikulina

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.