Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Grouping fasta entries from different files based on reference/name

    Hi everyone,

    I currently have 24 fasta files (for 24 species) with thousands of contigs. These files are contigs constructed from a reference transcriptome, so each file has contig numbers that are the same as contig numbers in the other files. For example:

    File 1 (SpeciesA):

    >contig_1
    AAAAAAAAAAAAAA
    >contig_2
    TTTTTTTTTTTTTTTT
    >contig_3
    CCCCCCCCCCCCCC

    File 2 (SpeciesB):

    >contig_2
    TTTTTTTTTTTTTTTT
    >contig_3
    CCCCCCCCCCCCCC

    File 3 (SpeciesC):

    >contig_1
    AAAAAAAAAAAAAA
    >contig_2
    TTTTTTTTTTTTTTTT


    I want to create files for each contig, so that instead of having 24 fasta files (one for each species), I have a file for each contig number like:

    File 1 (contig1):

    >contig_1_SpeciesA
    AAAAAAAAAAAAAA
    >contig_1_SpeciesC
    AAAAAAAAAAAAAA

    File 2 (contig2):

    etc..


    My programming skills are pretty much non-existent, so any direction on how I could do this for many large files would be highly appreciated!

  • #2
    Originally posted by gevielr View Post
    My programming skills are pretty much non-existent, so any direction on how I could do this for many large files would be highly appreciated!
    Learn to program. I would suggest Python, Ruby or Perl - have a look at online tutorials to see if which you like best, but also find out what people near you are using. Having someone able to help you out in person is really valuable, especially when first starting out.

    Comment


    • #3
      Attached is a python script that will do what you want. you can invoke it on a mac or linux command line with

      python splitter.txt directorywithoriginalcontigs

      it will output the files you want in the directory you invoke the command. It assumes the species contigs sit in the above directory and are called
      species1.fasta
      species2.fasta

      etc

      Disclaimer: The above code is not guaranteed to work in the way intended, or indeed at all.
      Attached Files

      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, Today, 08:47 AM
      0 responses
      12 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-11-2024, 12:08 PM
      0 responses
      60 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 10:19 PM
      0 responses
      59 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 09:21 AM
      0 responses
      54 views
      0 likes
      Last Post seqadmin  
      Working...
      X