Commit 81c547a7 authored by carlosribas's avatar carlosribas
Browse files

Remove information about GFF, GFF3 and BED

parent 8877c63d
......@@ -393,34 +393,10 @@ class LncrnaTargetsSerializer(serializers.ModelSerializer):
class Meta:
model = ProteinInfo
fields = ('target_accession', 'source_accession', 'description', 'label', 'synonyms', 'methods', 'description', 'target_urs_taxid')
class RnaGffSerializer(serializers.ModelSerializer):
"""Serializer for presenting genomic coordinates in GFF format"""
gff = serializers.CharField(source='get_gff', read_only=True)
class Meta:
model = Rna
fields = ('gff',)
class RnaGff3Serializer(serializers.ModelSerializer):
"""Serializer for presenting genomic coordinates in GFF format"""
gff3 = serializers.CharField(source='get_gff3', read_only=True)
class Meta:
model = Rna
fields = ('gff3',)
class RnaBedSerializer(serializers.ModelSerializer):
"""Serializer for presenting genomic coordinates in UCSC BED format"""
bed = serializers.CharField(source='get_ucsc_bed', read_only=True)
class Meta:
model = Rna
fields = ('bed',)
fields = (
'target_accession', 'source_accession', 'description', 'label', 'synonyms', 'methods', 'description',
'target_urs_taxid'
)
class ExpertDatabaseStatsSerializer(serializers.ModelSerializer):
......
......@@ -352,70 +352,6 @@ class OutputFormatsTestCase(ApiV1BaseClass):
self._output_format_tester(formats, urls)
# TODO: GFF is no longer available?
def _test_gff_output(self):
"""Test gff output."""
c = APIClient()
formats = {'gff': 'text/gff'}
urls = (
reverse('rna-detail', kwargs={'pk': self.upi_with_genomic_coordinates}),
reverse('rna-detail', kwargs={'pk': self.upi}),
)
# test response status codes
self._output_format_tester(formats, urls)
# further check the gff text output
response = c.get(urls[0] + '.gff')
self.assertIn('exon', response.content)
# test a sequence without genomic coordinates
response = c.get(urls[1] + '.gff')
self.assertIn('# Genomic coordinates not available', response.content)
# TODO: GFF3 is no longer available?
def _test_gff3_output(self):
"""Test gff3 output."""
c = APIClient()
formats = {'gff3': 'text/gff3'}
urls = (
reverse('rna-detail', kwargs={'pk': self.upi_with_genomic_coordinates}),
reverse('rna-detail', kwargs={'pk': self.upi}),
)
# test response status codes
self._output_format_tester(formats, urls)
# further check the gff text output
response = c.get(urls[0] + '.gff3')
self.assertIn('noncoding_exon', response.content)
# test a sequence without genomic coordinates
response = c.get(urls[1] + '.gff3')
self.assertIn('# Genomic coordinates not available', response.content)
# TODO: BED is no longer available?
def _test_bed_output(self):
"""Test bed output."""
c = APIClient()
formats = {'bed': 'text/bed'}
urls = (
reverse('rna-detail', kwargs={'pk': self.upi_with_genomic_coordinates}),
reverse('rna-detail', kwargs={'pk': self.upi}),
)
# test response status codes
self._output_format_tester(formats, urls)
# further check the gff text output
response = c.get(urls[0] + '.bed')
self.assertIn(self.upi_with_genomic_coordinates, response.content)
# test a sequence without genomic coordinates
response = c.get(urls[1] + '.bed')
self.assertIn('# Genomic coordinates not available', response.content)
def test_genome_annotations(self):
"""
Test the Ensembl-like endpoint for retrieving data
......
......@@ -72,4 +72,4 @@ urlpatterns = [
url(r'karyotypes/(?P<ensembl_url>.*?)/?$', cache_page(CACHE_TIMEOUT)(views.EnsemblKaryotypeAPIView.as_view()), {}, name='ensembl-karyotype'),
]
urlpatterns = format_suffix_patterns(urlpatterns, allowed=['json', 'yaml', 'fasta', 'api', 'gff', 'gff3', 'bed'])
urlpatterns = format_suffix_patterns(urlpatterns, allowed=['json', 'yaml', 'fasta', 'api'])
......@@ -13,7 +13,6 @@ limitations under the License.
"""
import boto3
import re
import requests
import zlib
from itertools import chain
......@@ -33,7 +32,7 @@ from rest_framework_jsonp.renderers import JSONPRenderer
from rest_framework_yaml.renderers import YAMLRenderer
from apiv1.serializers import RnaNestedSerializer, AccessionSerializer, CitationSerializer, XrefSerializer, \
RnaFlatSerializer, RnaFastaSerializer, RnaGffSerializer, RnaGff3Serializer, RnaBedSerializer, \
RnaFlatSerializer, RnaFastaSerializer, \
RnaSpeciesSpecificSerializer, ExpertDatabaseStatsSerializer, \
RawPublicationSerializer, RnaSecondaryStructureSerializer, \
RfamHitSerializer, SequenceFeatureSerializer, \
......@@ -41,11 +40,10 @@ from apiv1.serializers import RnaNestedSerializer, AccessionSerializer, Citation
LncrnaTargetsSerializer, EnsemblComparaSerializer, SecondaryStructureSVGImageSerializer
from apiv1.renderers import RnaFastaRenderer
from portal.models import Rna, RnaPrecomputed, Accession, Xref, Database, DatabaseStats, RfamHit, EnsemblAssembly,\
GoAnnotation, RelatedSequence, ProteinInfo, SequenceFeature,\
SequenceRegion, EnsemblCompara, SecondaryStructureWithLayout
from portal.models import Rna, RnaPrecomputed, Accession, Database, DatabaseStats, RfamHit, EnsemblAssembly,\
GoAnnotation, RelatedSequence, ProteinInfo, SequenceFeature, SequenceRegion, EnsemblCompara
from portal.config.expert_databases import expert_dbs
from rnacentral.utils.pagination import Pagination, PaginatedRawQuerySet
from rnacentral.utils.pagination import Pagination
from colorhash import ColorHash
......@@ -157,12 +155,6 @@ class RnaMixin(object):
"""Determine a serializer for RnaSequences and RnaDetail views."""
if self.request.accepted_renderer.format == 'fasta':
return RnaFastaSerializer
elif self.request.accepted_renderer.format == 'gff':
return RnaGffSerializer
elif self.request.accepted_renderer.format == 'gff3':
return RnaGff3Serializer
elif self.request.accepted_renderer.format == 'bed':
return RnaBedSerializer
flat = self.request.query_params.get('flat', 'false')
if re.match('true', flat, re.IGNORECASE):
......@@ -534,7 +526,7 @@ class ExpertDatabasesAPIView(APIView):
return expert_db_label
# e.g. { "TMRNA_WEB": {'name': 'tmRNA Website', 'label': 'tmrna-website', ...}}
databases = { db['descr']:db for db in Database.objects.values() }
databases = {db['descr']: db for db in Database.objects.values()}
# update config.expert_databases json with Database table objects
for db in expert_dbs:
......@@ -793,7 +785,7 @@ class EnsemblComparaAPIViewSet(generics.ListAPIView):
return None
def get_ensembl_compara_status(self):
urs_taxid = self.kwargs['pk']+ '_' + self.kwargs['taxid']
urs_taxid = self.kwargs['pk'] + '_' + self.kwargs['taxid']
rna_precomputed = RnaPrecomputed.objects.get(id=urs_taxid)
if rna_precomputed.databases and 'Ensembl' not in rna_precomputed.databases:
......
......@@ -141,8 +141,6 @@ The following output formats are supported for all endpoints:
**JSON**, **JSONP** (for cross-origin Javascript requests), **YAML**, **HTML**.
In addition, the data for individual RNA sequences can be downloaded in **FASTA** format.
For those sequences that have genomic coordinates
**[GFF2](http://www.sanger.ac.uk/resources/software/gff/spec.html)**, **[GFF3](http://www.sequenceontology.org/gff3.shtml)**, and **[BED](http://genome.ucsc.edu/FAQ/FAQformat.html)** formats are available.
There are three ways of specifying the format:
......@@ -151,18 +149,12 @@ There are three ways of specifying the format:
* [{{ BASE_URL }}/api/v1/rna/URS0000000001/?format=fasta](/api/v1/rna/URS0000000001/?format=fasta)
* [{{ BASE_URL }}/api/v1/rna/URS0000000001/?format=yaml](/api/v1/rna/URS0000000001/?format=yaml)
* [{{ BASE_URL }}/api/v1/rna/URS0000000001/?format=api](/api/v1/rna/URS0000000001/?format=api)
* [{{ BASE_URL }}/api/v1/rna/URS000063A371/?format=bed](/api/v1/rna/URS000063A371/?format=bed)
* [{{ BASE_URL }}/api/v1/rna/URS000063A371/?format=gff](/api/v1/rna/URS000063A371/?format=gff)
* [{{ BASE_URL }}/api/v1/rna/URS000063A371/?format=gff3](/api/v1/rna/URS000063A371/?format=gff3)
2. `.format` suffix
* [{{ BASE_URL }}/api/v1/rna/URS0000000001.json](/api/v1/rna/URS0000000001.json)
* [{{ BASE_URL }}/api/v1/rna/URS0000000001.fasta](/api/v1/rna/URS0000000001.fasta)
* [{{ BASE_URL }}/api/v1/rna/URS0000000001.yaml](/api/v1/rna/URS0000000001.yaml)
* [{{ BASE_URL }}/api/v1/rna/URS0000000001.api](/api/v1/rna/URS0000000001.api)
* [{{ BASE_URL }}/api/v1/rna/URS000063A371.bed](/api/v1/rna/URS000063A371.bed)
* [{{ BASE_URL }}/api/v1/rna/URS000063A371.gff](/api/v1/rna/URS000063A371.gff)
* [{{ BASE_URL }}/api/v1/rna/URS000063A371.gff3](/api/v1/rna/URS000063A371.gff3)
3. [Accept headers](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)
......@@ -171,9 +163,6 @@ There are three ways of specifying the format:
curl -H "Accept: text/fasta" {{ BASE_URL }}/api/v1/rna/URS0000000001
curl -H "Accept: application/yaml" {{ BASE_URL }}/api/v1/rna/URS0000000001
curl -H "Accept: text/html" {{ BASE_URL }}/api/v1/rna/URS0000000001
curl -H "Accept: text/bed" {{ BASE_URL }}/api/v1/rna/URS000063A371
curl -H "Accept: text/gff" {{ BASE_URL }}/api/v1/rna/URS000063A371
curl -H "Accept: text/gff3" {{ BASE_URL }}/api/v1/rna/URS000063A371
```
In case there is a conflict between the Accept headers and the format parameter, an error message is returned, for example:
......
......@@ -36,16 +36,5 @@ bsub -o logs/xrefs_lsfreport.txt -e logs/xrefs_output.txt python manage.py ftp_e
# fasta
bsub -o logs/fasta_lsfreport.txt -e logs/fasta_output.txt python manage.py ftp_export -f fasta -d $destination
# gff
bsub -o logs/gff_lsfreport.txt -e logs/gff_output.txt python manage.py ftp_export -f gff -d $destination
# gff3
bsub -o logs/gff3_lsfreport.txt -e logs/gff3_output.txt python manage.py ftp_export -f gff3 -d $destination
# md5
bsub -o logs/md5_lsfreport.txt -e logs/md5_output.txt python manage.py ftp_export -f md5 -d $destination
# bed and UCSC trackhub, `bed` must preceed `trackhub` because the trackhub job uses bigbed files produced by `bed`
# the python commands are quoted so that they both are executed by bsub
cmd='python manage.py ftp_export -f bed -d '$destination' -b '$ucsc_tools' && python manage.py ftp_export -f trackhub -d '$destination
bsub -o logs/bed_lsfreport.txt -e logs/bed_output.txt $cmd
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment