Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nouse
    Member
    • Sep 2013
    • 11

    #1

    Renaming of Fasta headers according to their container name

    Hi there,
    i am a somewhat beginner in bioinformatics, so please apologize if i am asking any silly questions.

    I do have several dozens of files containing millions of processed illumina reads. The sequences have already been converted to fasta format.
    Now i want to bin all my files into a single file, in order to have a uniform OTU nomenclature (i want to feed my otu picker with a single file).
    I will use a normal cat command for merging all my files.
    However, i cant think of commands, that
    a) add an additional character (the number of sample) to any fasta header in the file
    b) later on, after OTU picking, sort all sequences containing that same identifier into a new file.

    I cant use the barcode information in the header, because several barcodes have been used multiple times.

    Any idea? Thank you very much!
  • robinweide
    Junior Member
    • Sep 2013
    • 9

    #2
    I would check the FastX toolskit, which has a renamer-tool in it: http://hannonlab.cshl.edu/fastx_tool...mmandline.html.

    Edit: http://www.biostars.org/p/68477/ has more options for renaming headers.

    Comment

    • mcnelson.phd
      Senior Member
      • Jul 2011
      • 162

      #3
      If all of your samples are in separate files, then you can use a simple sed command to add sample info to the fasta header for each sequence in a file as follows:

      Code:
       sed 's/^>/>SampleA/g' INFILE.fasta>OUTFILE.fasta
      That will add SampleA to the header for all sequences in the file, and you can just repeat that command for as many files/samples as you have.

      For your second task, you can use a grep command as follows:

      Code:
       grep -a1 '^>SampleA' INFILE.fasta>OUTFILE.fasta
      That will find all lines in your concatenated file that begin with >SampleA, and then print that line and the following line (the sequence) into a new file. Again, you would have to execute the grep command for each different sample to produce a fasta file for each.

      All of that is quite a lot of work, even if you shell script it, so you might want to take advantage of some of the scripts that are a part of the QIIME package, most importantly add_qiime_labels.py which takes a folder of fasta files and a sample mapping file and adds sample IDs to the fasta headers and concatenates the output into one file.

      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, Yesterday, 10:52 AM
      0 responses
      9 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-14-2026, 05:39 AM
      0 responses
      19 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-13-2026, 09:56 AM
      0 responses
      16 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-09-2026, 11:14 AM
      0 responses
      27 views
      0 reactions
      Last Post SEQadmin2  
      Working...