+ public static int getSourceKey(String name) {
+ for (int i = 0; i < MASK_COUNT; i++) {
+ if (name.equals(allSources[i]))
+ {
+ return 1<<i;
+ }
+ }
+ return 0;
+ }
+
+ public static final int PRIMARY_MASK = UNIPROT_MASK | ENSEMBL_MASK;
+
+ /**
+ * List of databases whose sequences might have coding regions annotated
+ */
+ public static final String[] DNACODINGDBS = {
+ ENSEMBL, ENSEMBLGENOMES,
+ EMBL, EMBLCDS, GENEDB
+ };
+
+ public static final int DNA_CODING_MASK =
+ ENSEMBL_MASK | ENSEMBL_GENOMES_MASK
+ | EMBL_MASK | EMBL_CDS_MASK | GENE_DB_MASK;
+
+
+
+ public static final String[] CODINGDBS = { EMBLCDS, GENEDB, ENSEMBL };
+
+ public static final int CODING_MASK = EMBL_CDS_MASK | GENE_DB_MASK | ENSEMBL_MASK;
+
+
+
+ public static final String[] PROTEINDBS = {
+ UNIPROT, UNIPROTKB,
+ ENSEMBL, EMBLCDSProduct }; // Ensembl ENSP* entries are protein
+
+ public static final int PROTEIN_MASK =
+ UNIPROT_MASK | UNIPROT_KB_MASK
+ | ENSEMBL_MASK | EMBL_CDS_PRODUCT_MASK ;
+
+
+ // for SequenceAnnotationReport only
+
+// public static final String[][] PRIMARY_SOURCES = new String[][] {
+// CODINGDBS, DNACODINGDBS, PROTEINDBS };
+//
+ public static final int PRIMARY_SOURCES_MASK = CODING_MASK | DNA_CODING_MASK | PROTEIN_MASK;
+
+ public static boolean isPrimarySource(String source)
+ {
+ return ((PRIMARY_SOURCES_MASK & getSourceKey(source)) != 0);
+ }
+
+ public static boolean isPrimaryCandidate(String ucversion) {
+ // tricky - this test really needs to search the sequence's set of dbrefs to
+ // see if there is a primary reference that derived this reference.
+ for (int i = allSources.length; --i >= 0;)
+ {
+ if (ucversion.startsWith(allSources[i])) // BH 2019.01.25 .toUpperCase() unnecessary here for allSources
+ {
+ // by convention, many secondary references inherit the primary
+ // reference's
+ // source string as a prefix for any version information from the
+ // secondary reference.
+ return false;
+ }
+ }
+ return true;
+}