From: Cook, M. <ME...@st...> - 2018-10-01 22:07:41
|
I _think_ this is consistent with literal reading of https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md from which: Column 9: "attributes" A list of feature attributes in the format tag=value. Multiple tag=value pairs are separated by semicolons. URL escaping rules are used for tags or values containing the following characters: ",=;". Spaces are allowed in this field, but tabs must be replaced with the %09 URL escape. Attribute values do not need to be and should not be quoted. The quotes should be included as part of the value by parsers and not stripped. From: Colin <col...@gm...> Sent: Monday, October 01, 2018 12:18 PM To: Sofia Robb <so...@so...> Cc: gmo...@li... Subject: Re: [Gmod-ajax] Fwd: functions and 9th column attributes **CAUTION: Non-Stowers email** It looks like the issue is a space around the semi-colon means that this is included in the attribute name so you can get it by calling feature.get(" snv.effect") I don't know what the GFF3 specification says in this case but it does appear that if you removed those spaces it would work too! -Colin On Mon, Oct 1, 2018 at 12:56 PM Sofia Robb <so...@so...<mailto:so...@so...>> wrote: Hi Colin, Thank you for your reply. I didn't think to try console.log(). Thanks for the tip, but it did not help me clarify my problem. I get undefined when I try console.log('snv.effect') but not console.log('score'). The glyph I tested is one generated from the gff lines below, and the data in the track info window is what it should be, the snv.effect attribute is listed. Maybe i have done something wrong in my conf file or in my gff: { "compress" : 0, "key" : "SNPs in differential peaks with annotations", "label" : "snps_peaks_genes_scores.gff3", "storeClass" : "JBrowse/Store/SeqFeature/NCList", "style" : { "className" : "feature", "color" : "function(feature) {console.log(feature.get('snv.effect')) ; return 'red'}" }, "trackType" : "JBrowse/View/Track/CanvasFeatures", "type" : "JBrowse/View/Track/CanvasFeatures", "urlTemplate" : "tracks/snps_peaks_genes_scores.gff3/{refseq}/trackData.json" }, here are a couple of lines from the gff that i loaded: ##gff-version 3 ##sequence-region NC_035897.1 17367686 17367798 NC_035897.1 SCI-003279 snv 17367707 17367708 0.225082555874882 . . avg.gerp.gene=NA; avg.gerp.promoter=NA; ensembl.gene=NA; ensembl.tx=NA; motif.genesymbol=KLF10; motif.seq=gagggagCgtgg; peak.bias=surface; peak.padj=0.225082555874882; snv.alt=T; snv.effect=strong; snv.ref=C;_Peak.logfc=0.729035743408939 NC_035897.1 SCI-003279 snv 17367714 17367715 0.225082555874882 . . avg.gerp.gene=NA; avg.gerp.promoter=NA; ensembl.gene=NA; ensembl.tx=NA; motif.genesymbol=ZSCAN22; motif.seq=gagggagggagcgtggagGg; peak.bias=surface; peak.padj=0.225082555874882; snv.alt=A; snv.effect=strong; snv.ref=G;_Peak.logfc=0.729035743408939 ### NC_035897.1 SCI-003279 snv 17367732 17367733 0.225082555874882 . . avg.gerp.gene=NA; avg.gerp.promoter=NA; ensembl.gene=NA; ensembl.tx=NA; motif.genesymbol=RBPJ:Ebox; motif.seq=ctctCggctttttcccc; peak.bias=surface; peak.padj=0.225082555874882; snv.alt=T; snv.effect=strong; snv.ref=C;_Peak.logfc=0.729035743408939 NC_035897.1 SCI-003279 snv 17367742 17367743 0.225082555874882 . . avg.gerp.gene=NA; avg.gerp.promoter=NA; ensembl.gene=NA; ensembl.tx=NA; motif.genesymbol=RFX; motif.seq=ctttttcCccggcaac; peak.bias=surface; peak.padj=0.225082555874882; snv.alt=T; snv.effect=strong; snv.ref=C;_Peak.logfc=0.729035743408939 here is the line I was actually trying to use: "color" : "function(feature) {return feature.get('snv.effect')=='strong' ? 'green' : 'blue'}" Thank you soo much! Sofia On Sun, Sep 30, 2018 at 8:33 AM, Colin <col...@gm...<mailto:col...@gm...>> wrote: I think there is nothing inherently wrong with the attribute name"snp.effect" You might try console.log the output of feature.get('snv.effect') and see if it helps clarify anything but in my test it seems that it is fine for an attribute to have this in column 9 of a gff (both gff3tabix and flatfile-to-json) Note that sometimes the color callback is called in children or parent features and then you might have to use feature.parent() or feature.children() and iterate over these -Colin On Fri, Sep 28, 2018 at 6:55 PM Sofia Robb <so...@so...<mailto:so...@so...>> wrote: Hello All, I am trying to write a function to color my glyph based on a value from one of my 9th column attributes. I can't figure out how to retrieve it. All my glyphs are blue with this "color" : "function(feature) {return feature.get('snv.effect')=='strong' ? 'green' : 'blue'}" but if i change it to Source it works. "color" : "function(feature) {return feature.get('Source')=='strong' ? 'green' : 'blue'}" Thanks! Sofia _______________________________________________ Gmod-ajax mailing list Gmo...@li...<mailto:Gmo...@li...> https://lists.sourceforge.net/lists/listinfo/gmod-ajax |