-
Notifications
You must be signed in to change notification settings - Fork 1
Change format of PTM column for glycosylation #246 #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1846,12 +1846,12 @@ def __init__(self, database_dir, database_files=None): | |
| self._ptm_types = ['acetylation', 'methylation', 'O-GalNAc', 'O-GlcNAc', 'phosphorylation', 'sumoylation', 'ubiquitination'] | ||
| self._ptm_types_to_classes = { 'acetylation' : 'ptm_acetylation', | ||
| 'methylation' : 'ptm_methylation', | ||
| 'O-GalNAc' : 'ptm_ogalnac', | ||
| 'O-GlcNAc' : 'ptm_oglcnac', | ||
| 'O-GalNAc' : 'ptm_glycosylation', | ||
| 'O-GlcNAc' : 'ptm_glycosylation', | ||
| 'phosphorylation' : 'ptm_phosphorylation', | ||
| 'sumoylation' : 'ptm_sumoylation', | ||
| 'ubiquitination' : 'ptm_ubiquitination' } | ||
| self._ptm_suffixes = ['ac', 'm[0-9]', 'ga', 'gl', 'p', 'sm', 'ub'] | ||
| self._ptm_suffixes = ['ac', 'm[0-9]', 'gly', 'gly', 'p', 'sm', 'ub'] | ||
| self._ptm_suffix_offsets = [-3, -3, -3, -3, -2, -3, -3] | ||
|
|
||
| self._database_dir = database_dir | ||
|
|
@@ -1931,6 +1931,30 @@ def add_position_properties(self, sequence, properties=None): | |
| ) | ||
| position.add_property(property_obj) | ||
| self.log.info("adding %s to site %s" % (m, property_obj.name)) | ||
|
|
||
| is_gly = False | ||
| has_gly_site = False | ||
| has_gly_sub = False | ||
| for prop in position.properties.values(): | ||
| if prop.category == 'ptm_glycosylation': | ||
| is_gly = True | ||
| break | ||
|
|
||
| has_gly_site = any(prop.category == 'ptm_glycosylation' for prop in position.properties.values()) | ||
| if not has_gly_site: | ||
| gly_site = position_properties_classes['ptm_glycosylation']( | ||
| position=position, | ||
| sources=[self]) | ||
| position.add_property(gly_site) | ||
|
Comment on lines
+1935
to
+1948
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this code assumes we will have only one glycosilation site property per position this might be the case - do we need to also consider cases there might be different glycosilation subtypes for the same site? if e.g. our different sources have different or complementary subtypes |
||
|
|
||
| has_gly_subtype = any(prop.header == 'glycosylation_subtype' for prop in position.properties.values()) | ||
| if not has_gly_subtype: | ||
| gly_sub = position_properties_classes['glycosylation_subtype']( | ||
| position=position, | ||
| sources=[self], | ||
| subtype="" | ||
| ) | ||
| position.add_property(gly_sub) | ||
|
|
||
| class MyVariant(DynamicSource, object): | ||
| @logger_init | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,47 +173,53 @@ def __init__(self, position, sources): | |
|
|
||
| def get_value_str(self): | ||
| return self.code | ||
|
|
||
| class OGalNAcSite(PositionProperty): | ||
| description = "OGalNAc site" | ||
| header = "ogalnac_site" | ||
| category='ptm_ogalnac' | ||
| code = "O-GalNAc" | ||
| class GlycosylationSite(PositionProperty): | ||
| description = "Glycosylation site" | ||
| header = "glycosylation_site" | ||
| category='ptm_glycosylation' | ||
| code = "Gly" | ||
|
|
||
| def __init__(self, position, sources): | ||
| super(OGalNAcSite, self).__init__( name="o-GalNAc Site", | ||
| super(GlycosylationSite, self).__init__( name="Glycosylation Site", | ||
| position=position, | ||
| sources=sources, | ||
| values={}, | ||
| metadata={} ) | ||
|
|
||
| def get_value_str(self): | ||
| return self.code | ||
|
|
||
| class GlycosylationSubtype(PositionProperty): | ||
| description = "Glycosylation Subtype" | ||
| header = "glycosylation_subtype" | ||
| category="glycosylation_subtype" | ||
| #code = | ||
|
Comment on lines
+193
to
+197
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this should be a this is not a feature of the protein position, it's a feature of the glycosilation itself I think the constructor of |
||
|
|
||
| class OGlcNAcSite(PositionProperty): | ||
| description = "OGlcNAc site" | ||
| header = "oglcnac_site" | ||
| category='ptm_oglcnac' | ||
| code = "O-GlcNAc" | ||
|
|
||
| subtype = "" | ||
|
|
||
| def __init__(self, position, sources): | ||
| super(OGlcNAcSite, self).__init__( name="o-GlcNAc Site", | ||
| def __init__(self, position, sources, subtype): | ||
| super(GlycosylationSubtype, self).__init__( name="GlycosylationSubtype", | ||
| position=position, | ||
| sources=sources, | ||
| values={}, | ||
| values={"subtype": subtype}, | ||
| metadata={} ) | ||
|
|
||
| def get_value_str(self): | ||
| return self.code | ||
|
|
||
| return self.values.get("subtype", "") | ||
| #return self.values.get("subtype") | ||
| #val = self.values.get("subtype") | ||
| #if val is None: | ||
| #return "" | ||
| #else: | ||
| #return str(val) | ||
|
|
||
| class SumoylationSite(PositionProperty): | ||
| description = "Sumoylation site" | ||
| header = "sumoyylation_site" | ||
| category='ptm_sumoylation' | ||
| code = "Sumo" | ||
|
|
||
|
|
||
| def __init__(self, position, sources): | ||
| super(SumoylationSite, self).__init__( name="Sumoylation Site", | ||
| position=position, | ||
|
|
@@ -306,8 +312,8 @@ def __init__(self, position, sources): | |
| 'ptm_methylation' : MethylationSite, | ||
| 'ptm_acetylation' : AcetylationSite, | ||
| 'ptm_nitrosylation' : SNitrosylationSite, | ||
| 'ptm_ogalnac' : OGalNAcSite, | ||
| 'ptm_oglcnac' : OGlcNAcSite, | ||
| 'ptm_glycosylation' : GlycosylationSite, | ||
| 'glycosylation_subtype' : GlycosylationSubtype, | ||
| 'ptm_sumoylation' : SumoylationSite, | ||
| 'ptm_ubiquitination' : UbiquitinationSite, | ||
| 'ptm_cleavage' : CleavageSite, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be the source of your issue
here you use lines 1935-1941 to check which one of your properties is a Gly (ok)
however you don't handle the case in which there are no Glys. This part of the code use just
propwhich is whatever property comes last out of the previous for loop, whether it is a glycosilation or not (i.e. whether thebreakwas triggered or not)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mind that this section of the code is bound to be changed - read all my comments before starting to change things :)