Exemple #1
0
# Create a FASTQ object from a string

seq1 = FASTQ('@NS500451\nNCAAGNGCCA\n+\n#AAAA#FFFF')

# The _repr_ method returns a string suitable for printing in a FASTQ file:

print('Test Sequence 1:')
print(seq1)

# Print the attributes:

print_info(seq1)

# Compress the sequence, print the attributes again:

seq1.pack()
print_info(seq1)

# We should be able to restore the original attributes:

seq1.unpack()
print_info(seq1)

# Create another FASTQ object, this time from a byte array (e.g. a blob
# written into a database).  The sequence will have an empty defline, so
# we need to add one:

seq2 = FASTQ(b'\xc8P\x1e\x1e\xb4\xc8\xb9UU#')
seq2._def = 'restored sequence'
seq2.unpack()