From 2d01f94ddb6c8e7cfe439cec9b734942c63dabd3 Mon Sep 17 00:00:00 2001 From: Frank Austin Nothaft Date: Wed, 24 May 2017 01:27:33 -0700 Subject: [PATCH] [ADAM-941] Automatically generate projection enums. Resolves #941. --- .../adam/codegen/DumpSchemasToProduct.scala | 13 +-- .../DumpSchemasToProjectionEnums.scala | 110 ++++++++++++++++++ .../adam/codegen/ReflectSchema.scala | 20 ++-- adam-core/pom.xml | 32 +++++ .../projections/AlignmentRecordField.scala | 28 ----- .../adam/projections/ContigField.scala | 28 ----- .../adam/projections/DbxrefField.scala | 28 ----- .../adam/projections/FeatureField.scala | 28 ----- .../adam/projections/GenotypeField.scala | 28 ----- .../NucleotideContigFragmentField.scala | 28 ----- .../adam/projections/OntologyTermField.scala | 28 ----- .../adam/projections/ReadField.scala | 28 ----- .../RecordGroupMetadataField.scala | 28 ----- .../adam/projections/SampleField.scala | 28 ----- .../adam/projections/SequenceField.scala | 28 ----- .../adam/projections/SliceField.scala | 28 ----- .../projections/TranscriptEffectField.scala | 28 ----- .../projections/VariantAnnotationField.scala | 28 ----- .../VariantCallingAnnotationsField.scala | 28 ----- .../adam/projections/VariantField.scala | 28 ----- .../AlignmentRecordFieldSuite.scala | 1 - .../VariantCallingAnnotationsFieldSuite.scala | 2 +- 22 files changed, 157 insertions(+), 469 deletions(-) create mode 100644 adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/DumpSchemasToProjectionEnums.scala rename adam-core/src/main/scala/org/bdgenomics/adam/projections/FragmentField.scala => adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/ReflectSchema.scala (64%) delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/AlignmentRecordField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/ContigField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/DbxrefField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/FeatureField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/GenotypeField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/NucleotideContigFragmentField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/OntologyTermField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/ReadField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/RecordGroupMetadataField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/SampleField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/SequenceField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/SliceField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/TranscriptEffectField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantAnnotationField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantCallingAnnotationsField.scala delete mode 100644 adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantField.scala diff --git a/adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/DumpSchemasToProduct.scala b/adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/DumpSchemasToProduct.scala index b15bf3d0ff..91b615a0e9 100644 --- a/adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/DumpSchemasToProduct.scala +++ b/adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/DumpSchemasToProduct.scala @@ -19,7 +19,6 @@ package org.bdgenomics.adam.codegen import java.io.{ File, FileWriter } import org.apache.avro.Schema -import org.apache.avro.reflect.ReflectData import scala.collection.JavaConversions._ object DumpSchemasToProduct { @@ -31,16 +30,6 @@ object DumpSchemasToProduct { class DumpSchemasToProduct { - private def getSchemaByReflection(className: String): Schema = { - - // load the class - val classLoader = Thread.currentThread().getContextClassLoader() - val klazz = classLoader.loadClass(className) - - // get the schema through reflection - ReflectData.get().getSchema(klazz) - } - private def toMatch(fields: Seq[(String, String)]): String = { fields.map(_._1) .zipWithIndex @@ -145,7 +134,7 @@ class DumpSchemasToProduct { private def generateClassDump(className: String): String = { // get schema - val schema = getSchemaByReflection(className) + val schema = ReflectSchema.getSchemaByReflection(className) // get class name without package val classNameNoPackage = className.split('.').last diff --git a/adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/DumpSchemasToProjectionEnums.scala b/adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/DumpSchemasToProjectionEnums.scala new file mode 100644 index 0000000000..1402731259 --- /dev/null +++ b/adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/DumpSchemasToProjectionEnums.scala @@ -0,0 +1,110 @@ +/** + * Licensed to Big Data Genomics (BDG) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The BDG licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.bdgenomics.adam.codegen + +import java.io.{ File, FileWriter } +import org.apache.avro.Schema +import org.apache.avro.reflect.ReflectData +import scala.collection.JavaConversions._ + +object DumpSchemasToProjectionEnums { + + def main(args: Array[String]) { + new DumpSchemasToProjectionEnums()(args) + } +} + +class DumpSchemasToProjectionEnums { + + private def fields(schema: Schema): Seq[String] = { + schema.getFields() + .map(field => field.name) + .toSeq + } + + private def generateClassDump(className: String): String = { + + // get schema + val schema = ReflectSchema.getSchemaByReflection(className) + + // get class name without package + val classNameNoPackage = className.split('.').last + + "\n\nobject %sField extends FieldEnumeration(%s.SCHEMA$) {\n val %s = SchemaValue\n}".format( + classNameNoPackage, + className, + fields(schema).mkString(", ")) + } + + private def writeHeader(fw: FileWriter, packageName: String) { + val hdr = Seq( + "/**", + "* Licensed to Big Data Genomics (BDG) under one", + "* or more contributor license agreements. See the NOTICE file", + "* distributed with this work for additional information", + "* regarding copyright ownership. The BDG licenses this file", + "* to you under the Apache License, Version 2.0 (the", + "* \"License\"); you may not use this file except in compliance", + "* with the License. You may obtain a copy of the License at", + "*", + "* http://www.apache.org/licenses/LICENSE-2.0", + "*", + "* Unless required by applicable law or agreed to in writing, software", + "* distributed under the License is distributed on an \"AS IS\" BASIS,", + "* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "* See the License for the specific language governing permissions and", + "* limitations under the License.", + "*/", + "package %s".format(packageName)).mkString("\n") + + fw.write(hdr) + } + + def apply(args: Array[String]) { + + if (args.length < 3) { + println("DumpSchemasToProjectionEnums ... ") + System.exit(1) + } else { + + // drop the file to write and the package name + val classesToDump = args.drop(1).dropRight(1) + + // open the file to write + val dir = new File(args.last).getParentFile + if (!dir.exists()) { + dir.mkdirs() + } + val fw = new FileWriter(args.last) + + // write the header + writeHeader(fw, args.head) + + // loop and dump the classes + classesToDump.foreach(className => { + val dumpString = generateClassDump(className) + + fw.write("\n") + fw.write(dumpString) + }) + + // we are done, so close and flush + fw.close() + } + } +} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/FragmentField.scala b/adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/ReflectSchema.scala similarity index 64% rename from adam-core/src/main/scala/org/bdgenomics/adam/projections/FragmentField.scala rename to adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/ReflectSchema.scala index 4f56171ec0..c63b676396 100644 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/FragmentField.scala +++ b/adam-codegen/src/main/scala/org/bdgenomics/adam/codegen/ReflectSchema.scala @@ -15,14 +15,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.bdgenomics.adam.projections +package org.bdgenomics.adam.codegen -import org.bdgenomics.formats.avro.Fragment +import org.apache.avro.reflect.ReflectData +import org.apache.avro.Schema -/** - * Enumeration of Fragment field names for predicates and projections. - */ -object FragmentField extends FieldEnumeration(Fragment.SCHEMA$) { +object ReflectSchema { + + private[codegen] def getSchemaByReflection(className: String): Schema = { + + // load the class + val classLoader = Thread.currentThread().getContextClassLoader() + val klazz = classLoader.loadClass(className) - val readName, instrument, runId, fragmentSize, alignments = SchemaValue + // get the schema through reflection + ReflectData.get().getSchema(klazz) + } } diff --git a/adam-core/pom.xml b/adam-core/pom.xml index ee4dfd0206..f51aa57ec1 100644 --- a/adam-core/pom.xml +++ b/adam-core/pom.xml @@ -118,6 +118,38 @@ compile + + generate-scala-projection-fields + generate-sources + + java + + + org.bdgenomics.adam.codegen.DumpSchemasToProjectionEnums + + org.bdgenomics.adam.projections + org.bdgenomics.formats.avro.AlignmentRecord + org.bdgenomics.formats.avro.Contig + org.bdgenomics.formats.avro.Dbxref + org.bdgenomics.formats.avro.Feature + org.bdgenomics.formats.avro.Fragment + org.bdgenomics.formats.avro.Genotype + org.bdgenomics.formats.avro.NucleotideContigFragment + org.bdgenomics.formats.avro.OntologyTerm + org.bdgenomics.formats.avro.Read + org.bdgenomics.formats.avro.RecordGroup + org.bdgenomics.formats.avro.Sample + org.bdgenomics.formats.avro.Sequence + org.bdgenomics.formats.avro.Slice + org.bdgenomics.formats.avro.TranscriptEffect + org.bdgenomics.formats.avro.Variant + org.bdgenomics.formats.avro.VariantAnnotation + org.bdgenomics.formats.avro.VariantCallingAnnotations + adam-core/target/generated-sources/src/main/scala/org/bdgenomics/adam/projections/Enums.scala + + compile + + diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/AlignmentRecordField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/AlignmentRecordField.scala deleted file mode 100644 index cf1c3ed3e3..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/AlignmentRecordField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.AlignmentRecord - -/** - * Enumeration of AlignmentRecord field names for predicates and projections. - */ -object AlignmentRecordField extends FieldEnumeration(AlignmentRecord.SCHEMA$) { - - val readInFragment, contigName, start, oldPosition, end, mapq, readName, sequence, qual, cigar, oldCigar, basesTrimmedFromStart, basesTrimmedFromEnd, readPaired, properPair, readMapped, mateMapped, failedVendorQualityChecks, duplicateRead, readNegativeStrand, mateNegativeStrand, primaryAlignment, secondaryAlignment, supplementaryAlignment, mismatchingPositions, origQual, attributes, recordGroupName, recordGroupSample, mateAlignmentStart, mateAlignmentEnd, mateContigName, inferredInsertSize = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/ContigField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/ContigField.scala deleted file mode 100644 index 52bf0bd783..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/ContigField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.Contig - -/** - * Enumeration of Contig field names for predicates and projections. - */ -object ContigField extends FieldEnumeration(Contig.SCHEMA$) { - - val contigName, contigLength, contigMD5, referenceURL, assembly, species, referenceIndex = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/DbxrefField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/DbxrefField.scala deleted file mode 100644 index 11ef2876d5..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/DbxrefField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.Dbxref - -/** - * Enumeration of Dbxref field names for predicates and projections. - */ -object DbxrefField extends FieldEnumeration(Dbxref.SCHEMA$) { - - val db, accession = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/FeatureField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/FeatureField.scala deleted file mode 100644 index 297a2e51e7..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/FeatureField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.Feature - -/** - * Enumeration of Feature field names for predicates and projections. - */ -object FeatureField extends FieldEnumeration(Feature.SCHEMA$) { - - val featureId, name, source, featureType, contigName, start, end, strand, phase, frame, score, geneId, transcriptId, exonId, aliases, parentIds, target, gap, derivesFrom, notes, dbxrefs, ontologyTerms, circular, attributes = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/GenotypeField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/GenotypeField.scala deleted file mode 100644 index ee58581998..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/GenotypeField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.Genotype - -/** - * Enumeration of Genotype field names for predicates and projections. - */ -object GenotypeField extends FieldEnumeration(Genotype.SCHEMA$) { - - val variant, contigName, start, end, variantCallingAnnotations, sampleId, sampleDescription, processingDescription, alleles, expectedAlleleDosage, referenceReadDepth, alternateReadDepth, readDepth, minReadDepth, genotypeQuality, genotypeLikelihoods, nonReferenceLikelihoods, strandBiasComponents, splitFromMultiAllelic, phased, phaseSetId, phaseQuality = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/NucleotideContigFragmentField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/NucleotideContigFragmentField.scala deleted file mode 100644 index 4c2ede5d5e..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/NucleotideContigFragmentField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.NucleotideContigFragment - -/** - * Enumeration of NucleotideContigFragment field names for predicates and projections. - */ -object NucleotideContigFragmentField extends FieldEnumeration(NucleotideContigFragment.SCHEMA$) { - - val contigName, contigLength, description, sequence, index, start, end, length, fragments = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/OntologyTermField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/OntologyTermField.scala deleted file mode 100644 index afd045b3fc..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/OntologyTermField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.OntologyTerm - -/** - * Enumeration of OntologyTerm field names for predicates and projections. - */ -object OntologyTermField extends FieldEnumeration(OntologyTerm.SCHEMA$) { - - val db, accession = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/ReadField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/ReadField.scala deleted file mode 100644 index 02cb4db01a..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/ReadField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.Read - -/** - * Enumeration of Read field names for predicates and projections. - */ -object ReadField extends FieldEnumeration(Read.SCHEMA$) { - - val name, description, alphabet, sequence, length, qualityScores, qualityScoreVariant = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/RecordGroupMetadataField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/RecordGroupMetadataField.scala deleted file mode 100644 index 9fde163091..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/RecordGroupMetadataField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.RecordGroup - -/** - * Enumeration of RecordGroup field names for predicates and projections. - */ -object RecordGroupField extends FieldEnumeration(RecordGroup.SCHEMA$) { - - val name, sample, sequencingCenter, description, runDateEpoch, flowOrder, keySequence, library, predictedMedianInsertSize, platform, platformUnit = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/SampleField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/SampleField.scala deleted file mode 100644 index beda5ccaa9..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/SampleField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.Sample - -/** - * Enumeration of Sample field names for predicates and projections. - */ -object SampleField extends FieldEnumeration(Sample.SCHEMA$) { - - val sampleId, name, attributes = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/SequenceField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/SequenceField.scala deleted file mode 100644 index ad46d8e250..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/SequenceField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.Sequence - -/** - * Enumeration of Sequence field names for predicates and projections. - */ -object SequenceField extends FieldEnumeration(Sequence.SCHEMA$) { - - val name, description, alphabet, sequence, length = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/SliceField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/SliceField.scala deleted file mode 100644 index 14d248be5a..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/SliceField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.Slice - -/** - * Enumeration of Slice field names for predicates and projections. - */ -object SliceField extends FieldEnumeration(Slice.SCHEMA$) { - - val name, description, alphabet, sequence, start, end, strand, length = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/TranscriptEffectField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/TranscriptEffectField.scala deleted file mode 100644 index 646aa8661b..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/TranscriptEffectField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.TranscriptEffect - -/** - * Enumeration of TranscriptEffect field names for predicates and projections. - */ -object TranscriptEffectField extends FieldEnumeration(TranscriptEffect.SCHEMA$) { - - val alternateAllele, effects, geneName, geneId, featureType, featureId, biotype, rank, total, genomicHgvs, transcriptHgvs, proteinHgvs, cdnaPosition, cdnaLength, cdsPosition, cdsLength, proteinPosition, proteinLength, distance, messages = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantAnnotationField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantAnnotationField.scala deleted file mode 100644 index 18285c361a..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantAnnotationField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.VariantAnnotation - -/** - * Enumeration of VariantAnnotation field names for predicates and projections. - */ -object VariantAnnotationField extends FieldEnumeration(VariantAnnotation.SCHEMA$) { - - val ancestralAllele, alleleCount, readDepth, forwardReadDepth, reverseReadDepth, referenceReadDepth, referenceForwardReadDepth, referenceReverseReadDepth, alleleFrequency, cigar, dbSnp, hapMap2, hapMap3, validated, thousandGenomes, somatic, transcriptEffects, attributes = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantCallingAnnotationsField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantCallingAnnotationsField.scala deleted file mode 100644 index 5728a43aa7..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantCallingAnnotationsField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.VariantCallingAnnotations - -/** - * Enumeration of VariantCallingAnnotations field names for predicates and projections. - */ -object VariantCallingAnnotationsField extends FieldEnumeration(VariantCallingAnnotations.SCHEMA$) { - - val variantFilters, downsampled, baseQRankSum, fisherStrandBiasPValue, rmsMapQ, mapq0Reads, mqRankSum, readPositionRankSum, genotypePriors, vqslod, culprit, attributes = SchemaValue -} diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantField.scala b/adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantField.scala deleted file mode 100644 index e3e4f0d6ec..0000000000 --- a/adam-core/src/main/scala/org/bdgenomics/adam/projections/VariantField.scala +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to Big Data Genomics (BDG) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The BDG licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.bdgenomics.adam.projections - -import org.bdgenomics.formats.avro.Variant - -/** - * Enumeration of Variant field names for predicates and projections. - */ -object VariantField extends FieldEnumeration(Variant.SCHEMA$) { - - val contigName, start, end, names, referenceAllele, alternateAllele, filtersApplied, filtersPassed, filtersFailed = SchemaValue -} diff --git a/adam-core/src/test/scala/org/bdgenomics/adam/projections/AlignmentRecordFieldSuite.scala b/adam-core/src/test/scala/org/bdgenomics/adam/projections/AlignmentRecordFieldSuite.scala index 7f3b86197b..05a7b2d6ae 100644 --- a/adam-core/src/test/scala/org/bdgenomics/adam/projections/AlignmentRecordFieldSuite.scala +++ b/adam-core/src/test/scala/org/bdgenomics/adam/projections/AlignmentRecordFieldSuite.scala @@ -65,7 +65,6 @@ class AlignmentRecordFieldSuite extends ADAMFunSuite { recordGroupName, recordGroupSample, mateAlignmentStart, - mateAlignmentEnd, mateContigName, inferredInsertSize ) diff --git a/adam-core/src/test/scala/org/bdgenomics/adam/projections/VariantCallingAnnotationsFieldSuite.scala b/adam-core/src/test/scala/org/bdgenomics/adam/projections/VariantCallingAnnotationsFieldSuite.scala index 9490ffa0eb..b6fba0b46c 100644 --- a/adam-core/src/test/scala/org/bdgenomics/adam/projections/VariantCallingAnnotationsFieldSuite.scala +++ b/adam-core/src/test/scala/org/bdgenomics/adam/projections/VariantCallingAnnotationsFieldSuite.scala @@ -35,7 +35,7 @@ class VariantCallingAnnotationsFieldSuite extends ADAMFunSuite { rdd.saveAsParquet(TestSaveArgs(path)) val projection = Projection( - variantFilters, + filtersApplied, downsampled, baseQRankSum, fisherStrandBiasPValue,