git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
ac599db
)
JAL-653 refactor / tidy
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Thu, 21 Jan 2016 15:58:15 +0000
(15:58 +0000)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Thu, 21 Jan 2016 15:58:15 +0000
(15:58 +0000)
src/jalview/io/gff/Gff3Helper.java
patch
|
blob
|
history
diff --git
a/src/jalview/io/gff/Gff3Helper.java
b/src/jalview/io/gff/Gff3Helper.java
index
4c67caa
..
55a0f9a
100644
(file)
--- a/
src/jalview/io/gff/Gff3Helper.java
+++ b/
src/jalview/io/gff/Gff3Helper.java
@@
-61,19
+61,6
@@
public class Gff3Helper extends GffHelperBase
AlignmentI align, List<SequenceI> newseqs,
boolean relaxedIdMatching) throws IOException
{
AlignmentI align, List<SequenceI> newseqs,
boolean relaxedIdMatching) throws IOException
{
- /*
- * (For now) we don't process mappings from reverse complement ; to do
- * this would require (a) creating a virtual sequence placeholder for
- * the reverse complement (b) resolving the sequence by its id from some
- * source (GFF ##FASTA or other) (c) creating the reverse complement
- * sequence (d) updating the mapping to be to the reverse complement
- */
- if ("-".equals(gff[STRAND_COL]))
- {
- System.err
- .println("Skipping mapping from reverse complement as not yet supported");
- return null;
- }
SequenceFeature sf = null;
if (gff.length == 9)
SequenceFeature sf = null;
if (gff.length == 9)
@@
-135,10
+122,18
@@
public class Gff3Helper extends GffHelperBase
throws IOException
{
String strand = gffColumns[STRAND_COL];
throws IOException
{
String strand = gffColumns[STRAND_COL];
- if ("-1".equals(strand))
+
+ /*
+ * (For now) we don't process mappings from reverse complement ; to do
+ * this would require (a) creating a virtual sequence placeholder for
+ * the reverse complement (b) resolving the sequence by its id from some
+ * source (GFF ##FASTA or other) (c) creating the reverse complement
+ * sequence (d) updating the mapping to be to the reverse complement
+ */
+ if ("-".equals(strand))
{
System.err
{
System.err
- .println("Currently ignoring mappings from reverse complement");
+ .println("Skipping mapping from reverse complement as not yet supported");
return null;
}
return null;
}
@@
-351,11
+346,43
@@
public class Gff3Helper extends GffHelperBase
Map<String, List<String>> attributes)
{
SequenceFeature sf = super.buildSequenceFeature(gff, attributes);
Map<String, List<String>> attributes)
{
SequenceFeature sf = super.buildSequenceFeature(gff, attributes);
+ String desc = getDescription(sf, attributes);
+ if (desc != null)
+ {
+ sf.setDescription(desc);
+ }
+ return sf;
+ }
+
+ /**
+ * Apply heuristic rules to try to get the most useful feature description
+ *
+ * @param sf
+ * @param attributes
+ * @return
+ */
+ protected String getDescription(SequenceFeature sf,
+ Map<String, List<String>> attributes)
+ {
+ String desc = null;
String target = (String) sf.getValue(TARGET);
if (target != null)
{
String target = (String) sf.getValue(TARGET);
if (target != null)
{
- sf.setDescription(target.split(" ")[0]);
+ desc = target.split(" ")[0];
}
}
- return sf;
+
+ if (SequenceOntology.getInstance().isSequenceVariant(sf.getType()))
+ {
+ /*
+ * Ensembl returns alleles and consequence_type (amongst other details)
+ */
+ String alleles = StringUtils.listToDelimitedString(
+ attributes.get("alleles"), ",");
+ String consequence = StringUtils.listToDelimitedString(
+ attributes.get("consequence_type"), ",");
+ desc = String.format("alleles %s; consequence %s", alleles,
+ consequence);
+ }
+ return desc;
}
}
}
}