mashuk has asked for the wisdom of the Perl Monks concerning the following question:
I was trying to make a perl code to get the reverse complement of fasta sequences of DNA in a .fna file format. the sequence02C.fna file contains 100s of DNA sequences :
>adbca3e TGCTCCCCACGCTTGCCTCTCCAGTACTCAACCAAAGCAGTCTCTAGAAAAACAGTTTCCAACGCAATAC +GATGGAATTCCACTTCCCAAATATCTC >4c2a958 TCCCCACGCTTTCGCGCTTCAGCGTCAGTATCTGTCCAGTGAGCTGACTTCTCCATCGGCATTCCTACAC +AGTACTCTAGAAAAACAGTTTCTGCTC >0639b5b TCGCGCCTCAGTGTCCAACGCAATACGAGTTGCAGACCAGGACACATGGAATTCCACTTCCCTCTCCAGT +ACTCAACCAAAGCAGTCTCTAGAAAAG
output file is only the complementary of the sequence but not reverse. Additionally, it does not contain the sequenceIDs(ASVs) ">adbca3e"
Could anyone please suggest me the appropriate code to do this reverse complementary of this sequence at once? Thanks in advance.
#!/usr/local/perl open (NS, "sequence02C.fna"); while (<NS>) { if ($_ =~ tr/ATGC/TACG/) {print $_;} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl code for reverse complement of DNA sequence (updated)
by AnomalousMonk (Archbishop) on Apr 25, 2021 at 19:17 UTC | |
|
Re: Perl code for reverse complement of DNA sequence
by kcott (Archbishop) on Apr 27, 2021 at 10:07 UTC | |
by AnomalousMonk (Archbishop) on Apr 27, 2021 at 18:54 UTC | |
by kcott (Archbishop) on Apr 27, 2021 at 23:51 UTC | |
|
Re: Perl code for reverse complement of DNA sequence
by BillKSmith (Monsignor) on Apr 26, 2021 at 15:51 UTC | |
by karlgoethebier (Abbot) on Apr 26, 2021 at 19:38 UTC | |
|
Re: Perl code for reverse complement of DNA sequence
by jo37 (Curate) on Apr 25, 2021 at 18:25 UTC | |
by Anonymous Monk on Apr 25, 2021 at 19:20 UTC | |
|
Re: Perl code for reverse complement of DNA sequence
by 1nickt (Canon) on Apr 25, 2021 at 18:35 UTC |