Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: REGEX help

by dorko (Prior)
on Apr 21, 2018 at 01:31 UTC ( [id://1213297]=note: print w/replies, xml ) Need Help??


in reply to REGEX help

Hello. Welcome.

I think you want to look at BioPerl.

This code is completely untested. I didn't want to install BioPerl on my system. But it might work if you can get BioPerl installed. (I know you're new to Perl, so installing BioPerl might be a stretch, but this might help: http://bioperl.org/INSTALL.html.)

#!/bin/perl use strict; use warnings; use Bio::Seq; use Data::Dumper::Simple; use feature "say"; # Convert the sequence to lower case. Upper Case might be ok, # but the docs for Bio::Seq used lower case, so let's go with that. my $letters = lc("TTCAGGTGTTTGCAACTGCGTTTTATTGCAAGAAAGAGTGGAGGGGTTTCCA +TGGGGCCCACCTCACAACCCACTC TTCACCCCCAAAATCACGCAGGGATCGGACTCAGGAAAGGGAAG +CATCTGTGTGTTGCATACGAGCCCTTCCTGTACTTACTTCTTTCACAGCAGGGAAGG AAGAGGGAAGA +GGCAGCTGTGGAGAGGATCAGGTTGCGGGAGGTGGGTATCTCGCTGCTCTGACCTTACGTACAGTCCTC +CACAGAAGCATCAAAGTGGACT GGCACATATCGGCTCCCTTCACAGGCCACAATCATCTGTCTCTCCT +TCGGGCTGGTCCGGTATCCAC"); #Create a sequence object. my $seq_object = Bio::Seq->new(-seq => $letters, -alphabet => 'dna' ); #Look for the ORF. I specified the start, but I didn't see how to #specify the stop. Are the stop codons universal? I'm way out of #my league here. $prot_object = $seq_object->translate( -orf => 1, -start => "atg" ); say Dumper $prot_object;

Cheers,

Brent

-- Yeah, I'm a Delt.

Replies are listed 'Best First'.
Re^2: REGEX help
by karlgoethebier (Abbot) on Apr 21, 2018 at 16:21 UTC

    One must be the volunteer. So i forced a cpanm install and only added a my you forgot. Unfortunately the script crashed the hard way:

    ------------- EXCEPTION ------------- MSG: Failed validation of sequence '[unidentified sequence]'. Invalid +characters were: STACK Bio::PrimarySeq::validate_seq /Users/karl/perl5/perlbrew/perls/p +erl-5.24.1threads/lib/site_perl/5.24.1/Bio/PrimarySeq.pm:338 STACK Bio::PrimarySeq::_set_seq_by_ref /Users/karl/perl5/perlbrew/perl +s/perl-5.24.1threads/lib/site_perl/5.24.1/Bio/PrimarySeq.pm:287 STACK Bio::PrimarySeq::seq /Users/karl/perl5/perlbrew/perls/perl-5.24. +1threads/lib/site_perl/5.24.1/Bio/PrimarySeq.pm:272 STACK Bio::PrimarySeq::new /Users/karl/perl5/perlbrew/perls/perl-5.24. +1threads/lib/site_perl/5.24.1/Bio/PrimarySeq.pm:229 STACK Bio::Seq::new /Users/karl/perl5/perlbrew/perls/perl-5.24.1thread +s/lib/site_perl/5.24.1/Bio/Seq.pm:496 STACK toplevel ./bio.pl:16 -------------------------------------

    Just for curiosity. Anyway - too bad. This stuff is PITA...

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

      Take the spaces out of $letters and you should get

      $prot_object = bless( { 'primary_seq' => bless( { 'length' => 63, '_root_verbose' => 0 +, '_nowarnonempty' => +undef, 'seq' => 'MGPTSQPTLH +PQNHAGIGLRKGKHLCVAYEPFLYLLLSQQGRKREEAAVERIRLREVGISLL*', 'alphabet' => 'prote +in' }, 'Bio::PrimarySeq' ) +, '_root_verbose' => 0 }, 'Bio::Seq' );

      whatever that means !

      poj
        karlgoethebier and poj,

        Thank you for cleaning up my mess and throwing the code over the finish line.

        Cheers,

        Brent

        -- Yeah, I'm a Delt.
        "Take the spaces out...whatever..."

        D'oh! Thanks and best regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

        perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1213297]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-25 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found