I have solved the problem with 2 arrays. @p_prov contain the positions for one only chromosome, and %p has the before and after genes for all chromosomes.
Then, I add the first gene ($p_prov[0]) to the last element. But the first element has already the right before and after genes, because...
I have just realize that mi circle chromosome will have 2 repeated element in the ends. Will it work? If it doesn't work, I will include a sub-name to these 2 elements.
Thanks, it is a nice code. I will compare both of them, and I will try to understand the map function.
My array contains the first element in the last position too, and the last element in the first position. So I have something similar to a circle.
Thanks again and salu2,
Threepwood.
My chromosome size could grow very much, with new ones, and so it would take a lot of memory. But it seems as a nice alternative. Thanks!
Please somebody could explain the 'map' alternative?
I will now try your code, Kevin.
Salu2,
Threepwood.
Well the array contains a list of gene identifiers, ordered by the position in the chromosome (similar to a line):
@positions = (P122343,Q281170,X726001,...);
And $id is one of them. I have a list of genes and I want to know what are both the previous and the following genes to each one.
The...
Sorry, could you explain the code. I am a little novice in this kind of code :-(
I have tried this one, but it doesn't work:
$i=0;
$a="c";
@array = (a,b,c,d,e,f);
print map{$index{$a}=$i++}@array;
I have a static array and I need call to my subrutine many, many times:
my ($before, $after)...
Thanks, I have tested the code from the brigmar's link, and it naturally works:
my( $found, $index ) = ( undef, -1 );
for( $i = 0; $i < @array; $i++ )
{
if( $array[$i] =~ /Perl/ )
{
$found = $array[$i];
$index = $i;
last;
}
}
But I thoughted that there was a way similar to the...
Hi, I would like to take the index from an array, if I know the value.
E.g. I have the array:
@var = (a,b,c,d,e);
and I would like to know the position of the element 'c' into the array (i.e. 3). Is there any way to get this one with 'grep' or another function?
Salu2 and thanks in advance...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.