Created
October 17, 2012 21:11
-
-
Save sashaphanes/3908209 to your computer and use it in GitHub Desktop.
convert .txt files to .fastq format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl -sw | |
| # sample inputs: | |
| #ILLUMINA-A93428 66 1 1 7848 1267 CGATGT 1 ATGTTGGCTGGCGGTGAAATAAATCTCAAACGTACCTGTTACAAAATTGTGTTAATCCTTTCAGATTCGCAG ggggggggggggggcfdffdgggfefffffcfcffcccacBeddddded_cffefgggggBBBBBBBBBBBB chrX.fa 122287709 R 40C21GAC7 269 Y | |
| # output for sample input: | |
| #@ILLUMINA-A93428:66:1:1:7848:1267:#CGATGT/1 | |
| #ATGTTGGCTGGCGGTGAAATAAATCTCAAACGTACCTGTTACAAAATTGTGTTAATCCTTTCAGATTCGCAG | |
| #+ILLUMINA-A93428:66:1:1:7848:1267:#CGATGT/1 | |
| #ggggggggggggggcfdffdgggfefffffcfcffcccacBeddddded_cffefgggggBBBBBBBBBBBB | |
| # command line: | |
| # perl txtToFastq.pl < sampleInput.txt > output.fastq | |
| while (<>){ | |
| chomp; | |
| my @parts = split (/\s+/, $_); | |
| print "@","$parts[0]:$parts[1]:$parts[2]:$parts[3]:$parts[4]:$parts[5]:#$parts[6]/$parts[7]\n"; | |
| print "$parts[8]\n"; | |
| print "+","$parts[0]:$parts[1]:$parts[2]:$parts[3]:$parts[4]:$parts[5]:#$parts[6]/$parts[7]\n"; | |
| print "$parts[9]\n"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is there a way to convert from fastq to txt ?