Permalink
Browse files

Provide basic support for new Biopython 1.62 handling of CompoundFeat…

…ures. Still uses deprecated sub_features until sorting out a reasonable place to put GFF attributes. Fixes #75
  • Loading branch information...
1 parent ddaf9c2 commit ddd08a8f84c52cbbe9b4d134f943b3a2a0bb5029 @chapmanb committed Sep 18, 2013
View
21 gff/BCBio/GFF/GFFParser.py
@@ -31,7 +31,7 @@
from Bio.Seq import UnknownSeq
from Bio.SeqRecord import SeqRecord
-from Bio.SeqFeature import SeqFeature, FeatureLocation
+from Bio import SeqFeature
from Bio import SeqIO
def _gff_line_map(line, params):
@@ -432,8 +432,8 @@ def _identify_dup_ids(self, parents):
multi_ids = collections.defaultdict(list)
for parent in parents:
multi_ids[parent['id']].append(parent)
- multi_ids = [(mid, parents) for (mid, parents) in multi_ids.items()
- if len(parents) > 1]
+ multi_ids = [(mid, ps) for (mid, ps) in multi_ids.items()
+ if len(parents) > 1]
multi_remap = dict()
for mid, parents in multi_ids:
multi_remap[mid] = _MultiIDRemapper(mid, parents)
@@ -444,10 +444,14 @@ def _add_children_to_parent(self, cur_parent, children):
"""
if children.has_key(cur_parent.id):
cur_children = children[cur_parent.id]
- for rec_id, cur_child in cur_children:
- cur_child, children = self._add_children_to_parent(cur_child,
- children)
+ ready_children = []
+ for _, cur_child in cur_children:
+ cur_child, _ = self._add_children_to_parent(cur_child, children)
+ ready_children.append(cur_child)
+ # Support Biopython features for 1.62+ CompoundLocations and pre-1.62
+ if not hasattr(SeqFeature, "CompoundLocation"):
cur_parent.location_operator = "join"
+ for cur_child in ready_children:
cur_parent.sub_features.append(cur_child)
del children[cur_parent.id]
return cur_parent, children
@@ -517,8 +521,8 @@ def _add_toplevel_feature(self, base, feature_dict):
def _get_feature(self, feature_dict):
"""Retrieve a Biopython feature from our dictionary representation.
"""
- location = FeatureLocation(*feature_dict['location'])
- new_feature = SeqFeature(location, feature_dict['type'],
+ location = SeqFeature.FeatureLocation(*feature_dict['location'])
+ new_feature = SeqFeature.SeqFeature(location, feature_dict['type'],
id=feature_dict['id'], strand=feature_dict['strand'])
new_feature.qualifiers = feature_dict['quals']
return new_feature
@@ -616,7 +620,6 @@ def _file_line_generator(self, gff_files):
else:
need_close = True
in_handle = open(gff_file)
- found_seqs = False
while 1:
line = in_handle.readline()
if not line:
View
2 gff/BCBio/GFF/__init__.py
@@ -3,4 +3,4 @@
from GFFParser import GFFParser, DiscoGFFParser, GFFExaminer, parse, parse_simple
from GFFOutput import GFF3Writer, write
-__version__="0.3a"
+__version__="0.3"
View
12 posts/conferences/bosc_codefest_report.org
@@ -38,7 +38,7 @@ science.
#+LINK: open-bio http://www.open-bio.org/wiki/Main_Page
#+LINK: codefest http://www.open-bio.org/wiki/Codefest_2013
#+LINK: codefest-doc https://docs.google.com/document/d/1xbS7ZkjipXct00eOfR7-IL_Ti6QzAsjFvcJtopMeT2g/edit
-#+LINK: roman-photos https://plus.google.com/u/0/photos/115208034315059721590/albums/590205279902807640
+#+LINK: roman-photos http://j.mp/codefest2013-photos
* Tool Development
@@ -54,7 +54,10 @@ found that it can be a burden to create new Web app from
scratch on top of your NGS program. So we started new project to
provide a Web-app scaffold for BaseSpace. We have already implemented the
basic portion but will need some more time before releasing the
-BioBaseSpace application.
+BioBaseSpace application. The BaseSpace Ruby SDK was officially
+released: for more information, see [[release-info][Joachim's blog post]], the
+[[release-bioruby][official announcement from the BioRuby team]] and the
+[[release-illumina][annoucement from Illumina]].
#+BEGIN_HTML
<a href="http://bcbio.files.wordpress.com/2013/07/biobasespace.png">
@@ -64,6 +67,9 @@ BioBaseSpace application.
#+LINK: basespace-ruby https://github.com/joejimbo/basespace-ruby-sdk
#+LINK: basespace https://basespace.illumina.com/home/index
+#+LINK: release-info http://joachimbaran.wordpress.com/2013/08/05/basespace-ruby-sdk/
+#+LINK: release-bioruby http://lists.open-bio.org/pipermail/bioruby/2013-August/002523.html
+#+LINK: release-illumina https://groups.google.com/forum/#!msg/basespace-developers/GW_hQ2OkCiQ/3aqnM2FdSeQJ
** Barrnap - Bacterial ribosomal RNA predictor
@@ -208,7 +214,7 @@ supplement existing SGE, LSF, Torque and Condor schedulers. We plan to
extend this to allow generalized use of the DRMAA connector,
ultimately port such generalization into ipython so that python
scientific computations can be executed efficiently across different
-clusters implementation. Both [[g-blog][Roman]] and [[g-blog][Guillermo]] blogged
+clusters implementation. Both [[r-blog][Roman]] and [[g-blog][Guillermo]] blogged
[[r-blog2][detailed documentation]] of the [[g-blog2][work in progress]].
We also worked to build a tool that helps provide run time
View
2 validation/plot_validation_results.r
@@ -125,7 +125,7 @@ plot_caller_differences <- function(d) {
p <- ggplot(d, aes(x=caller, y=value.floor)) +
geom_bar(stat="identity") +
- geom_text(data=d, aes(y=value.floor + 2500, label=value), size=3, vjust=1.5) +
+ geom_text(data=d, aes(y=value.floor + 2500, label=value), size=2, vjust=1.5) +
facet_grid(variant.type ~ category) +
theme(axis.title.y = element_text(size=7)) +
theme(axis.ticks.y = element_blank(), axis.text.y = element_blank()) +

0 comments on commit ddd08a8

Please sign in to comment.