Skip to content

Instantly share code, notes, and snippets.

@nylander
Created October 10, 2023 11:43
Show Gist options
  • Save nylander/fc24a5ea917921852f63e310d6ac8fd7 to your computer and use it in GitHub Desktop.
Save nylander/fc24a5ea917921852f63e310d6ac8fd7 to your computer and use it in GitHub Desktop.
Convert blast output with sseq as last column to fasta
#! /bin/bash
# blast2fasta
# Parse output from blast where we have sseq as the last column.
# For example (argument to blastn): "-outfmt '6 qseqid sseq'".
# Reads from file, writes to stdout.
# By Johan Nylander
# 2023-Oct-10
# Usage: blast2fasta.sh file
file=$1
awk '{printf ">%s", $1; for(i=2;i<NF;i++) printf " %s", $i; printf "\n%s\n", $NF}' "$file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment