Created
May 12, 2014 09:38
-
-
Save l-modolo/e6f8a044b5526085b5fd to your computer and use it in GitHub Desktop.
list of sequence_id sequence_length from a fasta file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # return a list of sequence_id sequence_length from a fasta file | |
| awk 'BEGIN {OFS = "\n"}; /^>/ {print(substr(sequence_id, 2)" "sequence_length); sequence_length = 0; sequence_id = $0}; /^[^>]/ {sequence_length += length($0)}; END {print(substr(sequence_id, 2)" "sequence_length)}' file.fasta |
Still loving it!
Author
Still loving it!
π
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just wanted to let you know that 10+ years later I'm still coming back here to get this one liner π