Newer
Older
* the attribute has no value then the Hashtable value will be a zero
* length vector.
private Hashtable<String, StringVector> parseAttributes(
final String att_val_list) {
final Hashtable<String, StringVector> attr = new Hashtable<String, StringVector>();
while ((ind_end = att_val_list.indexOf(";", ind_start)) > -1
|| ind_start < att_val_list.length()) {
if (ind_end < 0)
final String this_token = GFF3Encoder.decode(att_val_list.substring(ind_start,
ind_end).trim());
ind_start = ind_end + 1;
int index_of_first_space = this_token.indexOf(" ");
StringVector att_values = new StringVector();
if (this_token.indexOf("=") > -1
&& (this_token.indexOf("=") < index_of_first_space || index_of_first_space == -1)) {
index_of_first_space = this_token.indexOf("=");
att_name = this_token.substring(0, index_of_first_space);
att_values.add(this_token.substring(index_of_first_space + 1).trim());
} else if (index_of_first_space == -1)
att_name = this_token.substring(0, index_of_first_space);
String rest_of_token = this_token.substring(index_of_first_space + 1)
.trim();
while (rest_of_token.length() > 0) {
if (rest_of_token.startsWith("\"")) {
quote_index = rest_of_token.indexOf("\"", quote_index);
} while (quote_index > -1
&& rest_of_token.charAt(quote_index - 1) == '\\');
final Hashtable<String, StringVector> panic_attributes = new Hashtable<String, StringVector>();
final StringVector notes = new StringVector();
notes.add(att_val_list);
panic_attributes.put("note", notes);
final String next_bit = rest_of_token.substring(1, quote_index);
att_values.add(next_bit);
rest_of_token = rest_of_token.substring(quote_index + 1).trim();
final int index_of_next_space = rest_of_token.indexOf(" ");
} else {
final String next_bit = rest_of_token.substring(0,
index_of_next_space);
rest_of_token = rest_of_token.substring(index_of_next_space)
.trim();
if (att_name.equals("Dbxref") || att_name.equals("Alias")) // convert to
// multi-line
StringTokenizer stok = new StringTokenizer((String) att_values.get(0),
",");
StringVector str_values = new StringVector();
str_values.add(stok.nextToken());
att_values = str_values;
}
if (att_name.equals("timelastmodified")) {
try {
this.timelastmodified = new Timestamp(
Long.parseLong((String) att_values.get(0)));
SimpleDateFormat date_format = new SimpleDateFormat(
"dd.MM.yyyy hh:mm:ss z");
att_values.set(0, date_format.format(timelastmodified));
} catch (NumberFormatException e) {
att_values.set(0, (String) att_values.get(0));
/**
* Get the feature time last modified timestamp.
return timelastmodified;
}
/**
* Get the GFF_source value of a Dbxref qualifier.
private String getDbxrefGFFSource(final Qualifier qualifier) {
StringVector qualifier_strings = StreamQualifier.toStringVector(null,
qualifier);
for (int i = 0; i < qualifier_strings.size(); i++) {
String qualifier_string = (String) qualifier_strings.elementAt(i);
if (qualifier_string.indexOf("GFF_source:") > -1) {
int index = qualifier_string.indexOf(":") + 1;
len--;
return qualifier_string.substring(index, len);
}
}
return null;
}
/**
* Set the feature time last modified timestamp.
* @param timelastmodified
*/
public void setLastModified(final Timestamp timelastmodified) {
this.timelastmodified = timelastmodified;
// now update the qualifier value itself
QualifierVector qualifiers = getQualifiers();
Qualifier qualifier = qualifiers.getQualifierByName("timelastmodified");
SimpleDateFormat date_format = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss z");
if (qualifier != null)
qualifier.removeValue((String) qualifier.getValues().get(0));
else {
try {
qualifier = new Qualifier("timelastmodified",
} catch (EntryInformationException eie) {
} catch (ReadOnlyException roe) {
qualifier.addValue(date_format.format(timelastmodified));
}
* Returns true if and only if this Feature can't be changed or can't be
* removed from it's entry.
public boolean isReadOnly() {
if (readOnlyFeature)
return true;
return super.isReadOnly();
}
public void setReadOnlyFeature(boolean readOnlyFeature) {
this.readOnlyFeature = readOnlyFeature;
}
public void setChadoGene(ChadoCanonicalGene chadoGene) {
return gffSeqName;
}
public void setGffSeqName(String gffSeqName) {
this.gffSeqName = gffSeqName;
}
return gffSource;
}
public void setGffSource(String gffSource) {
this.gffSource = gffSource;
}
public void setLazyLoaded(boolean lazyLoaded) {
public org.gmod.schema.sequence.Feature getChadoLazyFeature() {
return chadoLazyFeature;
}
public void setChadoLazyFeature(
org.gmod.schema.sequence.Feature chadoLazyFeature) {
protected static boolean isGTF(Feature feature) {
if (!(feature instanceof GFFStreamFeature))
final String names[] = { "ID", "Name", "Alias", "Parent", "Derives_from",
"Target", "Gap", "Note", "Dbxref", "Ontology_term" };
for (String name : names) {
if (feature.getQualifiers().getQualifierByName(name) != null)
if (feature.getQualifiers().getQualifierByName("gene_id") != null
&& feature.getQualifiers().getQualifierByName("transcript_id") != null) {
if (feature.getEntry() != null)
logger4j.debug(feature.getEntry().getName() + " is in GTF format");