Ask a Question related to PERL Modules, Design and Development.
-
BD #1
find a first column value ...
203252 GB|AI461105 GB|AI900630 GB|AI900894 GB|AI901187
203253 GB|AI736220 GB|AW780891 GB|BE806781 GB|BG157087
203254 GB|AI440899 GB|AW185396 GB|AW185458 GB|AW152990
203255 GB|AI416923 GB|AI437726 GB|AI437966 GB|AI438062
203256 GB|AI441714 GB|AI930592 GB|AI855868 GB|AI856032
I am new with perl and my problam is if I give any accession no like
AW780891
than it should find the first column value like 203253.
IS any Module there to do this type of work ?
Thanks.
BD Guest
-
find null value in any column
Hi, Assume I have a table with only 1 row and all column is 'int'. I just wonder is it possible to use SQL to check if any one of those column... -
Find specific column names AND their values.
Okay, so I'm working on this project that tracks communities and how they're doing. The communities are judged based on their indicators. There... -
Find a column by name
How do I find a column in a grid by the name of the column? I find I'm constantly having to change the cell numbers because the order of the... -
How do I find the index of a DG column with a specific name?
I have a column called "notes" which may change position in the datagrid. How do I find the index of this column based on its name? -
how to Add different controls(textBox,DropDownList or some ) in the same column,based upon the value in the previous column (Say second Colum which contain dropdown with some values) ?
I am new to ASP.NET. I am facing problem with datagrid. I will explain prob now. In the datagrid the first column is name in the second... -
Brian McCauley #2
Re: find a first column value ...
BD wrote:What "type of work"? You mean parse a file and build an index? That's> 203252 GB|AI461105 GB|AI900630 GB|AI900894 GB|AI901187
> 203253 GB|AI736220 GB|AW780891 GB|BE806781 GB|BG157087
> 203254 GB|AI440899 GB|AW185396 GB|AW185458 GB|AW152990
> 203255 GB|AI416923 GB|AI437726 GB|AI437966 GB|AI438062
> 203256 GB|AI441714 GB|AI930592 GB|AI855868 GB|AI856032
>
> I am new with perl and my problam is if I give any accession no like
> AW780891
> than it should find the first column value like 203253.
> IS any Module there to do this type of work ?
rather general. So general that the interface to the module would be
close in complexity to a general programming language. But you apready
have a general purpose prgramming language - Perl. So just do it.
Actually for more complex parrsing tasks there are numerous modules to
help you, but even implementing the simplest grammar in, say,
Parse::RecDescent is orders of mangnitude more complex than your
starting problem.
Of course your problem is badly underspecified - what for example is
the significance of the string 'GB|'? Is the mapping many-to-one or
many-to-many? Where is the data comining from? Are you going to do one
look up or several?
use strict;
use warnings;
my %accession_index;
while (<DATA>) {
chomp;
my ($number, @accessions) = split;
$accession_index{$_}=$number for @accessions;
}
my $accession_number='AW780891';
print $accession_index{'GB|'.$accession_number},"\n";
__DATA__
203252 GB|AI461105 GB|AI900630 GB|AI900894 GB|AI901187
203253 GB|AI736220 GB|AW780891 GB|BE806781 GB|BG157087
203254 GB|AI440899 GB|AW185396 GB|AW185458 GB|AW152990
203255 GB|AI416923 GB|AI437726 GB|AI437966 GB|AI438062
203256 GB|AI441714 GB|AI930592 GB|AI855868 GB|AI856032
Brian McCauley Guest
-
Dr.Ruud #3
Re: find a first column value ...
BD schreef:
If you only need to find one value per run:> if I give any accession no like AW780891
> than it should find the first column value like 203253.
#!/usr/bin/perl
use strict;
use warnings;
while ( <DATA> )
{
/ ^ (\d+) .* [ ]GB[|] ${ARGV[0]} [ ] /x
and print "$1\n" and exit(0)
}
exit(1)
__DATA__
203252 GB|AI461105 GB|AI900630 GB|AI900894 GB|AI901187
203253 GB|AI736220 GB|AW780891 GB|BE806781 GB|BG157087
203254 GB|AI440899 GB|AW185396 GB|AW185458 GB|AW152990
203255 GB|AI416923 GB|AI437726 GB|AI437966 GB|AI438062
203256 GB|AI441714 GB|AI930592 GB|AI855868 GB|AI856032
--
Affijn, Ruud
"Gewoon is een tijger."
Dr.Ruud Guest
-



Reply With Quote

