Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

converting fastaq to fasta

by Anonymous Monk
on Feb 08, 2012 at 05:33 UTC ( [id://952409]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hi i want to convert fastaq format to fasta format i have used this code initially to try getting the thgs but dint work here is the code

open(read,"<1.txt"); my@e=<read>; my$a=join(''",@e); sub fq2fa() { while (<1.txt> { if(/^@(S+)/) { print ">\n"; } } } sub fq2fa();

Replies are listed 'Best First'.
Re: converting fastaq to fasta
by BrowserUk (Patriarch) on Feb 08, 2012 at 07:03 UTC

    Try perl -nle"next if ($.-1)%4 > 1; s[^\@][>]; print" filein.FASTQ > fileout.FASTA like this:

    c:\test>type filein.FASTQ @SEQ_ID1 GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT +SEQ_ID1 !''*((((***+))%%%++)(%%%%).1***-+*''))**55CCF>>>>>>CCCCCCC65 @SEQ_ID2 GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT +SEQ_ID2 !''*((((***+))%%%++)(%%%%).1***-+*''))**55CCF>>>>>>CCCCCCC65 @SEQ_ID3 GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT +SEQ_ID3 !''*((((***+))%%%++)(%%%%).1***-+*''))**55CCF>>>>>>CCCCCCC65 @SEQ_ID4 GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT +SEQ_ID4 !''*((((***+))%%%++)(%%%%).1***-+*''))**55CCF>>>>>>CCCCCCC65 c:\test>perl -nle"next if ($.-1)%4 > 1; s[^\@][>]; print" filein.FASTQ + > fileout.FASTA c:\test>type fileout.FASTA >SEQ_ID1 GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT >SEQ_ID2 GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT >SEQ_ID3 GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT >SEQ_ID4 GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT

    Note:Switch "s to 's if you're on *nix.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      can u be more clear i couldnt get u

        can u be more clear i couldnt get u

        Please contact your Systems Administrator, lecturer or other responsible adult.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?

Re: converting fastaq to fasta
by moritz (Cardinal) on Feb 08, 2012 at 06:04 UTC

      no actually while executing i closed the while loop. if the file is like this..

      @NCYC361-11a03.q1k bases 1 to 1576 GCGTGCCCGAAAAAATGCTTTTGGAGCCGCGCGTGAAAT... +NCYC361-11a03.q1k bases 1 to 1576 !)))))****(((***%%((((*(((+,**(((+**+,-
      and i need to convert it to..
      >GCGTGCCCGAAAAAATGCTTTTGGAGCCGCGCGTGAAAT...
      what should i do

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://952409]
Approved by Paladin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-26 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found