Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aniben
    Junior Member
    • Jan 2015
    • 2

    #1

    Fasta name changes

    I have a word file with 222 pages worth of fasta genes... that adds up. The phylogenetic program I plan to use doesn't like a long FASTA header all that much, so I have to change it to something less than 10 characters. considering the large number of genes I have in the document, I would like to know a way to change all these names in a quicker manner than just manually changing each and every one. I'm aware that building a program can solve this, but I only have introductory experience in python. Any advice? Thanks!
  • rhinoceros
    Senior Member
    • Apr 2013
    • 372

    #2
    First of all, you should not have sequence data in a word file. That is just asking for trouble. Second, you can easily edit the fasta headers in the *nix command line, given that your sequences are in a plain text file. So put your seqs into a proper text file and then post example headers and what you want them to look like..
    savetherhino.org

    Comment

    • dariober
      Senior Member
      • May 2010
      • 311

      #3
      Originally posted by aniben View Post
      I have a word file with 222 pages worth of fasta genes...
      Do you mean MS Word document? If so, save it as text file. When asked, use "LF only" as newline character. As an aside, don't keep sequence or any other sort of data in Word documents, you are going to make your bioinformatic life really complicated with that!

      The phylogenetic program I plan to use doesn't like a long FASTA header all that much, so I have to change it to something less than 10 characters.
      Are you sure only 10 characters are allowed? That sounds a bit weird... Anyway, if you really want to cut sequence names short you could use this crude way:

      Code:
      awk '{if($0 ~ /^>/){x= substr($0, 1, 10); print x} else {print $0}}' seq.fa.txt > shortnames.fa
      Replace 10 with the desired number of chars to keep, seq.fa.txt is the text file saved as above.

      Comment

      • Brian Bushnell
        Super Moderator
        • Jan 2014
        • 2709

        #4
        With BBTools:

        bbrename.sh in=old.fasta out=new.fasta

        That will rename the reads as 1, 2, 3, 4, ... 222.

        You can also give a custom prefix if you want. The input has to be text format, not .doc.

        Comment

        • aniben
          Junior Member
          • Jan 2015
          • 2

          #5
          Ok, thanks. Making it to a text file won't be all that much of a problem.

          Comment

          • GenoMax
            Senior Member
            • Feb 2008
            • 7142

            #6
            As you make these changes keep in mind that those 10 characters have to be unique (and logical enough for you to understand the trees afterwards) otherwise the phylogenetic program may not like it.

            How many sequences do you have in that file? Are they all unique? It may be easier to name them 1,2,3 .. based on Brian's suggestion and then convert back to real names once you complete the analysis (photoshop?)

            Comment

            • GenoMax
              Senior Member
              • Feb 2008
              • 7142

              #7
              Originally posted by dariober View Post
              Are you sure only 10 characters are allowed?
              Some established phylogenetic programs (phylip) do have this requirement.

              Comment

              Latest Articles

              Collapse

              • SEQadmin2
                Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                by SEQadmin2



                Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                ...
                10-14-2026, 09:55 AM
              • SEQadmin2
                New Genomics Technologies Take Aim at Long-Standing Limits
                by SEQadmin2


                Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                ...
                09-28-2026, 10:25 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 10-22-2026, 11:13 AM
              0 responses
              23 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-22-2026, 10:48 AM
              0 responses
              20 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-15-2026, 10:52 AM
              0 responses
              36 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-14-2026, 05:39 AM
              0 responses
              42 views
              0 reactions
              Last Post SEQadmin2  
              Working...