laziness, impatience, and hubris PerlMonks

### Urgent : Biological problem

by Bharat_Bioinfo (Initiate)
 on Aug 23, 2011 at 09:04 UTC ( #921846=note: print w/replies, xml ) Need Help??

Hello Monks Greetings

My name is Bharat yadav and I am a researcher in Punjab Agricultural University - Ludhiana.

I am facing a problem regarding perl.

I know this will consume your time... but your favour and expertise helps me a lot

I am trying to make a perl script which let me know the location of the coordinates of 384 well array.

We do have 2 types of plates one is 384 well plate and second 96 well.

The dimensions of 384 well plate having 24 columns (1,2,3...24) and 16 rows (A,B,C...P)

Where as 96 well plate has 12 columns (1,2,3..12) and 8 rows (A,B,C..H)

these 384 well plates contains 4 different types of samples which were transferred into four 96 well plate.

The big problem is the four samples in 384 well plates which are alternatively arranged in the plate

Suppose we have four samples like B1, B2, B3 and B4

so

B1_XX01 is placed in A1

B1_XX02 is placed in C1

and so on upto O1..

the remaining samples of B1 is now filled in next to

next column i.e.

B1_XX09 is placed in A3

B1_XX10 is placed in C3

and so on up to 96 samples were filled

Similarly Sample B2_SS01 is placed in A2

B2_SS02 is placed in C2

and so on upto O2..

the remaining samples of B2 is now filled in next to

next column i.e.

B2_SS09 is placed in A5

B2_SS10 is placed in C5

and so on up to 96 samples were filled

B3_AA01 is placed in B1

B3_AA02 is placed in D1

and so on upto O1..

the remaining samples of B3 is now filled in next to

next column i.e.

B3_AA09 is placed in B3

B3_AA10 is placed in D3

and so on up to 96 samples were filled

Similarly Sample B4_ZZ01 is placed in B2

B4_ZZ02 is placed in D2

and so on upto O2..

the remaining samples of B4 is now filled in next to

next column i.e.

B4_ZZ09 is placed in B5

B4_ZZ10 is placed in D5

and so on up to 96 samples were filled

Now each plate has a single type of sample in 96 well plate and plates were named as Plate1, Plate2, Plate3 and Plate4

The query been asked from any of these four plates and need to check form which well of this query has been come form 384 well plate. we need its coordinates location

The main input for this program is a tab delimited text file which has 16X24 names like B*_**01, etc.

I just want a program which reads all entries form input file and split in the distributed fashion as mentioned above, and the program stores all the entries of four samples in four plates (either temporary), ie plate-1 has all 12X8 B1 Samples, plate-2 has all 12X8 B2 Samples plate-3 has all 12X8 B3 Samples ,plate-4 has all 12X8 B4 Samples.

There is a module exist which can help regarding this problem named LIMS::MT_Plate. and according to this the distribution that I mentioned above is default quadrant offset. Here I am unable to distribute my 384 samples to 4 plates of 96 samples

I am kindly requesting to help me

program should be run like

perl well_identifier.pl testdata Plate3 b5

here well_identifier.pl is name of program

testdata is tab delimited text file

Plate3 is the Plate no 3 which contains All B3 samples

b5 is the query

and "BAC_384_data_input_file" is our input file containing 384 entries of all four samples

So with this query I want to figure the location of the entry containing in 10 C of Plate-3 in the 384 well plate. the answer of this query printed on the terminal as 19 E of 384 well plate

Hope that you are now able to understand problem... If dont then please ask me the confusion...

Here is my code

```if(@ARGV < 3) {
print "USAGE:: well_identifier.pl <Input file (BAC's 384 tab delim
+ited text file)> <Plate Number (Plate1/Plate2,Plate3 or Plate4)> <Que
+ry (i.e. b2> \n**************Use this program to extract Well locatio
+n of 96 well plate from 384 well plate***********\n";
exit;
}
use Data::Dumper;
use LIMS::MT_Plate;
use Microarray;

my \$inputfile = \$ARGV[0];
my \$queryplate = \$ARGV[1];
my \$plateno = \$ARGV[2];
my \$query = \$ARGV[3];

open(IN,\$inputfile) || die "cant open file";
@data=<IN>;
close(IN);

foreach \$line(@data)
{
chomp(\$line);
#print"\$line";
#print "till now...its working \n";
\$oPlate1 = mt_plate->new('Plate1',96);
\$oPlate2 = mt_plate->new('Plate2',96);
\$oPlate3 = mt_plate->new('Plate3',96);
\$oPlate4 = mt_plate->new('Plate4',96);

\$oPlate1->fill_wells(\@samples1);
\$oPlate2->fill_wells(\@samples2);
\$oPlate3->fill_wells(\@samples3);
\$oPlate4->fill_wells(\@samples4);

\$oPlate5 = mt_plate->new('Plate5',384);
\$oPlate5->import_mt_plate_file('mt_plate_file',\$inputfile);

#\$oPlate5->join_plates(\$oPlate1,\$oPlate2,\$oPlate3,\$oPlate4);

#\$sample_name = \$oPlate5->get_sample_name('b2');
#\$sample_name = \$oPlate5->get_sample_name(\$query);
print "The sample \$query placed in \$queryplate is the location \$sample
+_name of Master Plate\n";

}

I am unable to distribute the 4 sample quadrant offset as described above

Thanks in anticipation

Warm regards from

Replies are listed 'Best First'.
Re: Urgent : Biological problem
by DrHyde (Prior) on Aug 23, 2011 at 09:39 UTC

TL;DR

You will no doubt get a lot more and better responses if you reduce the problem and information to the minimum required.

You should also try to think of a better title. "Urgent" - urgent for you, maybe, but not for anyone else. "Biological problem" - well, if you have a biological problem, I suggest that you go and visit your GP :-) Most of us aren't biologists. We don't particularly care that you work in biology, no more than we care that people work in finance or construction or broadcasting. We're interested in the data structures and algorithms.

Thankyou Sir, for your kind suggestions. I apologize for all these mistakes. I should not repeat it again.

Re: Urgent : Biological problem
by Anonymous Monk on Aug 23, 2011 at 09:59 UTC

I notice you're referencing a few undefined variables (@sample1 ...), if you add strict/warnings, they'll warn you about that and other things, and in the process cut your development time in half!

I'd like to help, but your problem description is too long and wordy for me :)

Please read How do I post a question effectively? and post short sample input, expected/wanted output, actual output, and explain how the actual output of your program doesn't match the expected/wanted output.

You might write something like this

```#!/usr/bin/perl --
use strict;
use warnings;
use Data::Dumper;
#~ use LIMS::MT_Plate;
#~ use Microarray;
use autodie; # dies if open/close... fail

Main( @ARGV );
exit( 0 );

sub Main {
if ( @_ == 3 ) {
print BreakSomePlates(@_);
} else {
Demo();
print Usage();
}
} ## end sub Main

sub BreakSomePlates {
my( \$infile, \$queryplate, \$plateno, \$query ) = @_;
open my (\$inFh),  '<', \$infile;
while(my \$line = <\$inFh>){
chomp \$line;
WalkThe( \$line );
}
#~     return "The sample \$query placed in \$queryplate is the location
+ \$sample_name of Master Plate\n";
}

sub WalkThe { rand 666 }

sub Demo {
my ( \$Input, \$WantedOutput )  = DemoData();
my \$Output = BreakSomePlates( \$Input, qw' plate 1 b2 ');
require Test::More;
Test::More->import( qw' no_plan ' );
Test::More::is( \$Output , \$\$WantedOutput, ' BreakSomePlates works
+as designed ' );
}

sub Usage {
<<'__USAGE__';

NAME
well_identifier.pl - extract well location ...

USAGE
well_identifier.pl
well_identifier.pl infile platename platenumber query
well_identifier.pl infile Plate1/Plate2 b2
...

ARGUMENTS
- infile
path to BAC's 384 tab delimited text file
- Plate Number
Plate1/Plate2,Plate3 or Plate4
- Query
i.e. b2

__USAGE__

}

sub DemoData {

my \$Input = <<'__One__';
something
__One__

my \$ExpectedOutput = <<'__Two__';
blah blah
__Two__

return \\$Input, \\$ExpectedOutput ;
}
__END__
not ok 1 -  BreakSomePlates works as designed
#   Failed test ' BreakSomePlates works as designed '
#   at pm.921846.pl line 40.
#          got: ''
#     expected: 'blah blah
# '

NAME
well_identifier.pl - extract well location ...

USAGE
well_identifier.pl
well_identifier.pl infile platename platenumber query
well_identifier.pl infile Plate1/Plate2 b2
...

ARGUMENTS
- infile
path to BAC's 384 tab delimited text file
- Plate Number
Plate1/Plate2,Plate3 or Plate4
- Query
i.e. b2

1..1
# Looks like you failed 1 test of 1.

Thanks sir for guiding me. You have suggested a better way to describe a problem particularly the Usage subrutine. Form on-words I"ll try to use this method in my scripts. I apologize for writing long problem. My efforts were only to make my problem understandable to IT expert and perl monks and that is why I have write details

Re: Urgent : Biological problem
by pvaldes (Chaplain) on Aug 23, 2011 at 11:17 UTC

Well, I'm trying also to understand the problem

Although this is not directly related with your question, it looks to me that is the same problem as to find an unique name to each seedling of each seed tray in a greenhouse, all cells must be different, so you have a matrix for each plate, and them you need a parent hash covering all matrixes.

You could have either a "parent" hash with samples=Keys and cells=values or either want a hash when plate cells will be keys and values = sample tags. I think the former is better cause you can't repeat a sample tag, but you can have four cells named B5 in different trays

So if I'm not wrong this is a problem related with

1- to assign tags according some rules to each key/element of a hash of hashes. Something like to identify the sample_BXC35 (key) with its hash value "i'm-the-cell-AF23-in-the-fourth-small-sized-plate"

2 - to print a tridimensional hash, a hash of hashes covering all your "seed-trays"

And now the samples,

maybe we could see easier graphically

Distribution of the first sample "x"

BIG plate 24x16 cells.
```   A  B   C  D  E   ...  M   N  O   P
1 x1  .  x2  . x3   ... x7   .  x8  .
2 ---------------------------------------- # row of separation
3 x9  .  x10 . x11  ... x15  .  x16 .
4 ----------------------------------------
5 x17 .  x18 .           ...etc
6 ----------------------------------------
...
24

Distribution of the second sample "y": first you fill the spaces between the first sample, ok

```   A  B   C  D  E  F    ...   N  O   P
1  . y1  .  y2  . y3    ...  y7   .  y8
2 ---------------------------------------- # row of separation
3  .
4 ---------------------------------------- # row of separation
5  y9
24
and then, all seems too random and confusing to me, y9 should be in B2, but you say this is in A5. Can you explain better this? (Forget the complicated names, call the samples simply: first, second, third and fourth or w,x,y and z if you prefer)
Re: Urgent : Biological problem
by perl.j (Pilgrim) on Aug 23, 2011 at 14:11 UTC
--perl.j

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://921846]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2023-10-04 23:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?