in reply to Re^2: remove part of string (DNA)
in thread remove part of string (DNA)

I am not a Perl expert, and have learned from many authors on PerlMonks, including both BrowserUK and sundialsvc4.

If the comments by sundialsvc4 are inaccurate or not appropriate for the OP's problem, please tell us why. Pre-sorting the data seems like good advice to me, but I don't have your experience and knowledge of Perl. Please enlighten.

Thanks.

  • Comment on Re^3: remove part of string (DNA) ... More off-topic

Replies are listed 'Best First'.
Re^4: remove part of string (DNA) ... More off-topic
by BrowserUk (Patriarch) on Apr 12, 2011 at 19:15 UTC
    Pre-sorting the data seems like good advice to me,

    It is quite the opposite of good advice. Ie very bad advice.

    1. Sorting is O(N logN). The OPs described processing is O(N).

      Sorting does not help the OPs processing at all.

    2. FASTA file are multi-line record format files.

      If you sorted a FASTA file with the system sort utility, it would screw the file up in a completely irrecoverable way.

      Eg. This:

      c:\test>type 845226.fasta >uc002yje.1 chr21:13973492-13976330 cccctgccccaccgcaccctggattactgcacgccaagaccctcacctga acgcgccctacactctggcatgggggaacccggccccgcagagccctgga CTCTGACATTGGAGGACTCCTCGGCTACGTCCTGGACTCCTGCACAAGAG >uc002yje.1 chr21:13973492-13976330 cccctgccccaccgcaccctggattactgcacgccaagaccctcacctga acgcgccctacactctggcatgggggaaaaaacccggccccgcagagccctgga CTCTGACATTGGAGGACTCCTCGGCTACGTCCTGGACTCCTGCACAAGAG >uc002yje.1 chr21:13973492-13976330 cccctgccccaccgcaccctggattactgcacgccaagaccctcacctga acgcgccctacactctggcatgggggaacccggccccgcagagggccctgga CTCTGACATTGGAGGACTCCTCGGCTACGTCCTGGACTCCTGCACAAGAG

      becomes this:

      c:\test>sort 845226.fasta >uc002yje.1 chr21:13973492-13976330 >uc002yje.1 chr21:13973492-13976330 >uc002yje.1 chr21:13973492-13976330 acgcgccctacactctggcatgggggaaaaaacccggccccgcagagccctgga acgcgccctacactctggcatgggggaacccggccccgcagagccctgga acgcgccctacactctggcatgggggaacccggccccgcagagggccctgga cccctgccccaccgcaccctggattactgcacgccaagaccctcacctga cccctgccccaccgcaccctggattactgcacgccaagaccctcacctga cccctgccccaccgcaccctggattactgcacgccaagaccctcacctga CTCTGACATTGGAGGACTCCTCGGCTACGTCCTGGACTCCTGCACAAGAG CTCTGACATTGGAGGACTCCTCGGCTACGTCCTGGACTCCTGCACAAGAG CTCTGACATTGGAGGACTCCTCGGCTACGTCCTGGACTCCTGCACAAGAG

      And so is rendered entirely useless.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^4: remove part of string (DNA) ... More off-topic
by Furor (Novice) on Apr 13, 2011 at 08:04 UTC
    BrowserUK is right (identifier and sequence should remain together), but they'll be sorted before exporting them to a fasta file. But I don't think it would really make a difference in speed anyway.