Mercurial > repos > artbio > mircounts
comparison format_fasta_hairpins.sh @ 0:da29af78a960 draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit d4d8106d66b65679a1a685ab94bfcf99cdb7b959
author | artbio |
---|---|
date | Mon, 24 Jul 2017 06:27:50 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:da29af78a960 |
---|---|
1 GENOME_KEY=$1 | |
2 | |
3 gunzip hairpin.fa.gz | |
4 sed -i.bak '/^[^>]/ y/uU/tT/' hairpin.fa ## replace U by tT | |
5 sed -i.bak2 -E 's/ .+//' hairpin.fa ## just leaves mir name as one word header | |
6 awk '/^>/ {printf("\n%s\n",$0);next; } { printf("%s",$0);} END {printf("\n");}' < hairpin.fa > hairpin.fa.bak3 | |
7 tail -n +2 hairpin.fa.bak3 > hairpin.fa ## generate single line sequences | |
8 awk 'BEGIN{RS=">"}{gsub("\n","\t",$0); print ">"$0}' < hairpin.fa > hairpin.fa.tmp | |
9 mv hairpin.fa hairpin.bak4 && tail -n +2 hairpin.fa.tmp > hairpin.fa | |
10 rm hairpin.fa.tmp ## tabular sequences | |
11 sed -i.bak5 -E $'s/\t$//g' hairpin.fa ## remove tab before end line leaved by previous awk | |
12 grep ">${GENOME_KEY}-" hairpin.fa > hairpin.fa.tmp | |
13 mv hairpin.fa hairpin.fa.bak6 | |
14 mv hairpin.fa.tmp hairpin.fa ## filter tabular hairpins with proper genomeKey | |
15 tr '\t' '\n' < hairpin.fa > hairpin.fa.tmp | |
16 mv hairpin.fa hairpin.fa.bak7 | |
17 mv hairpin.fa.tmp hairpin.fa ## terminate parsing by regenerating fasta format, bowtie-build ready | |
18 rm ./*.bak* ## cleaning job directory | |
19 |