Thank you for your reply, Nikhil.
Yes, I do understand how this sorting (numerical or alphabetical) and associated syntax works.
But I did not explain my question well enough 1st time around, so let me try again, this time with some examples (BEFORE sorting).
I have tried to present 4 different cases below, but I will explain only case 1 here in this e-mail.
my @a1 = qw ($ID1, $len1, $dom1, $domlen1, $seq1);
my @a2 = qw ($ID2, $len2, $dom2, $domlen2, $seq2);
my @a3 = qw ($ID3, $len3, $dom3, $domlen3, $seq3);
$line1 = /@a1;
$line2 = /@a2;
$line3 = /@a3;
my @array =qw ($line, $line2, $line3); # an array of array references.
I want to first sort @array by element [1] of @a1, @a2, @a3 i.e. $ID , then by element [2] - $dom, then by element [3] - $domlen, by element [4] - $seq (which would be an alphabetical sort) and finally by element [0] - $ID.
After this sort, I want to extract the "ID" from 1st de-referenced array, in @array
Was that a better explanation?
So for this scenario, I am unable to use the same syntax because my array is itself an array of references.
I know in principle its the same kid of sort, but I cant seem to get the syntax for it right... Could you please help?
Thank you!
Anand
| Array name |
ID |
Full isoform length |
# of domains |
total length of all FBDs |
full sequence |
| |
|
|
|
|
|
| case
1: chosen based on sorted length |
| @a1 |
a.1 |
100 |
3 |
48 |
MAEFR |
| @a2 |
a.2 |
125 |
3 |
46 |
MAEFR |
| @a3 |
a.3 |
100 |
3 |
46 |
MAEFR |
| |
|
|
|
|
|
| case
2: chosen based on sorted number of domains |
| @b1 |
b.1 |
100 |
3 |
41 |
MGAFD |
| @b2 |
b.2 |
100 |
4 |
45 |
MGAFRQ |
| @b3 |
b.3 |
100 |
3 |
46 |
MMGFRPP |
| @b4 |
b.4 |
100 |
3 |
42 |
MGAFD |
| |
|
|
|
|
|
| case
3: chosen based on sorted cumulative length of domain |
| @c1 |
c.1 |
130 |
2 |
48 |
MGAFARAF |
| @c2 |
c.2 |
130 |
2 |
80 |
MGAFARAF |
| |
|
|
|
|
|
| case
4: when all are equal, then choose the element by sorted IDs |
| @d1 |
d.1 |
200 |
3 |
46 |
MALETGD |
| @d2 |
d.2 |
200 |
3 |
46 |
MALETGD |
| @d3 |
d.3 |
200 |
3 |
46 |
MALETGD |
| @d4 |
d.4 |
200 |
3 |
46 |
MALETGD |