Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Ext4.define('SequenceAnalysis.field.ChainFileSelectorField', {
extend: 'LABKEY.ext4.ComboBox',
alias: 'widget.sequenceanalysis-chainfileselectorfield',

genomeId: -1,
valueField: 'dataid',

initComponent: function(){
Ext4.apply(this, {
xtype: 'labkey-combo',
itemId: 'chainFileId',
fieldLabel: 'Target Genome',
forceSelection: true,
width: 450,
store: {
type: 'labkey-store',
schemaName: 'sequenceanalysis',
queryName: 'chain_files',
columns: 'rowid,chainFile,genomeId2,genomeId2/name',
filterArray: this.getFilterArray(),
autoLoad: true
},
displayField: 'genomeId2/name',
valueField: 'chainFile',
allowBlank: false
});

this.callParent(arguments);

this.on('afterrender', function() {
var parent = this.up('sequenceanalysis-basesequencepanel'); //Alignment panels
var window = this.up('window'); //OutputHandlerWindow

if (parent) {
var field = parent.down('field[name=referenceLibraryCreation.SavedLibrary.libraryId]');
if (field) {
this.mon(field, 'change', this.onGenomeChange, this);
if (field.getValue()){
this.updateStoreFilters(field.getValue());
}
}
else if (parent.libraryIds){
if (parent.libraryIds.length === 1){
this.updateStoreFilters(parent.libraryIds[0]);
}
else if (!parent.libraryIds.length){
Ext4.Msg.alert('Genome Error', 'There are no reference genomes associated with these samples');
}
else if (parent.libraryIds.length > 1){
Ext4.Msg.alert('Genome Error', 'More than one reference genome associated with these samples. They must all use the same genome.');
}
}
else {
LDK.Utils.logError('unable to find library field in ChainFileSelectorField');
}
}
else if (window && window.libraryId){
this.updateStoreFilters(window.libraryId);
}
else {
LDK.Utils.logError('unable to find basesequencepanel in ChainFileSelectorField');
Ext4.Msg.alert('Error', 'There is no genome ID provided to this field. This indicates an error in how the module was developed - please contact your administrator.');
}
}, this);
},

onGenomeChange: function(field, genomeId){
genomeId = genomeId ? genomeId : -1;
if (genomeId === this.genomeId){
return;
}

this.updateStoreFilters(genomeId);
},

updateStoreFilters: function(genomeId){
this.genomeId = genomeId;
this.store.filterArray = this.getFilterArray();
this.store.load();
},

getFilterArray: function(){
return [
LABKEY.Filter.create('dateDisabled', null, LABKEY.Filter.Types.ISBLANK),
LABKEY.Filter.create('genomeId1', this.genomeId, LABKEY.Filter.Types.EQUAL)
]
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
import org.labkey.sequenceanalysis.run.util.CombineGVCFsHandler;
import org.labkey.sequenceanalysis.run.util.FastqcRunner;
import org.labkey.sequenceanalysis.run.util.SVAnnotateStep;
import org.labkey.sequenceanalysis.run.variant.AnnotateByLiftoverStep;
import org.labkey.sequenceanalysis.run.variant.DepthOfCoverageHandler;
import org.labkey.sequenceanalysis.run.variant.GenotypeConcordanceStep;
import org.labkey.sequenceanalysis.run.variant.GenotypeFiltrationStep;
Expand Down Expand Up @@ -377,6 +378,7 @@ public static void registerPipelineSteps()
SequencePipelineService.get().registerPipelineStep(new BcftoolsFillFromFastaStep.Provider());
SequencePipelineService.get().registerPipelineStep(new SVAnnotateStep.Provider());
SequencePipelineService.get().registerPipelineStep(new WhatsHapStep.Provider());
SequencePipelineService.get().registerPipelineStep(new AnnotateByLiftoverStep.Provider());

//handlers
SequenceAnalysisService.get().registerFileHandler(new LiftoverHandler());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.labkey.api.sequenceanalysis.run.LiftoverBcfToolsWrapper;
import org.labkey.api.sequenceanalysis.run.SelectVariantsWrapper;
import org.labkey.api.util.FileType;
import org.labkey.api.util.FileUtil;
import org.labkey.api.view.ActionURL;
import org.labkey.api.writer.PrintWriters;
import org.labkey.sequenceanalysis.SequenceAnalysisModule;
Expand Down Expand Up @@ -133,7 +134,7 @@ public boolean canProcess(SequenceOutputFile f)

private static File getUnmappedOutputFile(File liftedVcfFile)
{
return new File(liftedVcfFile.getParentFile(), liftedVcfFile.getName().replaceAll(".lifted-", ".unmapped-"));
return FileUtil.appendName(liftedVcfFile.getParentFile(), liftedVcfFile.getName().replaceAll(".lifted-", ".unmapped-"));
}

private static String getOutputExtension(File inputFile)
Expand Down Expand Up @@ -214,7 +215,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
throw new PipelineJobException("Expected single input file");
}

SequenceOutputFile f = inputFiles.get(0);
SequenceOutputFile f = inputFiles.getFirst();
job.getLogger().info("processing output: " + f.getFile().getName());

RecordedAction action = new RecordedAction(getName());
Expand All @@ -228,7 +229,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c

File outDir = ((FileAnalysisJobSupport) job).getAnalysisDirectory().toNioPathForRead().toFile();
String baseName = SequenceAnalysisService.get().getUnzippedBaseName(f.getFile().getName());
File lifted = new File(outDir, baseName + ".lifted-" + targetGenomeId + getOutputExtension(f.getFile()));
File lifted = FileUtil.appendName(outDir, baseName + ".lifted-" + targetGenomeId + getOutputExtension(f.getFile()));
File unmappedOutput = retainUnmapped ? getUnmappedOutputFile(lifted) : null;

try
Expand Down Expand Up @@ -316,7 +317,7 @@ public void liftOverVcf(JobContext ctx, ReferenceGenome targetGenome, ReferenceG
if (dropGenotypes || intervals != null)
{
ctx.getLogger().info("subsetting VCF");
File outputFile = new File(output.getParentFile(), SequenceAnalysisService.get().getUnzippedBaseName(currentVCF.getName()) + ".noGenotypes.vcf.gz");
File outputFile = FileUtil.appendName(output.getParentFile(), SequenceAnalysisService.get().getUnzippedBaseName(currentVCF.getName()) + ".noGenotypes.vcf.gz");
if (new File(outputFile.getPath() + ".tbi").exists())
{
ctx.getLogger().info("resuming from file: " + outputFile.getPath());
Expand Down Expand Up @@ -364,7 +365,7 @@ public void liftOverVcf(JobContext ctx, ReferenceGenome targetGenome, ReferenceG
File unmappedOutputFile = unmappedOutput;
if (unmappedOutputFile == null)
{
unmappedOutputFile = new File(currentVCF.getParentFile(), "liftoverRejects.vcf.gz");
unmappedOutputFile = FileUtil.appendName(currentVCF.getParentFile(), "liftoverRejects.vcf.gz");
}

LiftoverVcfWrapper wrapper = new LiftoverVcfWrapper(job.getLogger());
Expand Down Expand Up @@ -410,7 +411,7 @@ public File getScatterJobOutput(JobContext ctx) throws PipelineJobException
{
if (ctx.getJob() instanceof SequenceOutputHandlerJob sj)
{
SequenceOutputFile so = sj.getFiles().get(0);
SequenceOutputFile so = sj.getFiles().getFirst();

return ProcessVariantsHandler.getScatterOutputByCategory(ctx, so.getCategory());
}
Expand All @@ -423,7 +424,7 @@ public File getScatterJobOutput(JobContext ctx) throws PipelineJobException
@Override
public SequenceOutputFile createFinalSequenceOutput(PipelineJob job, File processed, List<SequenceOutputFile> inputFiles) throws PipelineJobException
{
return ProcessVariantsHandler.createSequenceOutput(job, processed, inputFiles, inputFiles.get(0).getCategory());
return ProcessVariantsHandler.createSequenceOutput(job, processed, inputFiles, inputFiles.getFirst().getCategory());
}

public void liftOverBed(File chain, File input, File output, @Nullable File unmappedOutput, PipelineJob job, double pct) throws IOException, PipelineJobException
Expand Down Expand Up @@ -498,7 +499,7 @@ public void performAdditionalMergeTasks(JobContext ctx, PipelineJob job, Referen
throw new PipelineJobException("No unmapped VCF found");
}

File combined = getUnmappedOutputFile(orderedScatterOutputs.get(0));
File combined = getUnmappedOutputFile(orderedScatterOutputs.getFirst());
File combinedIdx = new File(combined.getPath() + ".tbi");
if (combinedIdx.exists())
{
Expand All @@ -510,7 +511,7 @@ public void performAdditionalMergeTasks(JobContext ctx, PipelineJob job, Referen
}

SequenceOutputFile so = new SequenceOutputFile();
so.setName(orderedScatterOutputs.get(0).getName() + ": Lifted/Unmapped");
so.setName(orderedScatterOutputs.getFirst().getName() + ": Lifted/Unmapped");
so.setFile(combined);
so.setCategory("VCF File");
so.setLibrary_id(genome.getGenomeId());
Expand Down
Loading
Loading