2017年6月25日 星期日

DNA to RNA, Reverse Complement using perl one-liner

Linux:

DNA to RNA and RNA to DNA
cat mature_RNA.fasta | perl -lane 'if(/^>/){ print }else{tr/Uu/Tt/; print }' >mature_DNA.fasta
cat mature_DNA.fasta | perl -lane 'if(/^>/){ print }else{tr/Tt/Uu/; print }' >mature_RNA.fasta
Reverse complement
cat mature_RNA.fasta | perl -lane 'if(/^>/){ print }else{tr/AUCGaucg/UAGCuagc/;print scalar reverse }' >mature_RNA_rc.fasta
cat mature_DNA.fasta | perl -lane 'if(/^>/){ print }else{tr/ATCGatcg/TAGCtagc/;print scalar reverse }' >mature_DNA_rc.fasta

Windows:

DNA to RNA and RNA to DNA
type mature_RNA.fasta | perl -lane "if(/^>/){ print }else{tr/Uu/Tt/; print }" >mature_DNA.fasta
type mature_DNA.fasta | perl -lane "if(/^>/){ print }else{tr/Tt/Uu/; print }" >mature_RNA.fasta
Reverse complement
type mature_RNA.fasta | perl -lane "if(/^>/){ print }else{tr/AUCGaucg/UAGCuagc/;print scalar reverse }" >mature_RNA_rc.fasta
type mature_DNA.fasta | perl -lane "if(/^>/){ print }else{tr/ATCGatcg/TAGCtagc/;print scalar reverse }" >mature_DNA_rc.fasta

沒有留言:

張貼留言

DEseq2 usage