[Bioperl-l] Please help
Brian Osborne
brian_osborne at cognia.com
Sat Oct 15 11:34:17 EDT 2005
Angshu,
Take a look at the documentation on selectcol_arrayref() ("perldoc DBI").
$seq is a reference to an array, in order to get to the records or data in
that array you need to dereference it, something like:
for $sequence ( @{$seq} ) {
# SeqIO stuff
}
Please include error messages in your emails.
Brian O.
On 10/15/05 11:09 AM, "Barry Moore" <bmoore at genetics.utah.edu> wrote:
>
>
>
>
> -----Original Message-----
> From: Angshu Kar [mailto:angshu96 at gmail.com]
> Sent: Friday, October 14, 2005 1:38 PM
> To: Barry Moore
> Subject: Re: [Bioperl-l] Please help
>
>
>
> Hi Barry,
>
> I've written the follwing code:
>
> use DBI;
> use Bio::SeqIO;
>
> my $db_host = 'YYYYYY;
> my $db_user = 'WWWW';
> my $db_pass = 'XXXXXX';
> my $db_name = ''ZZZZZ';
>
> # Connect to a PostgreSQL database.
> my $db = "dbi:PgPP:dbname=${db_name};host=${db_host}";
>
> # Connect to database.
> $dbh = DBI->connect($db, $db_user, $db_pass,
> { RaiseError => 1, AutoCommit => 0 }
> ) || die "Error connecting to the database: $DBI::errstr\n";
>
> # My query.
> my $query = "select seq from biosequence where biosequence_id = 12";
>
> # Run query.
> $seq = $dbh->selectcol_arrayref($query);
>
> # Convert the raw string to fasta
> $in = <$seq>;
>
> #$in = Bio::SeqIO->new($seq,
> # -format => 'raw');
> $out = Bio::SeqIO->new($seq,
> -seq_name => "ABCDE01",
> -format => 'Fasta');
>
> # Print results.
> print join("\n", @$seq);
>
> Everything was running fine before I tried to convert the raw sequecne
> into fasta using the code in bold. Could you please let me know where
> I'm going wrong?
>
>
>
> Thanks,
> Angshu
>
>
>
> On 10/13/05, Barry Moore <bmoore at genetics.utah.edu> wrote:
>
> Angshu-
>
> Brain is right, you need to read the documentation and ask a more
> specific question on the list. I'll suggest a few extra modules for you
>
> to study along with the ones Brian told you about. Look for the non-bio
> modules on CPAN http://search.cpan.org/. BTW, the project you've
> described and the modules that you will need to use will be a challenge
> to jump straight into if you've never used perl at all before. You will
> almost certainly want to start by reading some introductory and
> intermediate perl books (or the free perl documentation) The standard
> books for perl beginners is Learning Perl by Randal Schwartz et al. and
> the standard perl Bible is Programming Perl by Larry Wall et al. You
> will want read at least the first one and have the second one handy as
> you jump into the documentation below.
>
> DBI, DBD::Pg and perhaps Class::DBI - For perl communicating with your
> database.
> Bio::SeqIO - For reading your sequences into Bioperl
> Bio::Tools::Run::Alignment::Clustalw - For aligning your sequences
> Bio::AlignIO::clustalw - For simple writing of the alignments.
>
> Depending on what you had in mind for scoring you may have to write your
> own code for that and the histogram display. Look at the GD module for
> your graphics needs. You mention several times that you want to display
> your results, and I'm going to guess you mean via a web site. I think
> CGI::Application is a great way to build the kind of database driven
> websites that I think you are considering here.
>
> Barry
>
>
> -----Original Message-----
> From: bioperl-l-bounces at portal.open-bio.org
> [mailto: bioperl-l-bounces at portal.open-bio.org
> <mailto:bioperl-l-bounces at portal.open-bio.org> ] On Behalf Of Brian
> Osborne
> Sent: Thursday, October 13, 2005 8:00 PM
> To: Angshu Kar; bioperl-l
> Subject: Re: [Bioperl-l] Please help
>
> Angshu,
>
> You need to study Bioperl's documentation. Take a look at relevant
> HOWTOs
> (Beginners, SeqIO, SearchIO perhaps). Also, install the bioperl-run
> package
> and look at the Bio::Tools::Run::Clustalw module.
>
> Brian O.
>
>
> On 10/12/05 3:48 PM, "Angshu Kar" < angshu96 at gmail.com> wrote:
>
>> Hi ,
>>
>> I'm completely new to perl. I'm have to work in biology using perl,
>> postgresql (as database) and clustalw(as the alignment
>> tool). I'm stating my problem briefly:
>>
>> In the postgresql db the data is clustered using complete linkage
>> clustering. I've to connect to that db, fetch those data, feed it to
>> the multiple alignment tool, run it and show the results.Again,
>> feed those alignments into a scoring tool and show the results in
>> form of a histogram.All these needs to be automated using perl.
>> I've installed bio-perl but can't get how to write code using it.
>>
>> I'll be obliged if you help me with this by providing the idea of how
>> to feed the db data (in fasta format) into clustalw.
>>
>> Thanks,
>> Angshu
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at portal.open-bio.org
>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
More information about the Bioperl-l
mailing list