Hi Franklin52
I try your code just now.
Unfortunately, It can't work
Do you have any other idea?
Actually I just want to produce a long list of below (based on same XXX_AB1 with XXX_AB2):
Thanks a lot Frankin52
I think I understand what you mean now.
Maybe I type some error and let you misunderstanding it.
Actually all the *_AB1.fq and *_AB2.fq all are long list of "file" not the list of "contents" in a file.
But it should be not a problem.
I just do
ls *.fq > file
cat file
awk -F_ 'a[$1]{print "fastq_to_fasta "a[$1]" "$0; next} {a[$1]=$0}' file
I believe it should be work nice.
Thanks a lot and again, Frankin52 :)
$ cat file
071022_L1_AB1.fq
012121_L1_AB1.fq
021213_L1_AB1.fq
012153_L1_AB1.fq
071022_L1_AB2.fq
012121_L1_AB2.fq
021213_L1_AB2.fq
012153_L1_AB2.fq
$ awk -F_ 'a[$1]{print "fastq_to_fasta "a[$1]" "$0; next} {a[$1]=$0}' file
fastq_to_fasta 071022_L1_AB1.fq 071022_L1_AB2.fq
fastq_to_fasta 012121_L1_AB1.fq 012121_L1_AB2.fq
fastq_to_fasta 021213_L1_AB1.fq 021213_L1_AB2.fq
fastq_to_fasta 012153_L1_AB1.fq 012153_L1_AB2.fq
$
[/quote]
---------- Post updated at 08:33 PM ---------- Previous update was at 07:35 PM ----------
Thanks again Franklin52.
Your suggestion code look cool
I will go and find out the reason why you write this code.
Thus able to edit it next time to solve another similar problem.
In between, can I roughly know the explanation of your code written?
Sorry if bring you any inconvenience.
Thanks a lot for your explanation, Franklin52:)
I feel more comfortable and understanding about the reason of your code now.
I really appreciate for your explanation.
Thanks again
[/quote]
It facing a problem if my input is look the following:
01234_ABC_L1_CDE_PE1.fq
01234_ABC_L1_CDE_PE2.fq
01234_ABC_L2_CDE_PE1.fq
01234_ABC_L2_CDE_PE2.fq
01234_ABC_L3_CDE_PE1.fq
01234_ABC_L3_CDE_PE2.fq
05512_ABC_L1_CDE_PE1.fq
05512_ABC_L1_CDE_PE2.fq
05512_ABC_L2_CDE_PE1.fq
05512_ABC_L2_CDE_PE2.fq
05512_ABC_L3_CDE_PE1.fq
05512_ABC_L3_CDE_PE2.fq
The code can't give the desired output like:
fastq_to_fasta 01234_ABC_L1_CDE_PE1.fq 01234_ABC_L1_CDE_PE2.fq
fastq_to_fasta 01234_ABC_L2_CDE_PE1.fq 01234_ABC_L2_CDE_PE2.fq
fastq_to_fasta 01234_ABC_L3_CDE_PE1.fq 01234_ABC_L3_CDE_PE2.fq
fastq_to_fasta 05512_ABC_L1_CDE_PE1.fq 01234_ABC_L1_CDE_PE2.fq
fastq_to_fasta 05512_ABC_L2_CDE_PE1.fq 01234_ABC_L2_CDE_PE2.fq
fastq_to_fasta 05512_ABC_L3_CDE_PE1.fq 01234_ABC_L3_CDE_PE2.fq
Unfortunately, the code give me another result
Franklin52, do you have any better idea to get my desired output result?
Actually I got try a way like this:
At last, I vi and add the "fastq_to_fasta" inside file_name.output.txt one line by one line:(
It seem like quite troublesome and wasting time
I think it should got faster way. Just I still can't get it:(
Franklin52, thanks again for your help and sorry if bring you any inconvenience.