Extract all fasta sequences except ids !
awk 'BEGIN{while((getline0)l[">"$1]=1}/^>/{f=!l[$1]}f' genomic.fna > filtered_without_omi.fasta #extract subseq seqtk subseq omi_ids.fa omi_single_id.txt > omi_si...828 days ago
Bash script to split multifasta file !
#Using awk, we can easily split a file (multi.fa) into chunks...(here, N=500), by using the following one-liner: awk 'BEGIN {n=0;} /^>/ {if(n%500=...++; next;} { print >> file; }' < multi.fa #OR awk -v chunksize=$(grep ">" multi...823 days ago
794 days ago
Commands to Find and replace in file(s0) !
#Use SED sed -i 's/my/your/g' test.txt test2.txt test3.txt #Use FIND and SED find . -name *.txt -exec sed -i 's/my/your/g' {} \; #Use AWK awk '{sub(/{OLD_TERM}/,{NEW_TERM}); print}' {file} awk '{sub(/my/,your); print}' test.txt awk '{gsub(/i/,"a"); print}' test.txt769 days ago
Bash script to convert multiline fasta to single line fasta !
#file.fa is multiline fasta awk '/^>/ {printf("\n%s\n",$0);next; } { printf("%s",$0);} END {printf("\n");}' < file.fa766 days ago
Awk command to keep only short the fasta header !
awk '/^>/ {$0=$1} 1' file.fasta709 days ago
Bash script to convert Multi-line Fasta to Single-line Fasta !
#!/bin/bash input_filename="multi_line.fasta" output_filename="single_line.fasta" awk '/^>/ {printf("\n%s\n", $0);next; } { printf("%s", $0);} END {printf("\n");}' "$input_fi...95 days ago
Bash script to calculate difference between column !
Space Separated awk '{ $5 = $2 - $4 } 1' inputput.txt > outdiff.txt Or with tab separation: awk 'BEGIN { OFS = "\t" } { $5 = $2 - $4 } 1' inputput.txt > outdiff.txt94 days ago