Skip to content

Commit 25c0ecd

Browse files
authored
Merge pull request #270 from BimberLab/24.3_fb_merge
Merge discvr-23.11 to discvr-24.3
2 parents 2e428be + e8e1a76 commit 25c0ecd

File tree

136 files changed

+3012
-1242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+3012
-1242
lines changed

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/SequenceAnalysisService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.apache.logging.log4j.Logger;
2020
import org.jetbrains.annotations.Nullable;
2121
import org.labkey.api.data.Container;
22+
import org.labkey.api.laboratory.DemographicsProvider;
2223
import org.labkey.api.laboratory.NavItem;
2324
import org.labkey.api.pipeline.PipelineJob;
2425
import org.labkey.api.pipeline.PipelineJobException;
@@ -76,6 +77,10 @@ static public void setInstance(SequenceAnalysisService instance)
7677

7778
abstract public File ensureVcfIndex(File vcf, Logger log, boolean forceRecreate) throws IOException;
7879

80+
abstract public File ensureBamOrCramIdx(File bamOrCram, Logger log, boolean forceRecreate) throws PipelineJobException;
81+
82+
abstract public File getExpectedBamOrCramIndex(File bamOrCram);
83+
7984
abstract public File bgzipFile(File input, Logger log) throws PipelineJobException;
8085

8186
abstract public void ensureFastaIndex(File fasta, Logger log) throws PipelineJobException;
@@ -84,7 +89,7 @@ static public void setInstance(SequenceAnalysisService instance)
8489

8590
abstract public Integer getExpRunIdForJob(PipelineJob job, boolean throwUnlessFound) throws PipelineJobException;
8691

87-
abstract public List<PedigreeRecord> generatePedigree(Collection<String> sampleNames, Container c, User u);
92+
abstract public List<PedigreeRecord> generatePedigree(Collection<String> sampleNames, Container c, User u, DemographicsProvider d);
8893

8994
abstract public String getVCFLineCount(File vcf, Logger log, boolean passOnly) throws PipelineJobException;
9095

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/AbstractAlignmentStepProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* Date: 6/14/2014
2929
* Time: 2:44 PM
3030
*/
31-
abstract public class AbstractAlignmentStepProvider<StepType extends AlignmentStep> extends AbstractPipelineStepProvider<StepType> implements AlignmentStepProvider
31+
abstract public class AbstractAlignmentStepProvider<StepType extends AlignmentStep> extends AbstractPipelineStepProvider<StepType> implements AlignmentStepProvider<StepType>
3232
{
3333
public static String ALIGNMENT_MODE_PARAM = "alignmentMode";
3434
public static String SUPPORT_MERGED_UNALIGNED = "supportsMergeUnaligned";

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/AbstractPipelineStepProvider.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* Date: 6/14/2014
3232
* Time: 12:37 PM
3333
*/
34-
abstract public class AbstractPipelineStepProvider<StepType extends PipelineStep> implements PipelineStepProvider
34+
abstract public class AbstractPipelineStepProvider<StepType extends PipelineStep> implements PipelineStepProvider<StepType>
3535
{
3636
private final String _name;
3737
private final String _label;
@@ -140,12 +140,11 @@ public JSONObject toJSON()
140140
@Override
141141
public Class<StepType> getStepClass()
142142
{
143-
ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperclass();
144-
return (Class) parameterizedType.getActualTypeArguments()[0];
143+
return (Class<StepType>) SequencePipelineService.get().findSuperClassParameterType(this);
145144
}
146145

147146
@Override
148-
public PipelineStepProvider<StepType> combineSteps(int existingStepIdx, PipelineStepCtx toCombine)
147+
public PipelineStepProvider<StepType> combineSteps(int existingStepIdx, PipelineStepCtx<StepType> toCombine)
149148
{
150149
return null;
151150
}

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/AlignmentStepProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.labkey.api.sequenceanalysis.pipeline;
22

3-
public interface AlignmentStepProvider extends PipelineStepProvider
3+
public interface AlignmentStepProvider<StepType extends PipelineStep> extends PipelineStepProvider<StepType>
44
{
55
default boolean shouldRunIdxstats()
66
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.labkey.api.sequenceanalysis.pipeline;
2+
3+
import org.json.JSONObject;
4+
5+
public class PedigreeToolParameterDescriptor extends ToolParameterDescriptor
6+
{
7+
public static String NAME = "pedigreeSource";
8+
9+
public PedigreeToolParameterDescriptor()
10+
{
11+
super(null, NAME, "Pedigree Source", "This is the table used for pedigree data", "laboratory-pedigreeselectorfield", "laboratory.subjects", new JSONObject(){{
12+
put("allowBlank", false);
13+
}});
14+
}
15+
16+
public static String getClientDependencyPath()
17+
{
18+
return "/laboratory/field/PedigreeSelectorField.js";
19+
}
20+
}

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/PipelineStepProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ default boolean hasParameter(String name)
9494
* Allows a given step to combine itself w/ a neighboring step to save compute time. Should return a new provider, which will
9595
* replace both original provider. Return null for no changes.
9696
*/
97-
PipelineStepProvider<StepType> combineSteps(int existingStepIdx, PipelineStepCtx toCombine);
97+
PipelineStepProvider<StepType> combineSteps(int existingStepIdx, PipelineStepCtx<StepType> toCombine);
9898
}

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/SamtoolsCramConverter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public File convert(File inputBam, File outputCram, File gzippedFasta, boolean d
5757
return outputCram;
5858
}
5959

60-
private void doIndex(File input, @Nullable Integer threads) throws PipelineJobException
60+
public File doIndex(File input, @Nullable Integer threads) throws PipelineJobException
6161
{
6262
List<String> params = new ArrayList<>();
6363
params.add(getSamtoolsPath().getPath());
@@ -77,6 +77,8 @@ private void doIndex(File input, @Nullable Integer threads) throws PipelineJobEx
7777
{
7878
throw new PipelineJobException("Unable to find CRAM index: " + idx.getPath());
7979
}
80+
81+
return idx;
8082
}
8183

8284
public static File getExpectedCramIndex(File input)

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/SequencePipelineService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ static public void setInstance(SequencePipelineService instance)
5353

5454
abstract public void registerPipelineStepType(Class<? extends PipelineStep> clazz, String paramName);
5555

56-
abstract public void registerPipelineStep(PipelineStepProvider provider);
56+
abstract public void registerPipelineStep(PipelineStepProvider<?> provider);
5757

58-
abstract public Set<PipelineStepProvider> getAllProviders();
58+
abstract public Set<PipelineStepProvider<?>> getAllProviders();
5959

6060
abstract public <StepType extends PipelineStep> Set<PipelineStepProvider<StepType>> getProviders(Class<StepType> stepType);
6161

@@ -146,4 +146,6 @@ static public void setInstance(SequencePipelineService instance)
146146
abstract public TaskFileManager getTaskFileManager();
147147

148148
abstract public Set<JobResourceSettings> getResourceSettings();
149+
150+
abstract public Class<?> findSuperClassParameterType(Object instance);
149151
}

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/ToolParameterDescriptor.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,22 @@ public <ParamType> ParamType extractValue(PipelineJob job, PipelineStepProvider<
187187
return this.extractValue(job, provider, stepIdx, clazz, null);
188188
}
189189

190+
public boolean hasValueInJson(PipelineJob job, PipelineStepProvider<?> provider, int stepIdx)
191+
{
192+
String key = getJsonParamName(provider, stepIdx);
193+
JSONObject jobParams;
194+
if (job instanceof HasJobParams)
195+
{
196+
jobParams = ((HasJobParams)job).getParameterJson();
197+
}
198+
else
199+
{
200+
jobParams = new JSONObject(job.getParameters());
201+
}
202+
203+
return jobParams.has(key);
204+
}
205+
190206
public <ParamType> ParamType extractValue(PipelineJob job, PipelineStepProvider<?> provider, int stepIdx, Class<ParamType> clazz, @Nullable ParamType defaultValue)
191207
{
192208
String key = getJsonParamName(provider, stepIdx);

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/VariantProcessingStep.java

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717

1818
import htsjdk.samtools.util.Interval;
1919
import org.jetbrains.annotations.Nullable;
20+
import org.labkey.api.laboratory.DemographicsProvider;
21+
import org.labkey.api.laboratory.LaboratoryService;
2022
import org.labkey.api.pipeline.PipelineJob;
2123
import org.labkey.api.pipeline.PipelineJobException;
24+
import org.labkey.api.pipeline.PipelineJobService;
2225
import org.labkey.api.sequenceanalysis.SequenceOutputFile;
2326

2427
import java.io.File;
@@ -45,10 +48,22 @@ default void complete(PipelineJob job, List<SequenceOutputFile> inputs, List<Seq
4548

4649
enum ScatterGatherMethod
4750
{
48-
none(),
49-
contig(),
50-
chunked(),
51-
fixedJobs()
51+
none(false),
52+
contig(false),
53+
chunked(true),
54+
fixedJobs(false);
55+
56+
private final boolean _mayRequireSort;
57+
58+
ScatterGatherMethod(boolean mayRequireSort)
59+
{
60+
_mayRequireSort = mayRequireSort;
61+
}
62+
63+
public boolean mayRequireSort()
64+
{
65+
return _mayRequireSort;
66+
}
5267
}
5368

5469
interface Output extends PipelineStepOutput
@@ -58,7 +73,20 @@ interface Output extends PipelineStepOutput
5873

5974
interface RequiresPedigree
6075
{
76+
default String getDemographicsProviderName(PipelineStepProvider<?> provider, PipelineJob job, int stepIdx)
77+
{
78+
return provider.getParameterByName(PedigreeToolParameterDescriptor.NAME).extractValue(job, provider, stepIdx, String.class);
79+
}
6180

81+
default DemographicsProvider getDemographicsProvider(PipelineStepProvider<?> provider, PipelineJob job, int stepIdx)
82+
{
83+
if (PipelineJobService.get().getLocationType() != PipelineJobService.LocationType.WebServer)
84+
{
85+
throw new IllegalStateException("getDemographicsProvider() can only be run from the webserver");
86+
}
87+
88+
return LaboratoryService.get().getDemographicsProviderByName(job.getContainer(), job.getUser(), getDemographicsProviderName(provider, job, stepIdx));
89+
}
6290
}
6391

6492
interface SupportsScatterGather

0 commit comments

Comments
 (0)