Comments (5)
sorry, that doesn't work because the input is actually not a Genotype
from gnomic.
@phantomas1234 a Mutation
is not a genotype, but a change. You want to use change_to_text()
not genotype_to_text()
from gnomic.
Haha, the button changed to Reopen just as I clicked :)
from gnomic.
from gnomic.utils import genotype_to_string, genotype_to_text, change_to_text, change_to_string
from gnomic import Mutation, FeatureTree, Feature, Accession
g = Mutation(new=FeatureTree(Feature(type='reaction', accession=Accession(identifier='3OAR140'), variant='down-regulation(-0.996)')), old=FeatureTree(Feature(type='reaction', accession=Accession(identifier='3OAR140'))), multiple=False)
change_to_string(g)
That one seems to be broken too?
AttributeError Traceback (most recent call last)
<ipython-input-43-561e8086745e> in <module>()
4
5 g = Mutation(new=FeatureTree(Feature(type='reaction', accession=Accession(identifier='3OAR140'), variant='down-regulation(-0.996)')), old=FeatureTree(Feature(type='reaction', accession=Accession(identifier='3OAR140'))), multiple=False)
----> 6 change_to_string(g)
/Users/niso/anaconda3/lib/python3.5/site-packages/gnomic/utils.py in change_to_string(change)
118 s = '{}>>{}'.format(feature_to_string(change.old), feature_to_string(change.new))
119 else:
--> 120 s = '{}>{}'.format(feature_to_string(change.old), feature_to_string(change.new))
121 elif change.old is None:
122 # FIXME phenotypes should not have a + or - prefix; only a postfix.
/Users/niso/anaconda3/lib/python3.5/site-packages/gnomic/utils.py in feature_to_string(feature)
146 return ':'.join(feature_to_string(f) for f in feature.contents)
147 elif isinstance(feature, FeatureTree):
--> 148 contents = ' '.join(feature_to_string(f) for f in feature.contents)
149 if isinstance(feature, FeatureSet):
150 return '{{{contents}}}'.format(contents=contents)
/Users/niso/anaconda3/lib/python3.5/site-packages/gnomic/utils.py in <genexpr>(.0)
146 return ':'.join(feature_to_string(f) for f in feature.contents)
147 elif isinstance(feature, FeatureTree):
--> 148 contents = ' '.join(feature_to_string(f) for f in feature.contents)
149 if isinstance(feature, FeatureSet):
150 return '{{{contents}}}'.format(contents=contents)
/Users/niso/anaconda3/lib/python3.5/site-packages/gnomic/utils.py in feature_to_string(feature)
146 return ':'.join(feature_to_string(f) for f in feature.contents)
147 elif isinstance(feature, FeatureTree):
--> 148 contents = ' '.join(feature_to_string(f) for f in feature.contents)
149 if isinstance(feature, FeatureSet):
150 return '{{{contents}}}'.format(contents=contents)
/Users/niso/anaconda3/lib/python3.5/site-packages/gnomic/utils.py in <genexpr>(.0)
146 return ':'.join(feature_to_string(f) for f in feature.contents)
147 elif isinstance(feature, FeatureTree):
--> 148 contents = ' '.join(feature_to_string(f) for f in feature.contents)
149 if isinstance(feature, FeatureSet):
150 return '{{{contents}}}'.format(contents=contents)
/Users/niso/anaconda3/lib/python3.5/site-packages/gnomic/utils.py in feature_to_string(feature)
155 else:
156 s = ''
--> 157 if feature.type and feature.type.name != 'phene':
158 s += '{}.'.format(feature.type.name)
159
AttributeError: 'str' object has no attribute 'name'
from gnomic.
Feature.type must be a Type
.
from gnomic.
Related Issues (20)
- Add helper function to determine if a genotype is a subset of another genotype
- Features of type "phene" rendered like normal features in Genotype.format()
- Fix genotype_to_string() rendering fusions and single markers as featuresets
- Consider adding "Present" mutation type for plasmids and phenotypes
- Full documentation of the language and behavior
- Add flag warning when a substitution is ambiguous
- Cannot parse gnomic generated string
- change_to_text() on plasmid with marker adds plasmid itself as marker
- Implement HTML format output
- Refactor for version 1.0
- Rewrite formatting and other functions for version 1.0
- Support parsing genotype changes with spaces HOT 1
- Parsing 'None' gives obscure error HOT 1
- Support the entire Sequence Variant Nomenclature range for DNA and protein
- Add flake8
- Single nucleotide deletion not working HOT 2
- a>{b c}:a not working in v1
- Ensure presence declarations are handled properly
- Replace "-" with "^" to signify deletions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gnomic.