Reorganizando seqüências de caracteres em ordem numérica

0

Eu tenho vários arquivos de texto como este:

>nexus0013_Pseudomonas_59M
NNNNNNNNNNNNNNNNNNNNNNNNNNNTTGCTAGGTGCCCTGCGCTTCCCTGTGGCTGCCGCCTGGGCCGCCGAGCTCCGCCAGGAACTGCCGGGGGGCACGCAGACCTGGAGCAGCGAAGAACTGCTCAGGCATCCGCAGGCCCGCGACCTGGACATCCCGGCCGACGTCGCCTACCGCCGGAACATGCGCTACCGCGCCGTGCCACTGGCGGCCTTGTTGAAAGGCGTGCATCCCGAAGACCATTTGCAGGCCGTGGCCAGCGATGGCTTCGCCGCCGAGTTGCCGGCCGCCCCGCTGCTCGCCGAACAGGGCTCGCAAGCCTGGCTGGCGATAGAGGATCCGCAGCGCCCCTGGCCGCCGTTGGGCGCCGGCAAGCCGTCCGCCGGGCCGTTCTATCTGGTCTGGAGCAAACCCGAGGAAAAACGCATCGGTCCGGAGCAATGGCCCTTCCAGGTCGTCCGCATCCGCTATCAGCCCCCTCTGGCCGAACGCTTCCCGGCCCTGCTGCCGGCCGCCGACGCCAGCGCGGAAGTGCGCGCCGGCTTCGCCGTGTTCCAGAAGAACTGCCTGGCCTGCCACCGTCTCAACGGTGCCGGCGACGCCCAGTTCGGCCCGGACCTGAACCTGCCGTACAACCCCACCGAGTACTTCCAGCCGCAATTCCTCTCCCGCTACATCCGCGACCCGCAGGCGCTGCGGCAATGGCCACAGGCGAAAATGCCGGCGTTCCCGGAACGGGTGATCGACGACCAGGAGTTGCGCCAGTTGATCGGCTACTTGCGCCACATGGCCGGCCGCAAGGCGGGCGCGGCCGGCTGA
>nexus0013_Pseudomonas_62M
ATGCCTGTCACTCTCCCGCGCCTGGCGTTGCTAGGTGCCCTGCTCTTCCCTGTGGCTGCCGCCTGGGCCGCCGAGCTCCGCCTGGAACTGCCGGGGGGCACGCAGACCTGGAGCAGCGAAGAACTGCTCAGGCATCCGCAGGCCCGCGACCTGGACATCCCGGCCGACGTCGCCTACCGCCGGAACATG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TGAACCTGCCGTACAACCCCACCGAGTACTTCCAGCCGCAATTCCTCTCCCGCTACATCCGCGACCCGCAGGCGCTGCGGCAATGGCCACAGGCGAAAATGCCGGCGTTCCCGGAACGGGTGATCGACGACCAGGAGTTGCGCCAGTTGATCGGCTACTTGCGCCACATGGCCGGCCGCAAGGCGGGCGCGGCCGGCTGA
>nexus0013_Pseudomonas_61M
ATGCCTGTCACTCTCCCGCGCCTGGCGTTGCTAGGTGCCCTGCTCTTCCCTGTGGCTGCCGCCTGGGCCGCCGAGCTCCGCCTGGAACTGCCGGGGGGCACGCAGACCTGGAGCAGCGAAGAACTGCTCAGGCATCCGCAGGCCCGCGACCTGGACATCCCGGCCGACGTCGCCTACCGCCGGAACATGCGCTACCGCGCCGTGCCACTGGCGGCCTTGTTGAAAGGCGTGCATCCCGAAGACCATTTGCAGGCCGTGGCCAGCGATGGCTTCGCCGCCGAGTTGCCGGCCGCCCCGCTGCTCGCCGAACAGGGCTCGCAAGCCTGGCTGGCGATAGAGGATCCGCAGCGCCCCTGGCCGCCGTTGGGCGCCGGCAAGCCGTCCGCCGGGCCGTTCTATCTGGTCTGGAGCAAACCCGAGGAAAAACGCATCGGTCCGGAGCAATGGCCCTTCCAGGTCGTCCGCATCCGCTATCAGCCCCCTCTGGCCGAACGCTTCCCGGCCCTGCTGCCGGCCGCCGACGCCAGCGCGGAAGTGCGCGCCGGCTTCGCCGTGTTCCAGAAGAACTGCCTGGCCTGCCACCGTCTCAACGGTGCCGGCGACGCCCAGTTCGGCCCGGACCTGAACCTGCCGTACAACCCCACCGAGTACTTCCAGCCGCAATTCCTCTCCCGCTACATCCGCGACCCGCAGGCGCTGCGGCAATGGCCACAGGCGAAAATGCCGGCGTTCCCGGAACGGGTGATCGACGACCAGGAGTTGCGCCAGTTGATCGGCTACTTGCGCCACATGGCCGGCCGCAAGGCGGGCGCGGCCGGCTGA

Eu quero ordenar tanto o cabeçalho (tudo depois de ">") quanto sua sequência correspondente na linha seguinte, para que eles acabem ficando em ordem numérica crescente como esta:

>nexus0013_Pseudomonas_53M
ATGCCTGTCACTCTCCCGCGCCTGGCGTTGCTAGGTGCCCTGCTCTTCCCTGTGGCTGCCGCCTGGGCCGCCGAGCTCCGCCTGGAACTGCCGGGGGGCACGCAGACCTGGAGCAGCGAAGAACTGCTCAGGCATCCGCAGGCCCGCGACCTGGACATCCCGGCCGACGTCGCCTACCGCCGGAACATGCGCTACCGCGCCGTGCCACTGGCGGCCTTGTTGAAAGGCGTGCATCCCGAAGACCATTTGCAGGCCGTGGCCAGCGATGGCTTCGCCGCCGAGTTGCCGGCCGCCCCGCTGCTCGCCGAACAGGGCTCGCAAGCCTGGCTGGCGATAGAGGATCCGCAGCGCCCCTGGCCGCCGTTGGGCGCCGGCAAGCCGTCCGCCGGGCCGTTCTATCTGGTCTGGAGCAAACCCGAGGAAAAACGCATCGGTCCGGAGCAATGGCCCTTCCAGGTCGTCCGCATCCGCTATCAGCCCCCTCTGGCCGAACGCTTCCCGGCCCTGCTGCCGGCCGCCGACGCCAGCGCGGAAGTGCGCGCCGGCTTCGCCGTGTTCCAGAAGAACTGCCTGGCCTGCCACCGTCTCAACGGTGCCGGCGACGCCCAGTTCGGCCCGGACCTGAACCTGCCGTACAACCCCACCGAGTACTTCCAGCCGCAATTCCTCTCCCGCTACATCCGCGACCCGCAGGCGCTGCGGCAATGGCCACAGGCGAAAATGCCGGCGTTCCCGGAACGGGTGATCGACGACCAGGAGTTGCGCCAGTTGATCGGCTACTTGCGCCACATGGCCGGCCGCAAGGCGGGCGCGGCCGGCTGA
>nexus0013_Pseudomonas_54M
ATGCCTGTCACTCTCCCGCGCCTGGCGTTGCTAGGTGCCCTGCTCTTCCCTGTGGCTGCCGCCTGGGCCGCCGAGCTCCGCCTGGAACTGCCGGGGGGCACGCAGACCTGGAGCAGCGAAGAACTGCTCAGGCATCCGCAGGCCCGCGACCTGGACATCCCGGCCGACGTCGCCTACCGCCGGAACATGCGCTACCGCGCCGTGCCACTGGCGGCCTTGT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AGCCGCAATTCCTCTCCCGCTACATCCGCGACCCGCAGGCGCTGCGGCAATGGCCACAGGCGAAAATGCCGGCGTTCCCGGAACGGGTGATCGACGACCAGGAGTTGCGCCAGTTGATCGGCTACTTGCGCCACATGGCCGGCCGCAAGGCGGGCGCGGCCGGCTGA
>nexus0013_Pseudomonas_62M
ATGCCTGTCACTCTCCCGCGCCTGGCGTTGCTAGGTGCCCTGCTCTTCCCTGTGGCTGCCGCCTGGGCCGCCGAGCTCCGCCTGGAACTGCCGGGGGGCACGCAGACCTGGAGCAGCGAAGAACTGCTCAGGCATCCGCAGGCCCGCGACCTGGACATCCCGGCCGACGTCGCCTACCGCCGGAACATGCGCTACCGCGCCGTGCCACTGGCGGCCTTGTTGAAAGGCGTGCATCCCGAAGACCATTTGCAGGCCGTGGCCAGCGATGGCTTCGCCGCCGAGTTGCCGGCCGCCCCGCTGCTCGCCGAACAGGGCTCGCAAGCCTGGCTGGCGATAGAGGATCCGCAGCGCCCCTGGCCGCCGTTGGGCGCCGGCAAGCCGTCCGCCGGGCCGTTCTATCTGGTCTGGAGCAAACCCGAGGAAAAACGCATCGGTCCGGAGCAATGGCCCTTCCAGGTCGTCCGCATCCGCTATCAGCCCCCTCTGGCCGAACGCTTCCCGGCCCTGCTGCCGGCCGCCGACGCCAGCGCGGAAGTGCGCGCCGGCTTCGCCGTGTTCCAGAAGAACTGCCTGGCCTGCCACCGTCTCAACGGTGCCGGCGACGCCCAGTTCGGCCCGGACCTGAACCTGCCGTACAACCCCACCGAGTACTTCCAGCCGCAATTCCTCTCCCGCTACATCCGCGACCCGCAGGCGCTGCGGCAATGGCCACAGGCGAAAATGCCGGCGTTCCCGGAACGGGTGATCGACGACCAGGAGTTGCGCCAGTTGATCGGCTACTTGCGCCACATGGCCGGCCGCAAGGCGGGCGCGGCCGGCTGA

* Às vezes, há números ausentes, como 56M neste caso

    
por Manuel 11.08.2017 / 05:30

3 respostas

4

Usando sed :

sed -i -e 's/ /\n/' <(sort -n <(sed -e 'N;s/\n/ /' in.txt))

Explicações:

  • As sed -e 'N;s/\n/ /' in.txt partes, juntando cada duas linhas juntas com espaço único
  • A parte sort -n , realizando ordenação numérica
  • Em seguida, sed -e 's/ /\n/' , estamos dividindo a linha em duas linhas separadas de acordo com o espaço único entre elas.
  • O -i gravará as alterações no arquivo de entrada no local, usando -i.bak para fazer um backup do arquivo de entrada primeiro.
por 11.08.2017 / 07:01
3
awk '/^>/ { printf "%s ",$0; next; } { print; }' file1 | 
    sort -n |
    awk '{ print $1; print $2; }'
    
por 11.08.2017 / 05:43
2

Você pode usar a Schwartzian transform em Perl para fazer isso:

perl -ne '
   push @A, $_.=<>}{
   print for
    # Schwartzian transform
    map  { $_->[0] }             # recover the line
    sort { $a->[1] <=> $b->[1] } # do the sorting using the key 
    map  { [$_,/_(\d+)M$/m] }    # setup: line(zeroth-indexed) + sorting key(first index)
    @A;                          # operate on elements of array @A
' yourfile

Resultados

>nexus0013_Pseudomonas_53M
.....................................
>nexus0013_Pseudomonas_54M
.....................................
>nexus0013_Pseudomonas_55M
.....................................
>nexus0013_Pseudomonas_57M
.....................................
>nexus0013_Pseudomonas_58M
.....................................
>nexus0013_Pseudomonas_59M
.....................................
>nexus0013_Pseudomonas_60M
.....................................
>nexus0013_Pseudomonas_61M
.....................................
>nexus0013_Pseudomonas_62M
.....................................

coloque o arquivo em pares de linhas na matriz @A . Então, no eof, realizamos a manobra Schwartzian , "map- > sort- > map". Neste nós carregamos toda a linha + os dados de ordenação ao longo e no último passo da manobra, recuperamos a linha depois de ter sido ordenada. Portanto, para este caso, a chave de classificação é o número antes do M que fica no limite da linha. (Lembre-se que acrescentamos a próxima linha)

    
por 11.08.2017 / 11:43