Skip to content
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

markerpositiontype prop? #49

Open
bradfordcondon opened this issue Apr 8, 2019 · 7 comments
Open

markerpositiontype prop? #49

bradfordcondon opened this issue Apr 8, 2019 · 7 comments

Comments

@bradfordcondon
Copy link
Contributor

bradfordcondon commented Apr 8, 2019

marker_position_type is loaded as "start".

However the other featureposprops are

3.5     start position
1.1     start position
0       start position
50.9    stop position
50.8    stop position

does this really make sense? Do we still use the marker_position_type = start prop? Or is it a remnant of our previous way of doing things?

@bradfordcondon
Copy link
Contributor Author

 select * from tripal_map_qtl_and_mtl_mview;
map_name        map_id  map_type        linkage_group   linkage_group_id        marker_locus_name       map_unit_type   marker_type     marker_pos_type marker_pos      organism_id     genus   species common_name     feature_id
      featurepos_id
QTL MAP 89      genetic L       4787    CmSNP00856      bin_unit        QTL     50.9    50.6    1       Fraxinus        excelsior       F. excelsior miniature  3880    2608
QTL MAP 89      genetic L       4787    CmSNP00856      bin_unit        QTL     50.6    50.6    1       Fraxinus        excelsior       F. excelsior miniature  3880    2608
QTL MAP 89      genetic L       4787    CmSNP00856      bin_unit        QTL     start   50.6    1       Fraxinus        excelsior       F. excelsior miniature  3880    2608
hkjhjkh 87      genetic L       4787    CmSNP00856      bin_unit        QTL     50.9    50.6    2       apis    melifera        bee     3880    1433
hkjhjkh 87      genetic L       4787    CmSNP00856      bin_unit        QTL     50.6    50.6    2       apis    melifera        bee     3880    1433
hkjhjkh 87      genetic L       4787    CmSNP00856      bin_unit        QTL     start   50.6    2       apis    melifera        bee     3880    1433
QTL MAP 89      genetic L       4787    CmSNP00284      bin_unit        QTL     50.8    50.6    1       Fraxinus        excelsior       F. excelsior miniature  3878    2607
QTL MAP 89      genetic L       4787    CmSNP00284      bin_unit        QTL     50.6    50.6    1       Fraxinus        excelsior       F. excelsior miniature  3878    2607
QTL MAP 89      genetic L       4787    CmSNP00284      bin_unit        QTL     start   50.6    1       Fraxinus        excelsior       F. excelsior miniature  3878    2607
hkjhjkh 87      genetic L       4787    CmSNP00284      bin_unit        QTL     50.8    50.6    2       apis    melifera        bee     3878    1432

if we look at how the mview is populating, it looks like "start" is the only one that IS loading properly with the mview...

@bradfordcondon
Copy link
Contributor Author

bradfordcondon commented Apr 8, 2019

marker_pos_type in the mview.

FPP.value as marker_pos_type . so we actually want to get FPP's type name for marker_pos_type instead.


SELECT FM.name as map_name,
FM.featuremap_id as map_id,
 FMP.value as map_type,
  F3.name as linkage_group,
F3.feature_id as linkage_group_id,
F.uniquename as marker_locus_name,
C1.name as map_unit_type,
C2.name as marker_type,
C4.name as marker_pos_type,
FP.mappos as marker_pos,
O.organism_id as organism_id, O.genus as genus, O.species as species, O.common_name as common_name,
F.feature_id as feature_id, FPP.featurepos_id as featurepos_id
FROM {feature} F
--F is the biological_region or parent marker locus
INNER JOIN {feature_relationship} FR 	ON FR.subject_id = F.feature_id AND
 F.type_id = (SELECT cvterm_id  FROM {cvterm} WHERE name = 'biological_region' AND
 cv_id = (SELECT cv_id FROM cv WHERE name = 'sequence'))
  AND
 FR.type_id = (SELECT cvterm_id  FROM {cvterm} WHERE cvterm.name = 'instance_of' AND
 cv_id = (SELECT cv_id FROM cv WHERE name = 'OBO_REL'))

-- F2 is the marker feature itself
INNER JOIN {feature} F2               	ON FR.object_id = F2.feature_id
-- This mview is just for QTLs
INNER JOIN {cvterm} C ON F2.type_id = C.cvterm_id AND (C.name = 'QTL' OR C.name = 'heritable_phenotypic_marker')
INNER JOIN {featurepos} FP            	ON F2.feature_id = FP.feature_id
INNER JOIN {featuremap} FM    		ON FM.featuremap_id = FP.featuremap_id
INNER JOIN {cvterm} C1                ON C1.cvterm_id = FM.unittype_id
-- C2 is the marker type term
 INNER JOIN {cvterm} C2 ON C2.cvterm_id = F2.type_id
INNER JOIN {featuremapprop} FMP       ON FMP.featuremap_id = FP.featuremap_id AND
FMP.type_id = (SELECT cvterm_id FROM cvterm WHERE name = 'featuremap_type' AND
cv_id = (SELECT cv_id FROM cv WHERE name = 'local'))
INNER JOIN {featuremap_organism} FMO 	ON FMO.featuremap_id = FM.featuremap_id
--F3 is the parent feature of the map ie the linkage group
INNER JOIN {feature} F3 				ON FP.map_feature_id = F3.feature_id
INNER JOIN {featureposprop} FPP 		ON FPP.featurepos_id = FP.featurepos_id
INNER JOIN {organism} O 				ON FMO.organism_id = O.organism_id
INNER JOIN {cvterm} C4  ON FPP.type_id = C4.cvterm_id

so this instead. however, we have to deal with taht "extra" prop

@bradfordcondon
Copy link
Contributor Author

bradfordcondon commented Apr 8, 2019

need to fix both mviews.

FP.mappos as marker_pos, C.name as marker_pos_type,

we actually need marker_pos to be = the featureposprop value

like this:

SELECT F.uniquename as marker_locus_name, F.feature_id as marker_locus_id, F2.uniquename as genetic_marker_name,
  C1.name as map_unit_type, C2.name as marker_type, FM.name as map_name, FM.featuremap_id as map_id, FMP.value as map_type,
  F3.name as linkage_group, F3.feature_id as linkage_group_id, FPP.value as marker_pos, C.name as marker_pos_type,
  O.organism_id as organism_id, O.genus as genus, O.species as species, O.common_name as common_name
  FROM {feature} F
  INNER JOIN {feature_relationship} FR 	ON FR.subject_id = F.feature_id AND
    F.type_id = (SELECT cvterm_id  FROM {cvterm} WHERE name = 'biological_region' AND
    cv_id = (SELECT cv_id FROM {cv} WHERE name = 'sequence'))
     AND
    FR.type_id = (SELECT cvterm_id  FROM {cvterm} WHERE {cvterm}.name = 'instance_of' AND
    cv_id = (SELECT cv_id FROM {cv} WHERE name = 'OBO_REL'))

  INNER JOIN {feature} F2               	ON FR.object_id = F2.feature_id 
     AND
    FR.type_id = (SELECT cvterm_id FROM {cvterm} WHERE name = 'instance_of' AND
    cv_id = (SELECT cv_id FROM {cv} WHERE name = 'OBO_REL'))
    
  INNER JOIN {featurepos} FP            	ON F2.feature_id = FP.feature_id
  
  INNER JOIN {featuremap} FM    		ON FM.featuremap_id = FP.featuremap_id
  INNER JOIN {cvterm} C1                ON C1.cvterm_id = FM.unittype_id
  	INNER JOIN {cvterm} C2 ON C2.cvterm_id = F2.type_id
  INNER JOIN {featuremapprop} FMP       ON FMP.featuremap_id = FP.featuremap_id AND
   FMP.type_id = (SELECT cvterm_id FROM {cvterm} WHERE name = 'featuremap_type' AND
   cv_id = (SELECT cv_id FROM {cv} WHERE name = 'local'))
  INNER JOIN {featuremap_organism} FMO 	ON FMO.featuremap_id = FM.featuremap_id
  INNER JOIN {feature} F3 				ON FP.map_feature_id = F3.feature_id
  INNER JOIN {featureposprop} FPP 		ON FPP.featurepos_id = FP.featurepos_id
  INNER JOIN {cvterm} C 				ON C.cvterm_id = FPP.type_id
  INNER JOIN {organism} O 				ON FMO.organism_id = O.organism_id

  

and for hte QTL mview

SELECT FM.name as map_name,
FM.featuremap_id as map_id,
 FMP.value as map_type,
  F3.name as linkage_group,
F3.feature_id as linkage_group_id,
F.uniquename as marker_locus_name,
C1.name as map_unit_type,
C2.name as marker_type,
C4.name as marker_pos_type,
FPP.value as marker_pos,
O.organism_id as organism_id, O.genus as genus, O.species as species, O.common_name as common_name,
F.feature_id as feature_id, FPP.featurepos_id as featurepos_id
FROM {feature} F
--F is the biological_region or parent marker locus
INNER JOIN {feature_relationship} FR 	ON FR.subject_id = F.feature_id AND
 F.type_id = (SELECT cvterm_id  FROM {cvterm} WHERE name = 'biological_region' AND
 cv_id = (SELECT cv_id FROM cv WHERE name = 'sequence'))
  AND
 FR.type_id = (SELECT cvterm_id  FROM {cvterm} WHERE cvterm.name = 'instance_of' AND
 cv_id = (SELECT cv_id FROM cv WHERE name = 'OBO_REL'))

-- F2 is the marker feature itself
INNER JOIN {feature} F2               	ON FR.object_id = F2.feature_id
-- This mview is just for QTLs
INNER JOIN {cvterm} C ON F2.type_id = C.cvterm_id AND (C.name = 'QTL' OR C.name = 'heritable_phenotypic_marker')
INNER JOIN {featurepos} FP            	ON F2.feature_id = FP.feature_id
INNER JOIN {featuremap} FM    		ON FM.featuremap_id = FP.featuremap_id
INNER JOIN {cvterm} C1                ON C1.cvterm_id = FM.unittype_id
-- C2 is the marker type term
 INNER JOIN {cvterm} C2 ON C2.cvterm_id = F2.type_id
INNER JOIN {featuremapprop} FMP       ON FMP.featuremap_id = FP.featuremap_id AND
FMP.type_id = (SELECT cvterm_id FROM cvterm WHERE name = 'featuremap_type' AND
cv_id = (SELECT cv_id FROM cv WHERE name = 'local'))
INNER JOIN {featuremap_organism} FMO 	ON FMO.featuremap_id = FM.featuremap_id
--F3 is the parent feature of the map ie the linkage group
INNER JOIN {feature} F3 				ON FP.map_feature_id = F3.feature_id
INNER JOIN {featureposprop} FPP 		ON FPP.featurepos_id = FP.featurepos_id
INNER JOIN {organism} O 				ON FMO.organism_id = O.organism_id
INNER JOIN {cvterm} C4  ON FPP.type_id = C4.cvterm_id

@bradfordcondon
Copy link
Contributor Author

ACK! Need to update the module settings to use our start / stop terms which are start position instead of start
Screen Shot 2019-04-08 at 2 39 07 PM

@bradfordcondon
Copy link
Contributor Author

I think the QTL marker name abbreviation is what is breakng it. its not part of the mview. Unchecking hte box in settings doenst fix it. So instead i suggest we replace the JS with this:

this.name = markerData.genetic_marker_locus_name;
			this.nameAbbrev = markerData.marker_name_abbrev ? markerData.marker_name_abbrev : markerData.genetic_marker_locus_name;

so if tehres an abbreviation use it, otherwise, us the full name.

without this code-
Screen Shot 2019-04-08 at 3 04 20 PM

with this code -

Screen Shot 2019-04-08 at 3 04 46 PM

@bradfordcondon
Copy link
Contributor Author

Stop term isnt working

Screen Shot 2019-04-08 at 3 21 07 PM

@bradfordcondon
Copy link
Contributor Author

bradfordcondon commented Apr 8, 2019

our features appear to be well-formed. they have a start and stop key defined by tripalmap

Screen Shot 2019-04-08 at 4 13 50 PM

however, when we get to the JS and constructing the QTLMarker, we no longer have a stop position:

Screen Shot 2019-04-08 at 4 15 40 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant