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 $_;} }
In reply to Perl code for reverse complement of DNA sequence by mashuk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |