Till KTH:s startsida Till KTH:s startsida

Reading Stockholm files

Reading the Stockholm format

Write a script that reads a Stockholm-formatted file and writes the number of sequences in it, followed by the accessions of the sequences. See examples below!

To present:

  1. The code of your program and a demonstration of it running.
  2. Explain the general structure of a Stockholm file. What is an "accession"?


Examples

For example, if the input is

# STOCKHOLM 1.0
PROT1_PIG   ACGT
PROT1_DOG   AGTG
PROT1_BUNNY TATA
//

then the output should be

3
PROT1_PIG
PROT1_DOG
PROT1_BUNNY

You should get the same output also if the input is

# STOCKHOLM 1.0
#=GF  CC  This is a trivial made-up example!
#=GS  PROT1_PIG  OS Sus scrofa
#=GS  PROT1_DOG  OS Canis familiaris
#=GS  PROT1_PIG  OS Oryctolagus cuniculus
PROT1_PIG   ACGT
PROT1_DOG   AGTG
PROT1_BUNNY TATA
//

Lars Arvestad skapade sidan 2 november 2015

Lärare Lars Arvestad ändrade rättigheterna 10 november 2015

Kan därmed läsas av alla och ändras av lärare.