Background: For many diseases with known causative mutations, screening methods have been developed to detect whether people have a high risk of becoming sick, even before the onset of the actual disease.
Over the last few years, the cost of full genome sequencing has gone down so that, in some cases, it might be cheaper to collect the complete genome sequence of patients with a high risk of carrying variants associated with the disease, rather than using targeted screening procedures.
Cystic fibrosis is a complex disease, where patients often manifest the following symptoms: problems with lung functions, diabetes and infertility. From a genetic point of view, there are several mutations associated with this disease. In particular, the CFTR gene (short for Cystic Fibrosis Transmembrane Conductance Regulator) encodes an ion channel protein acting in epithelial cells, and carries several non-synonymous genetic variants, with alterations leading to premature stop codons, that are known to cause the disease.
Goal: In this assignment, you have access to the human reference genome as well as the genome annotation. In addition, you have full genome sequence data from five individuals from a family at risk of carrying mutations related to the disease.
Your task is to write a Python program that will extract the CFTR gene, translate the gene sequence to its corresponding amino-acid sequence and based on the inferred amino-acid sequence determine whether any of the five given individuals is affected.
Fetch the appropriate files
The main task is divided in several steps. The first step is to fetch
the sequence file (in
fasta format) and the appropriate annotation
GTF format) from
the Ensembl database.
The CTFR gene is chromosome
What is the length of the chosen DNA sequence?
Open the DNA file with the
withstatement and read it line by line.
Ignore the first line and, in a loop, get the length of each line (from which you remove the trailing newline character).
Sum up all the lengths you found.
How many genes are annotated in the GTF file?
You need to understand the structure of a GTF-formatted file.
The GTF format uses several tab-delimited fields, for which we give you a short a description.
Alternatively, you can search online.
What fraction of the chromosome is annotated as genes?
Architect a method
All the following tasks are now related to the CTFR gene.
In the annotation file (from the Ensembl database), that gene has the
ENSG00000001626 on chromosome
How many transcripts can this gene generate?
What is the longest transcript in nucleotides?
The transcript with id ENST00000003084 has 6132 bp and is the longest among 11 other transcripts
Check its Ensembl data
Notice that the last column in the GTF on the line defining that transcript should contain
Fetch the DNA sequence for that gene
Similarly to step 1 from the Warmup, open the file with the `with` statement.
Ignore the first line and, in a loop, append each line to a list.
Remember to strip the trailing newline character.
Outside the loop, use the
joinfunction to concatenate the lines from the list.
Avoid concatenation inside the loop, as it is slow and wasting memory
Fetch all the exons for that transcript (splicing)
Your answer can be output to a file and compare to that given result (also available online)
What are the position of the
stop_codonfrom that transcript?
Check that the
ATG, and that the
stop_codoncorresponds to a proper stop codon
Make your program throws a warning in case the transcript you are currently translating does not begin with a start-codon and end with a stop-codon
Translate into amino-acids, using an implementation of the translation table from
You can output your results in different files and check the difference with the given result or online here or here.
will output nothing when the files are identical.
diff filename-1 filename-2
Moreover, have a look at the
rangefunction, which can take an extra
Use BioPython for (some of) the above tasks
Start by parsing a fasta file with BioPython.
Have a look at the transcription step,
and the translation step using the built-in translation tables.
Find the patients at risk
We are reaching the goal for this assignment!
Using the python program you have designed above, find which one of the following 5 patients (patient-1, patient-2, patient-3, patient-4, and patient-5) carries a mutation on the CFTR gene, that can cause cystic fibrosis.
There might be several.
What if the sequence was on the reverse strand?
You need implement that as well!
So …no! Use the BioPython module, it does that job!