Perl en Español

  1. Home
  2. Tutoriales
  3. Foro
  4. Artículos
  5. Donativos
  6. Publicidad
 

Fichero FASTA

 
Publicar nuevo tema   Responder al tema    Foros de discusión -> Básico
Mensaje Sab Jul 05, 2008 12:54 pm
afry
Perlero Nuevo
Perlero Nuevo
Registrado: 05 Jul 2008
Mensajes: 11
Fichero FASTA Responder citando

Hola, estoy trabajando con un fichero FASTA que contiene una secuencia de ADN y he de localizar todos los codones de inicio (ATG) e indicar su posición. El problema es que no sé muy bien cómo hacerlo.
Gracias
Mensaje Sab Jul 05, 2008 6:35 pm
explorer
Moderador
Moderador
Registrado: 24 Jul 2005
Mensajes: 3841
Ubicación: Valladolid, España
Responder citando

Bienvenido a los foros de Perl en Español, afry.

Supongamos que tenemos el siguiente fichero en formato FASTA
Código:
> sample dna | (This is a typical fasta header.)
agatggcggcgctgaggggtcttgggggctctaggccggccacctactgg
tttgcagcggagacgacgcatggggcctgcgcaataggagtacgctgcct
gggaggcgtgactagaagcggaagtagttgtgggcgcctttgcaaccgcc
tgggacgccgccgagtggtctgtgcaggttcgcgggtcgctggcgggggt
cgtgagggagtgcgccgggagcggagatatggagggagatggttcagacc
cagagcctccagatgccggggaggacagcaagtccgagaatggggagaat
gcgcccatctactgcatctgccgcaaaccggacatcaactgcttcatgat
cgggtgtgacaactgcaatgagtggttccatggggactgcatccggatca
ctgagaagatggccaaggccatccgggagtggtactgtcgggagtgcaga
gagaaagaccccaagctagagattcgctatcggcacaagaagtcacggga
gcgggatggcaatgagcgggacagcagtgagccccgggatgagggtggag
ggcgcaagaggcctgtccctgatccagacctgcagcgccgggcagggtca
gggacaggggttggggccatgcttgctcggggctctgcttcgccccacaa
atcctctccgcagcccttggtggccacacccagccagcatcaccagcagc
agcagcagcagatcaaacggtcagcccgcatgtgtggtgagtgtgaggca
tgtcggcgcactgaggactgtggtcactgtgatttctgtcgggacatgaa
gaagttcgggggccccaacaagatccggcagaagtgccggctgcgccagt
gccagctgcgggcccgggaatcgtacaagtacttcccttcctcgctctca
ccagtgacgccctcagagtccctgccaaggccccgccggccactgcccac
ccaacagcagccacagccatcacagaagttagggcgcatccgtgaagatg
agggggcagtggcgtcatcaacagtcaaggagcctcctgaggctacagcc
acacctgagccactctcagatgaggaccta

Entonces con el siguiente programa
Perl:
#!/usr/bin/perl
use strict;
use warnings;

# Leer el fichero
open FICHERO, '<kk.fast' or die "$!\n";
my @lineas = <FICHERO>;
close FICHERO;

# Eliminamos las líneas que no nos interesan
# y creamos la secuencia
my $secuencia;
foreach ( @lineas ) {
    next if /^\s*$/;    # descartamos las líneas en blanco
    next if /^\s*#/;    # descartamos las líneas con comentarios
    next if /^>/;       # descartamos las líneas de cabecera

    $secuencia .= $_;
}
$secuencia =~ s/\s//g;  # quitamos todos los espacios

# Hacemos la búsqueda de los codones de inicio
my $posicion = -1;

do {
    $posicion = index( $secuencia, 'atg', $posicion+1 );
    if ( $posicion != -1 ) {
        print "Encontrado en la posicion $posicion\n";
    }
} while $posicion != -1 ;

__END__

El resultado es
Código:
Encontrado en la posicion 2
Encontrado en la posicion 69
Encontrado en la posicion 228
Encontrado en la posicion 238
Encontrado en la posicion 262
Encontrado en la posicion 289
Encontrado en la posicion 298
Encontrado en la posicion 345
Encontrado en la posicion 367
Encontrado en la posicion 379
Encontrado en la posicion 408
Encontrado en la posicion 505
Encontrado en la posicion 511
Encontrado en la posicion 538
Encontrado en la posicion 618
Encontrado en la posicion 729
Encontrado en la posicion 749
Encontrado en la posicion 795
Encontrado en la posicion 997
Encontrado en la posicion 1069


En estos foros hay más ejemplos de tratamiento de secuencias. Usa el enlace 'Busca' y busca por 'BioPerl'. Por ejemplo: http://perlenespanol.baboonsoftware.com/foro/viewtopic.php?t=722
Publicar nuevo tema   Responder al tema    Foros de discusión -> Básico Todas las horas son GMT - 6 Horas
Página 1 de 1



Powered by phpBB © 2001, 2005 phpBB Group