Skip to content

Commit

Permalink
Set type attribute to value of type column if not genetic_marker.
Browse files Browse the repository at this point in the history
  • Loading branch information
sammyjava committed Oct 13, 2022
1 parent a45e394 commit 62f1ea2
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
/**
* Loads data from an LIS genetic marker GFF3 file.
*
* All features will be loaded as GeneticMarker. GeneticMarker.type will be set to the value in the GFF
* type column (e.g. SNP), and, if the marker is a single base it will be forced to type=SNP.
*
* @author Sam Hokin
*/
public class MarkerGFF3FileConverter extends DatastoreFileConverter {
Expand Down Expand Up @@ -167,13 +170,20 @@ void processMarkerGFF3File() throws IOException {
if (id==null) {
throw new RuntimeException("GFF line does not include ID: "+featureI.toString());
}
if (!type.equals("genetic_marker")) continue;
// the following presumes that the README has already been read, which should be the case since capital R comes before lower case
if (!matchesStrainAndAssembly(id)) {
throw new RuntimeException("ID "+id+" does not match strain.assembly from collection "+readme.identifier);
}
// GeneticMarker
Item geneticMarker = getGeneticMarker(id, location, seqname);
// type
if (type.equals("genetic_marker")) {
// auto-set type to SNP if one base
if (location.length()==1) geneticMarker.setAttribute("type", "SNP");
} else {
// use the value in the type column
geneticMarker.setAttribute("type", type);
}
// name
if (name!=null) geneticMarker.setAttribute("name", name);
// symbol
Expand All @@ -186,8 +196,6 @@ void processMarkerGFF3File() throws IOException {
if (alleles!=null) geneticMarker.setAttribute("alleles", alleles);
// motif
if (motif!=null) geneticMarker.setAttribute("motif", motif);
// GeneticMarker gets type=SNP if length==1 as well as alleles
if (location.length()==1) geneticMarker.setAttribute("type", "SNP");
}
}

Expand Down

0 comments on commit 62f1ea2

Please sign in to comment.