Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • acyrocks
    Junior Member
    • Sep 2012
    • 3

    compare two Fasta files

    Hi,
    I am new in NGS and have very little knowledge in tools used for analyzing sequences generated by NGS. Here, I have a problem and think somebody with good perl script skill may be able to help me out:
    I have two Fasta files like below:

    File1:
    >a
    GVKKDVKCTTTGGG
    .
    .
    >f
    AAATTTGGGCCCEEE
    >g
    SSSGGGYYYTTTGTFR
    .
    .
    >x
    DDDGGGYYYTTTGTFR
    .
    .
    .

    File2:
    1>
    GVKKDVKCTTTGGG
    .
    .
    >41
    FFFGGGYYYTTTGTFR
    .
    .
    >200
    AAATTTGGGCCCEEE
    .
    .
    >1000
    SSSGGGYYYTTTGTFR
    .
    .
    .

    Many but not all sequences are identical in these two files. I would like to compare each sequence of the first file with the second file and make a following table:

    a GVKKDVKCTTTGGG 1
    f AAATTTGGGCCCEEE 200
    g SSSGGGYYYTTTGTFR 1000
    x DDDGGGYYYTTTGTFR 0
    .
    .
    .

    In the table, the first column is the header of each sequence of the first file. The second column is each sequence of the first file and the third column is the header of the second file with the identical sequence with the first file. If there is no sequence identical in the second file, then use number zero instead.
    Appreciate if someone can help me out.
    Thanks a lot.
    Acyrocks
  • Torst
    Senior Member
    • Apr 2008
    • 275

    #2
    Is this a homework question?

    Comment

    • krobison
      Senior Member
      • Nov 2007
      • 734

      #3
      It sounds like one, but in any case it is pretty simple to hash this out in not much code :-)

      Comment

      • Torst
        Senior Member
        • Apr 2008
        • 275

        #4
        Agreed, I think you've given him the key idea.

        Comment

        • acyrocks
          Junior Member
          • Sep 2012
          • 3

          #5
          Thanks for replying. No, it's not a home work. I don't have much Perl knowledge, except have read couple of chapters and know how to run a script. I may spend more time in future to learn it if I found some time. If you guys can help me out, I appreciate it.

          Comment

          • Torst
            Senior Member
            • Apr 2008
            • 275

            #6
            Do you know how to program in any particular language? Perhaps we could assist you to implement it in a language you have experience in. If not, someone will probably give you a solution to try.

            Comment

            • rahularjun86
              Member
              • Jan 2011
              • 58

              #7
              Dear acyrocks,
              Please run the attached code using following command(unix):
              perl for_seqanswer_fasta_formatter.pl file1.fasta file2.fasta out.fasta
              It is working fine here
              Best wishes,
              Rahul
              Attached Files
              Rahul Sharma,
              Ph.D
              Frankfurt am Main, Germany

              Comment

              • acyrocks
                Junior Member
                • Sep 2012
                • 3

                #8
                Thanks so much, Rahul.
                I tried your code and it works for most parts. However, it skip the sequences in file1 which are not identical to any sequences in the file2. I hope these sequences are still include in out file and with zero printed on the third column. I think this could be easy fix for you. Thanks again.

                Comment

                Latest Articles

                Collapse

                • SEQadmin2
                  Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                  by SEQadmin2


                  Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                  The systematic characterization of the human proteome has
                  ...
                  07-20-2026, 11:48 AM
                • SEQadmin2
                  Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                  by SEQadmin2



                  Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                  ...
                  07-09-2026, 11:10 AM
                • SEQadmin2
                  Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                  by SEQadmin2



                  Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                  There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                  07-08-2026, 05:17 AM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by SEQadmin2, 07-24-2026, 12:17 PM
                0 responses
                31 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-23-2026, 11:41 AM
                0 responses
                23 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-20-2026, 11:10 AM
                0 responses
                215 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-13-2026, 10:26 AM
                0 responses
                79 views
                0 reactions
                Last Post SEQadmin2  
                Working...