Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #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


    • #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

      • seqadmin
        Essential Discoveries and Tools in Epitranscriptomics
        by seqadmin




        The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
        04-22-2024, 07:01 AM
      • seqadmin
        Current Approaches to Protein Sequencing
        by seqadmin


        Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
        04-04-2024, 04:25 PM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, Yesterday, 11:49 AM
      0 responses
      13 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-24-2024, 08:47 AM
      0 responses
      16 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-11-2024, 12:08 PM
      0 responses
      61 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 10:19 PM
      0 responses
      60 views
      0 likes
      Last Post seqadmin  
      Working...
      X