Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Carlos Ribas
rnacentral-webcode
Commits
d308874b
Commit
d308874b
authored
Dec 03, 2020
by
carlosribas
Browse files
Exclude region with status different than "clustered"
parent
bcd78ebe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
24 deletions
+37
-24
rnacentral/apiv1/views.py
rnacentral/apiv1/views.py
+37
-24
No files found.
rnacentral/apiv1/views.py
View file @
d308874b
...
...
@@ -16,6 +16,7 @@ import requests
import
zlib
from
itertools
import
chain
from
django.db
import
connection
from
django.http
import
Http404
,
HttpResponse
from
django.shortcuts
import
get_object_or_404
from
django_filters
import
rest_framework
as
filters
...
...
@@ -31,17 +32,17 @@ 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
,
\
RnaSpeciesSpecificSerializer
,
ExpertDatabaseStatsSerializer
,
\
RnaFlatSerializer
,
RnaFastaSerializer
,
RnaGffSerializer
,
RnaGff3Serializer
,
\
RnaBedSerializer
,
RnaSpeciesSpecificSerializer
,
ExpertDatabaseStatsSerializer
,
\
RawPublicationSerializer
,
RnaSecondaryStructureSerializer
,
\
RfamHitSerializer
,
SequenceFeatureSerializer
,
\
EnsemblAssemblySerializer
,
ProteinTargetsSerializer
,
\
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
,
\
SecondaryStructureWithLayout
,
dictfetchall
from
portal.config.expert_databases
import
expert_dbs
from
rnacentral.utils.pagination
import
Pagination
,
PaginatedRawQuerySet
...
...
@@ -449,6 +450,18 @@ class RnaGenomeLocations(generics.ListAPIView):
output
=
[]
for
region
in
regions
:
# check the gene status for each region
query
=
'''
SELECT status
FROM rnc_gene_status
WHERE region_id = '{region_id}'
'''
.
format
(
region_id
=
region
.
id
)
with
connection
.
cursor
()
as
cursor
:
cursor
.
execute
(
query
)
data
=
dictfetchall
(
cursor
)
# show results only from those with "clustered" status
if
data
[
0
][
'status'
]
==
"clustered"
:
output
.
append
({
'chromosome'
:
region
.
chromosome
,
'strand'
:
region
.
strand
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment