Bash script to handle Multifasta files
...rcase in a FASTA sequence file $ awk 'BEGIN{FS=" "}{if(!/>/){print...nces according to their length $ awk '/^>/ {printf("%s%s\t",(N>0?"...D {printf("\n");}' input.fasta |\ >awk -F '\t' '{printf("%d\t%s\n",l...ctory into a single FASTA file $ awk'1' *.fa > all.fa1357 days ago
Perl script to run awk inside perl
...t output field separator $\ = "\n"; # set output record separator while () { chomp; # strip record separator @Fld = split(' ', $_, -1); if ($awk) { $Fld[(1)-1] = ''; $Fld[(...1163 days ago
Remove dupcates in multifasta file !
#Using seqkit for duplicate sequence removal seqkit rmdup -n seqs.fa -o seqs_without_duplicate.fa #Awk for duplicate sequence removal awk '/^>/ { f = !a[$0]++ } f' seqs.fa976 days ago
Commands to Remove White Space In Text Or String Using Awk And Sed In Linux
...GAGTGATGA G GGRTTT" echo "$text" | sed 's/ //g' OR echo "$text" | awk '{ gsub(/ /,""); print }'...Multiple space cat /tmp/test.txt | sed 's/[ ]\+/ /g' echo "$text1" | awk '{ gsub(/[ ]+/," "); print }'...956 days ago
Oneliner to convert lower-case to sequence masked with Ns
perl -pe '/^[^>]/ and $_=~ s/[a-z]/N/g' genomic.fna > genomic.N-masked.fna awk '{if(/^[^>]/)gsub(/[a-z]/,"N");print $0}' genomic.fna > genomic.N-masked.fna950 days ago
Onliner to convert multi line fasta to single line fasta !
#Oneliner to convert awk '/^>/ {printf("\n%s\n",$0);next; } { printf("%s",$0);} END {printf("\n");}' < file.fa > fileres.fa #Then delete the first empty line tail -n +2 fileres.fa > fileout.fa928 days ago
894 days ago
Split the string with underscore and store values in array with AWK !
more enriched_ids | grep "WP_" | awk '{split($2,a,"_"); print a[4]"_"a[5]}' #Other extraction more enriched_ids | grep "WP_" | awk '{split($2,a,"_"); print a[4]"_"a[5]}'> enriched_ids_list awk 'NR==FNR{tgts[$1]; next} $1 in tgts' enriched_ids_list result/GO.out > enriched_GO.out.xls894 days ago
Extract the values using ids !
#Awk script awk 'NR==FNR{tgts[$1]; next} $1 in tgts' file1 file2 Look: $ cat file1 11...24325 item 7 84156 item 6 572546 item 7 693661 item 7 $ awk 'NR==FNR{tgts[$1]; next} $1 i...894 days ago
Extract fasta header with ids !
...fasta header name with certain ids kraken --db ../../../../DATABASE/minikraken_20171019_8GB.tgz out.fa more out.fa_class.txt | grep "227859" | awk '{print $2}' > all_real_ids.t...876 days ago