Hello! I hope my problem is more complicated than the title suggests. I need to compare a series of 100 sequences with the original and the program should give me one number of identities. For example:
Original sequence: ATCGGGACG Stream 0: TCGTCAGCG Sequence 1: ATGCGAAAA
Then the program should print:
The sequence 0 has 2 identities The sequence 1 has 4 identities
My code requires a file containing the original sequence (you will note this at the biginning, where it says: "original.FASTA") so I don't know if you can work without it. Thanks already.
#!/usr/bin/perl -w #Lectura de archivo de secuencias $secuencia = 'original.FASTA'; #Abrir el archivo open (SECUENCIA, $secuencia); #Leer la secuencia @secuencia = <SECUENCIA>; close SECUENCIA; #Eliminar la línea de título. $secuencia[0]=""; #print "Esta es la secuencia:\n\n"; #print @secuencia; #Convertir el arreglo a una variable, con el comando join. $DNA = join('',@secuencia); #Concatenar las líneas: chomp @secuencia; $DNA =~ s/\n//g; #Quita los saltos de línea. $DNA =~ s/\s//g; print "La secuencia original es: \n\n",$DNA,"\n\n"; #Secuencias aleatorias $test="ACGT"; @DNA=split("",$test); for ($j=0; $j < 100; ++$j){ $salida=""; for ($i=0; $i < 541; ++$i){ $random=rand(length($test)); $salida=$salida.$DNA[$random]; } print ">Secuencia_$j\n$salida\n"; } exit;
In reply to Compare two variables by dmunoze
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |