extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/BiomaterialList.java

Code
Comments
Other
Rev Date Author Line
1803 18 Jan 13 nicklas 1 package net.sf.basedb.reggie.dao;
1803 18 Jan 13 nicklas 2
1803 18 Jan 13 nicklas 3 import java.lang.reflect.Field;
1803 18 Jan 13 nicklas 4 import java.util.List;
1803 18 Jan 13 nicklas 5
3247 14 Apr 15 nicklas 6 import net.sf.basedb.core.ItemList;
1803 18 Jan 13 nicklas 7 import net.sf.basedb.core.DbControl;
1803 18 Jan 13 nicklas 8 import net.sf.basedb.core.Include;
1803 18 Jan 13 nicklas 9 import net.sf.basedb.core.InvalidDataException;
1803 18 Jan 13 nicklas 10 import net.sf.basedb.core.Item;
1803 18 Jan 13 nicklas 11 import net.sf.basedb.core.ItemNotFoundException;
1803 18 Jan 13 nicklas 12 import net.sf.basedb.core.ItemQuery;
1803 18 Jan 13 nicklas 13 import net.sf.basedb.core.Type;
1803 18 Jan 13 nicklas 14 import net.sf.basedb.core.query.Expressions;
1803 18 Jan 13 nicklas 15 import net.sf.basedb.core.query.Hql;
1803 18 Jan 13 nicklas 16 import net.sf.basedb.core.query.Restrictions;
1803 18 Jan 13 nicklas 17
1803 18 Jan 13 nicklas 18 /**
1803 18 Jan 13 nicklas 19   Used to define special biomaterial lists.
1803 18 Jan 13 nicklas 20   
1803 18 Jan 13 nicklas 21   @author nicklas
1867 19 Feb 13 nicklas 22   @since 2.12
1803 18 Jan 13 nicklas 23 */
1803 18 Jan 13 nicklas 24 public class BiomaterialList 
1803 18 Jan 13 nicklas 25 {
1803 18 Jan 13 nicklas 26
1803 18 Jan 13 nicklas 27   /**
1803 18 Jan 13 nicklas 28     The definition of the biomaterial list used for storing RNA items that have been 
1803 18 Jan 13 nicklas 29     flagged by the RNA -> mRNA auto-select wizard.
1803 18 Jan 13 nicklas 30   */
1803 18 Jan 13 nicklas 31   public static final BiomaterialList FLAGGED_RNA = 
3659 09 Dec 15 nicklas 32     new BiomaterialList("Flagged RNA", "net.sf.basedb.reggie.rna.flagged", Item.EXTRACT, Subtype.RNA,
1803 18 Jan 13 nicklas 33       "This list contains RNA items that doesn't meet the criterias set by the " +
1803 18 Jan 13 nicklas 34       "auto-select wizard for further processing to mRNA. The most typical reason is " +
1803 18 Jan 13 nicklas 35       "that not enough RNA is available.");
1803 18 Jan 13 nicklas 36
2077 17 Oct 13 nicklas 37   /**
5357 12 Apr 19 nicklas 38     The definition of the biomaterial list used for storing DNA items that have been 
5357 12 Apr 19 nicklas 39     flagged during DNA processing.
5357 12 Apr 19 nicklas 40     @since 4.23
5357 12 Apr 19 nicklas 41   */
5357 12 Apr 19 nicklas 42   public static final BiomaterialList FLAGGED_DNA = 
5357 12 Apr 19 nicklas 43     new BiomaterialList("Flagged DNA", "net.sf.basedb.reggie.dna.flagged", Item.EXTRACT, Subtype.DNA,
5357 12 Apr 19 nicklas 44       "This list contains DNA items that could not be succesfully processed in the way it was "+
5357 12 Apr 19 nicklas 45       "originally intended.");
5357 12 Apr 19 nicklas 46
5357 12 Apr 19 nicklas 47   
5357 12 Apr 19 nicklas 48   /**
2077 17 Oct 13 nicklas 49     The definition of the biomaterial list used for storing Pooled libraries that have been 
2077 17 Oct 13 nicklas 50     flagged due to failure to sequence the entire pool.
2077 17 Oct 13 nicklas 51     @since 2.13
2077 17 Oct 13 nicklas 52   */
2077 17 Oct 13 nicklas 53   public static final BiomaterialList FLAGGED_POOL = 
3659 09 Dec 15 nicklas 54     new BiomaterialList("Flagged PooledLibrary", "net.sf.basedb.reggie.pool.flagged", Item.EXTRACT, Subtype.POOLED_LIBRARY,
2077 17 Oct 13 nicklas 55       "This list contains PooledLibrary items that have failed to be sequenced. Typically most pools "
2077 17 Oct 13 nicklas 56       + "should have enough biomaterial left for trying again, otherwise a new pool may need to be "
2077 17 Oct 13 nicklas 57       + "created from libraries or RNA.");
1803 18 Jan 13 nicklas 58
2242 21 Feb 14 nicklas 59   /**
2242 21 Feb 14 nicklas 60     The definition of the biomaterial list used for storing Histology items that have been 
2242 21 Feb 14 nicklas 61     flagged due to failure to create a stained sample.
2242 21 Feb 14 nicklas 62     @since 2.15
2242 21 Feb 14 nicklas 63   */
2242 21 Feb 14 nicklas 64   public static final BiomaterialList FLAGGED_HISTOLOGY = 
3659 09 Dec 15 nicklas 65     new BiomaterialList("Flagged Histology", "net.sf.basedb.reggie.histology.flagged", Item.SAMPLE, Subtype.HISTOLOGY,
2242 21 Feb 14 nicklas 66       "This list contains Histology items that have failed to be stained. If possible a new "
2242 21 Feb 14 nicklas 67       + "HE glass may be created from the block, otherwise a new histology piece may be needed from "
2242 21 Feb 14 nicklas 68       + "the frozen backup");
3162 04 Mar 15 nicklas 69   
3162 04 Mar 15 nicklas 70   /**
3162 04 Mar 15 nicklas 71     The definition of the biomaterial list used for storing Specimen items 
3162 04 Mar 15 nicklas 72     that have failed to be sequenced and that we can't re-process any more
3162 04 Mar 15 nicklas 73     with the current technology.
3162 04 Mar 15 nicklas 74     @since 3.2
3162 04 Mar 15 nicklas 75   */
3162 04 Mar 15 nicklas 76   public static final BiomaterialList FLAGGED_SPECIMEN = 
3659 09 Dec 15 nicklas 77     new BiomaterialList("Flagged Specimen", "net.sf.basedb.reggie.specimen.flagged", Item.SAMPLE, Subtype.SPECIMEN,
3162 04 Mar 15 nicklas 78       "This list contains Specimen items that have failed to be sequenced and there is not "
3162 04 Mar 15 nicklas 79       + "enough remaining backup to be able to re-process them with the current technology.");
2077 17 Oct 13 nicklas 80
1803 18 Jan 13 nicklas 81   /**
7164 12 May 23 nicklas 82     The definition of the biomaterial list used for storing Specimen items 
7164 12 May 23 nicklas 83     that has been processed externally and where we have recieved the specimen
7164 12 May 23 nicklas 84     (and child Lysate/RNA/DNA/FT) but not any data from the extration or 
7164 12 May 23 nicklas 85     sequencing.
7164 12 May 23 nicklas 86     @since 4.47
7164 12 May 23 nicklas 87   */
7164 12 May 23 nicklas 88   public static final BiomaterialList FLAGGED_EXERNAL_SPECIMEN = 
7164 12 May 23 nicklas 89     new BiomaterialList("Flagged External specimen", "net.sf.basedb.reggie.external-specimen.flagged", Item.SAMPLE, Subtype.SPECIMEN,
7164 12 May 23 nicklas 90       "This list contains Specimen items that have been processed externally. We have received the "+
7164 12 May 23 nicklas 91       "Specimen, Lysate, RNA, DNA and FlowThrough but not any information about the processing or "+
7164 12 May 23 nicklas 92       "sequencing");
7164 12 May 23 nicklas 93
7164 12 May 23 nicklas 94   
7164 12 May 23 nicklas 95   /**
3659 09 Dec 15 nicklas 96     List that holds RNA item that should be selected when using the
3659 09 Dec 15 nicklas 97     'auto-design' option for creating a mRNA/Library plate. If no items
3659 09 Dec 15 nicklas 98     exists in this list the {@link #RNA_AUTO_DESIGN_2} is checked.
3659 09 Dec 15 nicklas 99     @since 4.0
3659 09 Dec 15 nicklas 100    */
3659 09 Dec 15 nicklas 101   public static final BiomaterialList RNA_AUTO_DESIGN_1 =
3659 09 Dec 15 nicklas 102     new BiomaterialList("RNA for auto-design libplate #1", 
3659 09 Dec 15 nicklas 103       "net.sf.basedb.reggie.rna.auto-design-1", Item.EXTRACT, Subtype.RNA,
3659 09 Dec 15 nicklas 104       "This list contains RNA that should be auto-selected for sequencing by the "
3659 09 Dec 15 nicklas 105       + "'Auto-design library preparation' wizard when there are remaining slots "
3659 09 Dec 15 nicklas 106       + "after filling the plate with new RNA.");
3659 09 Dec 15 nicklas 107
3659 09 Dec 15 nicklas 108   /**
3659 09 Dec 15 nicklas 109     List that holds RNA item that should be selected when using the
3659 09 Dec 15 nicklas 110     'auto-design' option for creating a mRNA/Library plate. This
3659 09 Dec 15 nicklas 111     list is only used when there are no more items in the 
3659 09 Dec 15 nicklas 112     {@link #RNA_AUTO_DESIGN_1} list.
3659 09 Dec 15 nicklas 113     @since 4.0
3659 09 Dec 15 nicklas 114   */
3659 09 Dec 15 nicklas 115   public static final BiomaterialList RNA_AUTO_DESIGN_2 =
3659 09 Dec 15 nicklas 116       new BiomaterialList("RNA for auto-design libplate #2", 
3659 09 Dec 15 nicklas 117         "net.sf.basedb.reggie.rna.auto-design-2", Item.EXTRACT, Subtype.RNA,
3659 09 Dec 15 nicklas 118         "This list contains RNA that should be auto-selected for sequencing by the "
3659 09 Dec 15 nicklas 119         + "'Auto-design library preparation' wizard when there are remaining slots "
3659 09 Dec 15 nicklas 120         + "after filling the plate with new RNA.");
3659 09 Dec 15 nicklas 121   
3659 09 Dec 15 nicklas 122   /**
4649 20 Dec 17 nicklas 123     The definition of the biomaterial list used for storing aligned sequences
4649 20 Dec 17 nicklas 124     that should be further investigated due to genotype QC checks.
4649 20 Dec 17 nicklas 125     @since 4.14
4649 20 Dec 17 nicklas 126   */
4649 20 Dec 17 nicklas 127   public static final BiomaterialList FLAGGED_ALIGNMENT = 
4649 20 Dec 17 nicklas 128     new BiomaterialList("Flagged Alignment", "net.sf.basedb.reggie.alignment.flagged", 
4649 20 Dec 17 nicklas 129       Item.DERIVEDBIOASSAY, Subtype.ALIGNED_SEQUENCES,
4649 20 Dec 17 nicklas 130       "This list contains aligned sequences items where the genotype QC check has detected " +
4649 20 Dec 17 nicklas 131       "something that needs to be further investigated.");
4649 20 Dec 17 nicklas 132
4649 20 Dec 17 nicklas 133   /**
6179 24 Mar 21 nicklas 134     The definition of the list used for storing merged sequences that 
6179 24 Mar 21 nicklas 135     need to import FASTQ files from an external source.
6179 24 Mar 21 nicklas 136     @since 4.32
6179 24 Mar 21 nicklas 137   */
6179 24 Mar 21 nicklas 138   public static final BiomaterialList FASTQ_IMPORT_PIPELINE = 
6179 24 Mar 21 nicklas 139     new BiomaterialList("FASTQ Import Pipeline", "net.sf.basedb.reggie.pipeline.fastq-import",
6215 16 Apr 21 nicklas 140       Item.DERIVEDBIOASSAY, Subtype.DEMUXED_SEQUENCES,
6215 16 Apr 21 nicklas 141       "This list contains demuxed sequences items that need FASTQ files to be imported " +
6179 24 Mar 21 nicklas 142       "before downstream analysis can take place. Items are normally added and removed from this list " +
6179 24 Mar 21 nicklas 143       "automatically, but it is possible to also manually add items.");
6179 24 Mar 21 nicklas 144
6179 24 Mar 21 nicklas 145   /**
4596 27 Sep 17 nicklas 146     The definition of the list used for storing merged sequences that
4659 26 Jan 18 nicklas 147     should to be processed with the Hisat alignment pipeline.
4596 27 Sep 17 nicklas 148     @since 4.12
4596 27 Sep 17 nicklas 149   */
4596 27 Sep 17 nicklas 150   public static final BiomaterialList HISAT_PIPELINE = 
4596 27 Sep 17 nicklas 151     new BiomaterialList("Hisat Pipeline", "net.sf.basedb.reggie.pipeline.hisat",
4596 27 Sep 17 nicklas 152       Item.DERIVEDBIOASSAY, Subtype.MERGED_SEQUENCES,
4596 27 Sep 17 nicklas 153       "This list contains merged sequences items that should be processed with the " +
4596 27 Sep 17 nicklas 154       "Hisat alignement pipeline. Items are normally added and removed from this list " +
4596 27 Sep 17 nicklas 155       "automatically, but it is possible to also manually add items.");
4596 27 Sep 17 nicklas 156
4596 27 Sep 17 nicklas 157   /**
6807 24 Aug 22 nicklas 158     The definition of the list used for storing merged sequences that
6807 24 Aug 22 nicklas 159     should to be processed with the Hisat 2023 alignment pipeline.
6807 24 Aug 22 nicklas 160     @since 4.40
6807 24 Aug 22 nicklas 161   */
6811 25 Aug 22 nicklas 162   public static final BiomaterialList HISAT_2023_PIPELINE = 
6809 24 Aug 22 nicklas 163     new BiomaterialList("Hisat/2023 Pipeline", "net.sf.basedb.reggie.pipeline.hisat2023",
6807 24 Aug 22 nicklas 164       Item.DERIVEDBIOASSAY, Subtype.MERGED_SEQUENCES,
6807 24 Aug 22 nicklas 165       "This list contains merged sequences items that should be processed with the " +
6815 26 Aug 22 nicklas 166       "Hisat/2023 alignment pipeline. Items are normally added and removed from this list " +
6807 24 Aug 22 nicklas 167       "automatically, but it is possible to also manually add items.");
6807 24 Aug 22 nicklas 168
6807 24 Aug 22 nicklas 169   /**
7083 28 Mar 23 nicklas 170     The definition of the list used for storing merged sequences (from DNA)
7083 28 Mar 23 nicklas 171     that should to be processed with the Bwa-mem2 alignment pipeline.
7083 28 Mar 23 nicklas 172     @since 4.46
7083 28 Mar 23 nicklas 173   */
7083 28 Mar 23 nicklas 174   public static final BiomaterialList BWA_MEM2_PIPELINE = 
7083 28 Mar 23 nicklas 175     new BiomaterialList("Bwa-mem2 Pipeline", "net.sf.basedb.reggie.pipeline.bwa-mem2",
7083 28 Mar 23 nicklas 176       Item.DERIVEDBIOASSAY, Subtype.MERGED_SEQUENCES,
7083 28 Mar 23 nicklas 177       "This list contains merged sequences items that should be processed with the " +
7083 28 Mar 23 nicklas 178       "Bwa-mem2 alignment pipeline.");
7083 28 Mar 23 nicklas 179
7083 28 Mar 23 nicklas 180   /**
4659 26 Jan 18 nicklas 181     The definition of the list used for storing aligned sequences that
4663 29 Jan 18 nicklas 182     should processed with StringTie.
4659 26 Jan 18 nicklas 183     @since 4.15
4659 26 Jan 18 nicklas 184   */
4659 26 Jan 18 nicklas 185   public static final BiomaterialList STRINGTIE_PIPELINE = 
4663 29 Jan 18 nicklas 186     new BiomaterialList("StringTie Pipeline", "net.sf.basedb.reggie.pipeline.stringtie",
4659 26 Jan 18 nicklas 187       Item.DERIVEDBIOASSAY, Subtype.ALIGNED_SEQUENCES,
4659 26 Jan 18 nicklas 188       "This list contains aligned sequences items that should be processed with the " +
4663 29 Jan 18 nicklas 189       "StringTie pipeline. Items are normally added and removed from this list " +
4659 26 Jan 18 nicklas 190       "automatically, but it is possible to also manually add items.");
4659 26 Jan 18 nicklas 191
5015 08 Oct 18 nicklas 192   /**
5015 08 Oct 18 nicklas 193     The definition of the list used for storing aligned sequences that
6815 26 Aug 22 nicklas 194     should processed with the StringTie 2023 pipeline.
6815 26 Aug 22 nicklas 195     @since 4.40
6815 26 Aug 22 nicklas 196   */
6815 26 Aug 22 nicklas 197   public static final BiomaterialList STRINGTIE_2023_PIPELINE = 
6815 26 Aug 22 nicklas 198     new BiomaterialList("StringTie/2023 Pipeline", "net.sf.basedb.reggie.pipeline.stringtie2023",
6815 26 Aug 22 nicklas 199       Item.DERIVEDBIOASSAY, Subtype.ALIGNED_SEQUENCES,
6815 26 Aug 22 nicklas 200       "This list contains aligned sequences items that should be processed with the " +
6815 26 Aug 22 nicklas 201       "StringTie/2023 pipeline. Items are normally added and removed from this list " +
6815 26 Aug 22 nicklas 202       "automatically, but it is possible to also manually add items.");
6815 26 Aug 22 nicklas 203
6868 15 Nov 22 nicklas 204   /**
6868 15 Nov 22 nicklas 205     The definition of the list used for storing methylation derived bioassays
6868 15 Nov 22 nicklas 206     that should be analyzed.
6868 15 Nov 22 nicklas 207     @since 4.41
6868 15 Nov 22 nicklas 208   */
6868 15 Nov 22 nicklas 209   public static final BiomaterialList METHYLATION_PIPELINE = 
6868 15 Nov 22 nicklas 210     new BiomaterialList("Methylation beta-analysis", "net.sf.basedb.reggie.pipeline.methylation-beta",
6868 15 Nov 22 nicklas 211       Item.DERIVEDBIOASSAY, Subtype.METHYLATION,
6868 15 Nov 22 nicklas 212       "This list contains methylation items that should be analyzed " +
6868 15 Nov 22 nicklas 213       "from IDAT files to get beta-values.");
6815 26 Aug 22 nicklas 214   
6815 26 Aug 22 nicklas 215   /**
6815 26 Aug 22 nicklas 216     The definition of the list used for storing aligned sequences that
5015 08 Oct 18 nicklas 217     should processed with mBAF analysis.
5015 08 Oct 18 nicklas 218     @since 4.20
5015 08 Oct 18 nicklas 219   */
5015 08 Oct 18 nicklas 220   public static final BiomaterialList MBAF_PIPELINE = 
5015 08 Oct 18 nicklas 221     new BiomaterialList("mBAF analysis", "net.sf.basedb.reggie.pipeline.mbaf",
5015 08 Oct 18 nicklas 222       Item.DERIVEDBIOASSAY, Subtype.ALIGNED_SEQUENCES,
5015 08 Oct 18 nicklas 223       "This list contains aligned sequences items that should be processed with the " +
5015 08 Oct 18 nicklas 224       "mBAF analysis. Items are normally added and removed from this list " +
5015 08 Oct 18 nicklas 225       "automatically, but it is possible to also manually add items.");
5683 22 Oct 19 nicklas 226
6868 15 Nov 22 nicklas 227   
5683 22 Oct 19 nicklas 228   /**
5683 22 Oct 19 nicklas 229     The definition of the list used for storing aligned sequences that
5683 22 Oct 19 nicklas 230     should processed with Variant calling pipeline.
5683 22 Oct 19 nicklas 231     @since 4.24
5683 22 Oct 19 nicklas 232   */
5683 22 Oct 19 nicklas 233   public static final BiomaterialList VARIANT_CALLING_PIPELINE = 
5683 22 Oct 19 nicklas 234     new BiomaterialList("Variant Calling Pipeline", "net.sf.basedb.reggie.pipeline.variant-calling",
5683 22 Oct 19 nicklas 235       Item.DERIVEDBIOASSAY, Subtype.ALIGNED_SEQUENCES,
5683 22 Oct 19 nicklas 236       "This list contains aligned sequences items that should be processed with the " +
5683 22 Oct 19 nicklas 237       "Variant calling pipeline. Items are normally added and removed from this list " +
5683 22 Oct 19 nicklas 238       "automatically, but it is possible to also manually add items.");
4659 26 Jan 18 nicklas 239   
4659 26 Jan 18 nicklas 240   /**
6387 15 Sep 21 nicklas 241     An item list for storing VariantCall raw bioassays that should be processed
6387 15 Sep 21 nicklas 242     with the Targeted Genotype analysis.
6389 15 Sep 21 nicklas 243     @since 4.32
6387 15 Sep 21 nicklas 244   */
6387 15 Sep 21 nicklas 245   public static final BiomaterialList TARGETED_GENOTYPE_PIPELINE = 
6387 15 Sep 21 nicklas 246     new BiomaterialList("Targeted Genotype Pipeline", "net.sf.basedb.reggie.pipeline.targeted-genotype",
6387 15 Sep 21 nicklas 247       Item.RAWBIOASSAY, Rawdatatype.VARIANT_CALL,
6387 15 Sep 21 nicklas 248       "This list contains variant call raw bioassay items that should be processed with the " +
6387 15 Sep 21 nicklas 249       "Targeted Genotype analysis pipeline. Items are normally added and removed from this list " +
6387 15 Sep 21 nicklas 250       "automatically, but it is possible to also manually add items.");
6387 15 Sep 21 nicklas 251   
6387 15 Sep 21 nicklas 252   /**
6387 15 Sep 21 nicklas 253     Item list for sending variant calls to be indexed by the Variant Search
6387 15 Sep 21 nicklas 254     extension. This list is for the filtered variants.
6389 15 Sep 21 nicklas 255     @since 4.32
6387 15 Sep 21 nicklas 256   */
6387 15 Sep 21 nicklas 257   public static final BiomaterialList VARIANT_INDEX_FILTERED = 
6387 15 Sep 21 nicklas 258     new BiomaterialList("Variant index (filtered)", "net.sf.basedb.varsearch.filtered.need-index",
6387 15 Sep 21 nicklas 259       Item.RAWBIOASSAY, Rawdatatype.VARIANT_CALL, 
6387 15 Sep 21 nicklas 260       "This list contains RawBioassay items that should have their " +
6387 15 Sep 21 nicklas 261       "filtered VCF indexed by the Variant Indexing Service.");
6387 15 Sep 21 nicklas 262   
6387 15 Sep 21 nicklas 263   /**
6387 15 Sep 21 nicklas 264     Item list for sending variant calls to be indexed by the Variant Search
6387 15 Sep 21 nicklas 265     extension. This list is for the raw variants.
6389 15 Sep 21 nicklas 266     @since 4.32
6387 15 Sep 21 nicklas 267   */
6387 15 Sep 21 nicklas 268   public static final BiomaterialList VARIANT_INDEX_ALL = 
6387 15 Sep 21 nicklas 269     new BiomaterialList("Variant index (all)", "net.sf.basedb.varsearch.all.need-index",
6387 15 Sep 21 nicklas 270       Item.RAWBIOASSAY, Rawdatatype.VARIANT_CALL, 
6387 15 Sep 21 nicklas 271       "This list contains RawBioassay items that should have their " +
6387 15 Sep 21 nicklas 272       "raw annotated VCF indexed by the Variant Indexing Service.");
6387 15 Sep 21 nicklas 273   
6387 15 Sep 21 nicklas 274   /**
6387 15 Sep 21 nicklas 275     Item list for sending variant calls to be indexed by the Variant Search
6387 15 Sep 21 nicklas 276     extension. This list is for the genotyped variants.
6389 15 Sep 21 nicklas 277     @since 4.32
6387 15 Sep 21 nicklas 278   */
6387 15 Sep 21 nicklas 279   public static final BiomaterialList VARIANT_INDEX_TARGETED = 
6387 15 Sep 21 nicklas 280     new BiomaterialList("Variant index (targeted genotyping)", "net.sf.basedb.varsearch.targeted.need-index",
6387 15 Sep 21 nicklas 281       Item.RAWBIOASSAY, Rawdatatype.VARIANT_CALL, 
6387 15 Sep 21 nicklas 282       "This list contains RawBioassay items that should have their " +
6387 15 Sep 21 nicklas 283       "targeted genotyping VCF indexed by the Variant Indexing Service.");
6387 15 Sep 21 nicklas 284
6387 15 Sep 21 nicklas 285   
6387 15 Sep 21 nicklas 286   /**
5876 24 Mar 20 nicklas 287     A temporary item list for importing variants.
5876 24 Mar 20 nicklas 288     @since 4.26
5876 24 Mar 20 nicklas 289    */
5876 24 Mar 20 nicklas 290   public static final BiomaterialList VARIANT_IMPORT_TMP =
5876 24 Mar 20 nicklas 291     new BiomaterialList("Import variants from existing variant calls", "net.sf.basedb.reggie.variant-import-tmp", 
5876 24 Mar 20 nicklas 292       Item.RAWBIOASSAY, Rawdatatype.VARIANT_CALL, 
5876 24 Mar 20 nicklas 293       "Temporary item list for raw bioassays that need to import information about " + 
5876 24 Mar 20 nicklas 294       "variants that have been found in interesting genes.");
5876 24 Mar 20 nicklas 295   
5876 24 Mar 20 nicklas 296   /**
6023 26 Oct 20 nicklas 297     An item list for storing Cufflinks raw bioassays that are ready
6023 26 Oct 20 nicklas 298     for having a gene report created.
6023 26 Oct 20 nicklas 299     @since 4.28
6023 26 Oct 20 nicklas 300   */
6023 26 Oct 20 nicklas 301   public static final BiomaterialList GENE_REPORT_CREATE =
6023 26 Oct 20 nicklas 302     new BiomaterialList("Gene report list", "net.sf.basedb.reggie.pipeline.gene-report", 
6023 26 Oct 20 nicklas 303       Item.RAWBIOASSAY, Rawdatatype.CUFFLINKS, 
6023 26 Oct 20 nicklas 304       "This list contains Cufflinks raw bioassays that are ready for " +
6023 26 Oct 20 nicklas 305       "having a gene report created.");
6023 26 Oct 20 nicklas 306
6023 26 Oct 20 nicklas 307   /**
6023 26 Oct 20 nicklas 308     An item list for storing Cufflinks raw bioassays that are ready
6023 26 Oct 20 nicklas 309     for having a pilot report created.
6023 26 Oct 20 nicklas 310     @since 4.28
6023 26 Oct 20 nicklas 311   */
6023 26 Oct 20 nicklas 312   public static final BiomaterialList PILOT_REPORT_CREATE =
6023 26 Oct 20 nicklas 313     new BiomaterialList("Pilot report list", "net.sf.basedb.reggie.pipeline.pilot-report", 
6023 26 Oct 20 nicklas 314       Item.RAWBIOASSAY, Rawdatatype.CUFFLINKS, 
6023 26 Oct 20 nicklas 315       "This list contains Cufflinks raw bioassays that are ready for " +
6023 26 Oct 20 nicklas 316       "having a pilot report created.");
6023 26 Oct 20 nicklas 317
6023 26 Oct 20 nicklas 318   /**
6023 26 Oct 20 nicklas 319     An item list for storing StringTie raw bioassays that are ready
6023 26 Oct 20 nicklas 320     for having a SCAN-B report created.
6023 26 Oct 20 nicklas 321     @since 4.28
6023 26 Oct 20 nicklas 322   */
6023 26 Oct 20 nicklas 323   public static final BiomaterialList SCANB_REPORT_CREATE =
6023 26 Oct 20 nicklas 324     new BiomaterialList("SCAN-B report list", "net.sf.basedb.reggie.pipeline.scanb-report", 
6023 26 Oct 20 nicklas 325       Item.RAWBIOASSAY, Rawdatatype.STRINGTIE, 
6023 26 Oct 20 nicklas 326       "This list contains StringTie raw bioassays that are ready for " +
6023 26 Oct 20 nicklas 327       "having a SCAN-B report created.");
6023 26 Oct 20 nicklas 328     
6023 26 Oct 20 nicklas 329   /**
5922 27 Apr 20 nicklas 330     An item list for storing StringTie raw bioassays that should be processed
5922 27 Apr 20 nicklas 331     with the Single Sample Predictor plug-in.
5922 27 Apr 20 nicklas 332     @since 4.27
5922 27 Apr 20 nicklas 333   */
5922 27 Apr 20 nicklas 334   public static final BiomaterialList SSP_PIPELINE =
5922 27 Apr 20 nicklas 335     new BiomaterialList("Single Sample Predictor analysis", "net.sf.basedb.reggie.pipeline.ssp", 
5922 27 Apr 20 nicklas 336       Item.RAWBIOASSAY, Rawdatatype.STRINGTIE, 
5922 27 Apr 20 nicklas 337       "This list contains StringTie raw bioassays that should be analyzed with the "
5922 27 Apr 20 nicklas 338       + "Single Sample Predictor plug-in");
5922 27 Apr 20 nicklas 339   
5922 27 Apr 20 nicklas 340   
5922 27 Apr 20 nicklas 341   /**
4596 27 Sep 17 nicklas 342     The definition of the list used for storing merged sequences that
4596 27 Sep 17 nicklas 343     need to be processed with the legacy pipeline (Tophat+Cufflinks).
4596 27 Sep 17 nicklas 344     @since 4.12
4596 27 Sep 17 nicklas 345   */
4596 27 Sep 17 nicklas 346   public static final BiomaterialList LEGACY_PIPELINE = 
4596 27 Sep 17 nicklas 347     new BiomaterialList("Legacy Pipeline", "net.sf.basedb.reggie.pipeline.legacy",
4596 27 Sep 17 nicklas 348       Item.DERIVEDBIOASSAY, Subtype.MERGED_SEQUENCES,
4596 27 Sep 17 nicklas 349       "This list contains merged sequences items that should be processed with the " +
4596 27 Sep 17 nicklas 350       "Hisat alignement pipeline. Items are normally added and removed from this list " +
4596 27 Sep 17 nicklas 351       "automatically, but it is possible to also manually add items.");
4596 27 Sep 17 nicklas 352
4596 27 Sep 17 nicklas 353   /**
5787 13 Dec 19 nicklas 354     The definition of the list used for storing merged sequences that
5787 13 Dec 19 nicklas 355     should to be processed with the MIPs alignment pipeline.
5787 13 Dec 19 nicklas 356     @since 4.25
5787 13 Dec 19 nicklas 357   */
5787 13 Dec 19 nicklas 358   public static final BiomaterialList MIPS_ALIGN_PIPELINE = 
5787 13 Dec 19 nicklas 359     new BiomaterialList("MIPs Alignment Pipeline", "net.sf.basedb.reggie.pipeline.mips-align",
5787 13 Dec 19 nicklas 360       Item.DERIVEDBIOASSAY, Subtype.MERGED_SEQUENCES,
5787 13 Dec 19 nicklas 361       "This list contains merged sequences items that should be processed with the " +
5787 13 Dec 19 nicklas 362       "MIPs alignment pipeline. Items are normally added and removed from this list " +
5787 13 Dec 19 nicklas 363       "automatically, but it is possible to also manually add items.");
5787 13 Dec 19 nicklas 364
5787 13 Dec 19 nicklas 365   /**
7266 19 Jun 23 nicklas 366     The definition of the list used for storing aligned sequences that
7266 19 Jun 23 nicklas 367     should to be processed with the ASCAT analysis.
7266 19 Jun 23 nicklas 368     @since 4.49
7266 19 Jun 23 nicklas 369   */
7266 19 Jun 23 nicklas 370   public static final BiomaterialList ASCAT_PIPELINE = 
7266 19 Jun 23 nicklas 371     new BiomaterialList("ASCAT Pipeline", "net.sf.basedb.reggie.pipeline.ascat",
7266 19 Jun 23 nicklas 372       Item.DERIVEDBIOASSAY, Subtype.ALIGNED_SEQUENCES,
7266 19 Jun 23 nicklas 373       "This list contains (tumor) aligned sequences items that should be processed with the " +
7266 19 Jun 23 nicklas 374       "ASCAT pipeline. Items are normally added and removed from this list " +
7266 19 Jun 23 nicklas 375       "automatically, but it is possible to also manually add items.");
7398 07 Nov 23 nicklas 376
7398 07 Nov 23 nicklas 377   /**
7398 07 Nov 23 nicklas 378     The definition of the list used for storing aligned sequences that
7398 07 Nov 23 nicklas 379     should to be processed with the WGS variant calling pipeline.
7398 07 Nov 23 nicklas 380     @since 4.50
7398 07 Nov 23 nicklas 381   */
7398 07 Nov 23 nicklas 382   public static final BiomaterialList WGS_VARIANT_CALLING_PIPELINE = 
7398 07 Nov 23 nicklas 383     new BiomaterialList("WGS Variant Calling Pipeline", "net.sf.basedb.reggie.pipeline.wgs-variant-calling",
7398 07 Nov 23 nicklas 384       Item.DERIVEDBIOASSAY, Subtype.ALIGNED_SEQUENCES,
7398 07 Nov 23 nicklas 385       "This list contains (tumor) aligned sequences items that should be processed with the " +
7398 07 Nov 23 nicklas 386       "WGS variant calling pipeline. Items are normally added and removed from this list " +
7398 07 Nov 23 nicklas 387       "automatically, but it is possible to also manually add items.");
7398 07 Nov 23 nicklas 388
7266 19 Jun 23 nicklas 389   
7266 19 Jun 23 nicklas 390   /**
1803 18 Jan 13 nicklas 391     Get the bioplate type by name of the static constant defined in this class.
1803 18 Jan 13 nicklas 392     
1803 18 Jan 13 nicklas 393     @param cName The name of the static constant
1803 18 Jan 13 nicklas 394     @return A bioplate type object or null if not found
1803 18 Jan 13 nicklas 395    */
1803 18 Jan 13 nicklas 396   public static BiomaterialList getByCName(String cName)
1803 18 Jan 13 nicklas 397   {
1803 18 Jan 13 nicklas 398     if (cName == null) return null;
1803 18 Jan 13 nicklas 399     BiomaterialList bioplateType = null;
1803 18 Jan 13 nicklas 400     try
1803 18 Jan 13 nicklas 401     {
1803 18 Jan 13 nicklas 402       Field f = BiomaterialList.class.getDeclaredField(cName);
1803 18 Jan 13 nicklas 403       bioplateType = (BiomaterialList)f.get(null);
1803 18 Jan 13 nicklas 404     }
1803 18 Jan 13 nicklas 405     catch (NoSuchFieldException ex)
1803 18 Jan 13 nicklas 406     {}
1803 18 Jan 13 nicklas 407     catch (IllegalAccessException ex)
1803 18 Jan 13 nicklas 408     {}
1803 18 Jan 13 nicklas 409     catch (ClassCastException ex)
1803 18 Jan 13 nicklas 410     {}
1803 18 Jan 13 nicklas 411     return bioplateType;
1803 18 Jan 13 nicklas 412   }
1803 18 Jan 13 nicklas 413   
1803 18 Jan 13 nicklas 414   private final String name;
1803 18 Jan 13 nicklas 415   private final String externalId;
1803 18 Jan 13 nicklas 416   private final Item bioMaterialType;
3659 09 Dec 15 nicklas 417   private final Subtype subtype;
5876 24 Mar 20 nicklas 418   private final Rawdatatype rawdatatype;
1803 18 Jan 13 nicklas 419   private final String description;
1803 18 Jan 13 nicklas 420   private int id;
1803 18 Jan 13 nicklas 421   
1803 18 Jan 13 nicklas 422   /**
1803 18 Jan 13 nicklas 423     Create a new definition
1803 18 Jan 13 nicklas 424     @param name The name of the subtype
1803 18 Jan 13 nicklas 425     @param bioMaterialType The type of biomaterial that can be placed on the bioplate 
1803 18 Jan 13 nicklas 426   */
3659 09 Dec 15 nicklas 427   private BiomaterialList(String name, String externalId, Item bioMaterialType, Subtype subtype, String description)
1803 18 Jan 13 nicklas 428   {
1803 18 Jan 13 nicklas 429     this.name = name;
1803 18 Jan 13 nicklas 430     this.externalId = externalId;
1803 18 Jan 13 nicklas 431     this.bioMaterialType = bioMaterialType;
3659 09 Dec 15 nicklas 432     this.subtype = subtype;
5876 24 Mar 20 nicklas 433     this.rawdatatype = null;
1803 18 Jan 13 nicklas 434     this.description = description;
1803 18 Jan 13 nicklas 435   }
5876 24 Mar 20 nicklas 436   
5876 24 Mar 20 nicklas 437   private BiomaterialList(String name, String externalId, Item bioMaterialType, Rawdatatype rawdatatype, String description)
5876 24 Mar 20 nicklas 438   {
5876 24 Mar 20 nicklas 439     this.name = name;
5876 24 Mar 20 nicklas 440     this.externalId = externalId;
5876 24 Mar 20 nicklas 441     this.bioMaterialType = bioMaterialType;
5876 24 Mar 20 nicklas 442     this.subtype = null;
5876 24 Mar 20 nicklas 443     this.rawdatatype = rawdatatype;
5876 24 Mar 20 nicklas 444     this.description = description;
5876 24 Mar 20 nicklas 445   }
1803 18 Jan 13 nicklas 446     
1803 18 Jan 13 nicklas 447   /**
1803 18 Jan 13 nicklas 448     Get the name of the biomaterial list.
1803 18 Jan 13 nicklas 449   */
1803 18 Jan 13 nicklas 450   public String getName()
1803 18 Jan 13 nicklas 451   {
1803 18 Jan 13 nicklas 452     return name;
1803 18 Jan 13 nicklas 453   }
1803 18 Jan 13 nicklas 454   
1803 18 Jan 13 nicklas 455   /**
1803 18 Jan 13 nicklas 456     Get the list description.
1803 18 Jan 13 nicklas 457   */
1803 18 Jan 13 nicklas 458   public String getDescription()
1803 18 Jan 13 nicklas 459   {
1803 18 Jan 13 nicklas 460     return description;
1803 18 Jan 13 nicklas 461   }
1803 18 Jan 13 nicklas 462   
1803 18 Jan 13 nicklas 463   /**
1803 18 Jan 13 nicklas 464     Get the external id of the biomaterial list.
1803 18 Jan 13 nicklas 465   */
1803 18 Jan 13 nicklas 466   public String getExternalId()
1803 18 Jan 13 nicklas 467   {
1803 18 Jan 13 nicklas 468     return externalId;
1803 18 Jan 13 nicklas 469   }
1803 18 Jan 13 nicklas 470   
1803 18 Jan 13 nicklas 471   /**
3659 09 Dec 15 nicklas 472     Get the biomaterial item type that can be used in the list.
1803 18 Jan 13 nicklas 473   */
1803 18 Jan 13 nicklas 474   public Item getBioMaterialType()
1803 18 Jan 13 nicklas 475   {
1803 18 Jan 13 nicklas 476     return bioMaterialType;
1803 18 Jan 13 nicklas 477   }
1803 18 Jan 13 nicklas 478   
1803 18 Jan 13 nicklas 479   /**
3659 09 Dec 15 nicklas 480     Get the subtype of items to include in the list (or null
3659 09 Dec 15 nicklas 481     if any subtype can be included)
3659 09 Dec 15 nicklas 482     @since 4.0
3659 09 Dec 15 nicklas 483   */
3659 09 Dec 15 nicklas 484   public Subtype getSubtype()
3659 09 Dec 15 nicklas 485   {
3659 09 Dec 15 nicklas 486     return subtype;
3659 09 Dec 15 nicklas 487   }
3659 09 Dec 15 nicklas 488   
3659 09 Dec 15 nicklas 489   /**
5876 24 Mar 20 nicklas 490     If the list contains raw bioassays, the raw data type can be specified.
5876 24 Mar 20 nicklas 491     @since 4.26
5876 24 Mar 20 nicklas 492   */
5876 24 Mar 20 nicklas 493   public Rawdatatype getRawdatatype()
5876 24 Mar 20 nicklas 494   {
5876 24 Mar 20 nicklas 495     return rawdatatype;
5876 24 Mar 20 nicklas 496   }
5876 24 Mar 20 nicklas 497   
5876 24 Mar 20 nicklas 498   /**
1803 18 Jan 13 nicklas 499     Load the subtype as a BASE item.
1803 18 Jan 13 nicklas 500     @param dc The DbControl to use for database access
1803 18 Jan 13 nicklas 501     @return An ItemSubtype object
1803 18 Jan 13 nicklas 502   */
3247 14 Apr 15 nicklas 503   public ItemList load(DbControl dc)
1803 18 Jan 13 nicklas 504   {
3247 14 Apr 15 nicklas 505     ItemList list = null;
1803 18 Jan 13 nicklas 506     if (id == 0)
1803 18 Jan 13 nicklas 507     {
3247 14 Apr 15 nicklas 508       List<ItemList> result = list(dc);
1803 18 Jan 13 nicklas 509       if (result.size() == 0)
1803 18 Jan 13 nicklas 510       {
3247 14 Apr 15 nicklas 511         throw new ItemNotFoundException("ItemList["+getName()+"]");
1803 18 Jan 13 nicklas 512       }
1803 18 Jan 13 nicklas 513       else if (result.size() > 1)
1803 18 Jan 13 nicklas 514       {
3247 14 Apr 15 nicklas 515         throw new InvalidDataException("Found > 1 ItemList["+getName()+"]");
1803 18 Jan 13 nicklas 516       }
1803 18 Jan 13 nicklas 517       list = result.get(0);
1803 18 Jan 13 nicklas 518       id = list.getId();
1803 18 Jan 13 nicklas 519     }
1803 18 Jan 13 nicklas 520     else
1803 18 Jan 13 nicklas 521     {
3247 14 Apr 15 nicklas 522       list = ItemList.getById(dc, id);
1803 18 Jan 13 nicklas 523     }
1803 18 Jan 13 nicklas 524     return list;
1803 18 Jan 13 nicklas 525   }
1803 18 Jan 13 nicklas 526   
1803 18 Jan 13 nicklas 527   /**
4624 17 Nov 17 nicklas 528     Load the item list as a BASE item. Same as {@link #load(DbControl)} but return null
4624 17 Nov 17 nicklas 529     if no BASE item is found instead of throwing an exception.
4624 17 Nov 17 nicklas 530     @param dc The DbControl to use for database access
4624 17 Nov 17 nicklas 531     @return An ItemList object
4624 17 Nov 17 nicklas 532     @since 4.13
4624 17 Nov 17 nicklas 533   */
4624 17 Nov 17 nicklas 534   public ItemList get(DbControl dc)
4624 17 Nov 17 nicklas 535   {
4624 17 Nov 17 nicklas 536     ItemList list = null;
4624 17 Nov 17 nicklas 537     if (id == 0)
4624 17 Nov 17 nicklas 538     {
4624 17 Nov 17 nicklas 539       List<ItemList> result = list(dc);
4624 17 Nov 17 nicklas 540       if (result.size() == 1)
4624 17 Nov 17 nicklas 541       {
4624 17 Nov 17 nicklas 542         list = result.get(0);
4624 17 Nov 17 nicklas 543         id = list.getId();
4624 17 Nov 17 nicklas 544       }
4624 17 Nov 17 nicklas 545     }
4624 17 Nov 17 nicklas 546     else
4624 17 Nov 17 nicklas 547     {
4624 17 Nov 17 nicklas 548       list = ItemList.getById(dc, id);
4624 17 Nov 17 nicklas 549     }
4624 17 Nov 17 nicklas 550     return list;
4624 17 Nov 17 nicklas 551     
4624 17 Nov 17 nicklas 552   }
4624 17 Nov 17 nicklas 553   
4624 17 Nov 17 nicklas 554   /**
1803 18 Jan 13 nicklas 555     List all biomaterial lists registered in BASE with an external id matching this list
1803 18 Jan 13 nicklas 556     definition. Normally, only a single biomaterial list type should be returned.
1803 18 Jan 13 nicklas 557   */
3247 14 Apr 15 nicklas 558   public List<ItemList> list(DbControl dc)
1803 18 Jan 13 nicklas 559   {
3247 14 Apr 15 nicklas 560     ItemQuery<ItemList> query = ItemList.getQuery();
1803 18 Jan 13 nicklas 561     query.restrict(
1803 18 Jan 13 nicklas 562       Restrictions.eq(
1803 18 Jan 13 nicklas 563         Hql.property("externalId"), 
1803 18 Jan 13 nicklas 564         Expressions.parameter("externalId", getExternalId(), Type.STRING)
1803 18 Jan 13 nicklas 565       ));
1803 18 Jan 13 nicklas 566     query.include(Include.ALL);
1803 18 Jan 13 nicklas 567     return query.list(dc);
1803 18 Jan 13 nicklas 568   }
1803 18 Jan 13 nicklas 569   
1803 18 Jan 13 nicklas 570   
1803 18 Jan 13 nicklas 571 }