diff --git a/BaseStudy/build.gradle b/BaseStudy/build.gradle
new file mode 100644
index 000000000..1217b2f38
--- /dev/null
+++ b/BaseStudy/build.gradle
@@ -0,0 +1,18 @@
+import org.labkey.gradle.util.BuildUtils
+
+plugins {
+ id 'org.labkey.build.module'
+}
+
+dependencies {
+ BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:DiscvrLabKeyModules:Studies", depProjectConfig: "published", depExtension: "module")
+ BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:DiscvrLabKeyModules:discvrcore", depProjectConfig: "published", depExtension: "module")
+
+ BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:DiscvrLabKeyModules:Studies", depProjectConfig: "apiJarFile")
+
+ BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:LabDevKitModules:laboratory", depProjectConfig: "apiJarFile")
+ BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:LabDevKitModules:LDK", depProjectConfig: "apiJarFile")
+
+ BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:LabDevKitModules:laboratory", depProjectConfig: "published", depExtension: "module")
+ BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:LabDevKitModules:LDK", depProjectConfig: "published", depExtension: "module")
+}
diff --git a/BaseStudy/module.properties b/BaseStudy/module.properties
new file mode 100644
index 000000000..60a618ba8
--- /dev/null
+++ b/BaseStudy/module.properties
@@ -0,0 +1,7 @@
+ModuleClass: org.labkey.basestudy.BaseStudyModule
+Label: Base Study Module
+Description: A module designed to support study modules
+License: Apache 2.0
+LicenseURL: http://www.apache.org/licenses/LICENSE-2.0
+ManageVersion: false
+SupportedDatabases: mssql, pgsql
diff --git a/BaseStudy/resources/data/amount_units.tsv b/BaseStudy/resources/data/amount_units.tsv
new file mode 100644
index 000000000..b4b010264
--- /dev/null
+++ b/BaseStudy/resources/data/amount_units.tsv
@@ -0,0 +1,11 @@
+value
+g
+IU
+U
+mEq
+mg
+no units
+ug
+units
+L/min
+%
\ No newline at end of file
diff --git a/BaseStudy/resources/data/calculated_status_codes.tsv b/BaseStudy/resources/data/calculated_status_codes.tsv
new file mode 100644
index 000000000..d2bf1dec4
--- /dev/null
+++ b/BaseStudy/resources/data/calculated_status_codes.tsv
@@ -0,0 +1,6 @@
+value
+Alive
+Dead
+No Record
+Shipped
+Unknown
\ No newline at end of file
diff --git a/BaseStudy/resources/data/conc_units.tsv b/BaseStudy/resources/data/conc_units.tsv
new file mode 100644
index 000000000..d7d9b4d18
--- /dev/null
+++ b/BaseStudy/resources/data/conc_units.tsv
@@ -0,0 +1,12 @@
+value denominator numerator
+g/ml mL g
+g/tsp tsp g
+IU/ml mL IU
+mEq/ml mL mEq
+mg/capsule capsule(s) mg
+mg/ml mL mg
+mg/piece piece(s) mg
+mg/tablet tablet(s) mg
+mg/tsp tsp mg
+ug/ml mL ug
+units/ml mL units
\ No newline at end of file
diff --git a/BaseStudy/resources/data/dosage_units.tsv b/BaseStudy/resources/data/dosage_units.tsv
new file mode 100644
index 000000000..eb8de1491
--- /dev/null
+++ b/BaseStudy/resources/data/dosage_units.tsv
@@ -0,0 +1,11 @@
+value numerator denominator
+g/kg g kg
+IU/kg IU kg
+mEq/kg mEq kg
+mg/animal mg
+mg/kg mg kg
+ml/kg ml kg
+no units
+ounces/kg ounces kg
+ug/kg ug kg
+units/kg units kg
\ No newline at end of file
diff --git a/BaseStudy/resources/data/gender_codes.tsv b/BaseStudy/resources/data/gender_codes.tsv
new file mode 100644
index 000000000..783f8712d
--- /dev/null
+++ b/BaseStudy/resources/data/gender_codes.tsv
@@ -0,0 +1,4 @@
+value meaning origgender
+f Female f
+m Male m
+u Unknown
\ No newline at end of file
diff --git a/BaseStudy/resources/data/geographic_origins.tsv b/BaseStudy/resources/data/geographic_origins.tsv
new file mode 100644
index 000000000..0870abf80
--- /dev/null
+++ b/BaseStudy/resources/data/geographic_origins.tsv
@@ -0,0 +1,4 @@
+value
+Indian
+Chinese
+Hybrid
\ No newline at end of file
diff --git a/BaseStudy/resources/data/labwork_types.tsv b/BaseStudy/resources/data/labwork_types.tsv
new file mode 100644
index 000000000..20a065173
--- /dev/null
+++ b/BaseStudy/resources/data/labwork_types.tsv
@@ -0,0 +1,61 @@
+value title units sort_order category
+GLUC Glucose mg/dL 1 Chemistry
+BUN Blood urea nitrogen mg/dL 2 Chemistry
+CREAT Creatinine mg/dL 3 Chemistry
+CPK Creatine phosphokinase U/L 4 Chemistry
+CHOL Cholesterol mg/dl 5 Chemistry
+TRIG Triglyceride mg/dL 6 Chemistry
+SGOT Serum glutamic oxaloacetic transaminase IU/L 7 Chemistry
+LDL Low-Density Lipoprotein mg/dL 8 Chemistry
+LDH Lactate dehydrogenase IU/L 9 Chemistry
+TB Total Bilirubin mg/dL 10 Chemistry
+GGT Gamma-glutamyltransferase IU/L 11 Chemistry
+SGPT Serum glutamic pyruvic transaminase IU/L 12 Chemistry
+TP Total Protein g/dL 13 Chemistry
+ALB Albumin g/dL 14 Chemistry
+ALKP Alkaline Phosphatase IU/L 15 Chemistry
+CA Calcium mg/dL 16 Chemistry
+PHOS Phosphorus mg/dL 17 Chemistry
+FE Iron ?g/dL 18 Chemistry
+K Potassium mmol/L 20 Chemistry
+UA Uric Acid mg/dL 22 Chemistry
+A/P Albumin/Protein Ratio ratio 999 Chemistry
+B/C BUN/Creatinine Ratio ratio 999 Chemistry
+CL Chloride mEq/L 999 Chemistry
+FIBR Fibrinogen mg/dL 999 Chemistry
+HDL High-Density Lipoprotein mg/dL 999 Chemistry
+WBC White Blood Cells 10^3/uL 1 Hematology
+NEUT% Neutrophils % 2 Hematology
+BAND% Bands 3 Hematology
+LYMPH% Lymphocytes % 4 Hematology
+MONO% Monocytes % 5 Hematology
+EOS% Eosinophils % 6 Hematology
+BASO% Basophils % 7 Hematology
+HCT Hematocrit % 8 Hematology
+HGB Hemoglobin 9 Hematology
+RBC Red Blood Cells 10^6/uL 10 Hematology
+MCV Mean corpuscular volume fL 11 Hematology
+MCH Mean corpuscular hemoglobin picograms 12 Hematology
+MCHC Mean corpuscular hemoglobin concentration g/dL 13 Hematology
+RETIC Reticulocytes % 14 Hematology
+PLT Platelets 10^3/uL 15 Hematology
+MYELO Myelocytes % 999 Hematology
+MPV Mean platelet volume fl 999 Hematology
+Anisocytosis Anisocytosis 999 Hematology
+GLOB Globulin g/dL 999 Hematology
+Hypochromic RBC Hypochromic RBC 999 Hematology
+LUC Large unstained cells 999 Hematology
+Macrocytic RBC Macrocytic RBC 999 Hematology
+METAMYELO Metamyelocytes % 999 Hematology
+Microcytic RBC Microcytic RBC 999 Hematology
+NRBC Nucleated red blood cells 999 Hematology
+PCV Packed cell volume % 999 Hematology
+Polychromasia RBC Polychromasia RBC 999 Hematology
+MPMN Neutrophils 999 Hematology
+SEDRate Sedimentation rate 999 Hematology
+RDW % 999 Hematology
+NEUT# Neutrophil # 10^3/uL 16 Hematology
+LYMPH# Lymphocyte # 10^3/uL 17 Hematology
+MONO# Monocyte # 10^3/uL 18 Hematology
+EOS# Eosinophil # 10^3/uL 19 Hematology
+BASO# Basophil # 10^3/uL 20 Hematology
diff --git a/BaseStudy/resources/data/lookup_sets.tsv b/BaseStudy/resources/data/lookup_sets.tsv
new file mode 100644
index 000000000..d831d31b4
--- /dev/null
+++ b/BaseStudy/resources/data/lookup_sets.tsv
@@ -0,0 +1,11 @@
+setname label keyfield titleColumn
+amount_units Amount Units unit
+calculated_status_codes Calculated Status Codes code
+conc_units Concentraiton Units unit
+dosage_units Dosage Units unit
+gender_codes Gender Codes
+geographic_origins Geographic Origins origin
+routes Routes route
+volume_units Volume Units unit
+labwork_types Lab Tests test title
+vl_sample_types Lab Tests test
\ No newline at end of file
diff --git a/BaseStudy/resources/data/reports.tsv b/BaseStudy/resources/data/reports.tsv
new file mode 100644
index 000000000..c9ba1c207
--- /dev/null
+++ b/BaseStudy/resources/data/reports.tsv
@@ -0,0 +1,22 @@
+reporttype category schemaname queryname viewname reporttitle subjectfieldname
+query General study additionalDatatypes Additional Data
+query Clinical study weight Weights
+query Clinical study treatments Treatments/Medications
+query Clinical study chemistryPivot Blood Chemistry
+query Clinical study hematologyPivot CBC/Hematology
+query Study Design study assignment Project/Study Assignment
+query Research study flow Flow Cytometry
+query Research study outcomes Study Outcomes/Phenotypes
+query Research study pvl_outcomes Study PVL-Based Outcomes
+query Research study genetics Genetic Data / MHC
+query Clinical study procedures Procedures
+query Research study viralLoads Viral Loads
+query General study samples Samples
+query Research study immunizations Immunizations
+query General study flags Flags/Misc Information
+query General study demographics Demographics
+query General study demographics Project Summary Project Summary
+query General study demographics MHC Type MHC Typing
+query General study demographics Expanded Expanded Information
+query Study Design studies timepointToDate Timepoints subjectId
+query Study Design studies subjectAnchorDates Anchor Dates subjectId
diff --git a/BaseStudy/resources/data/routes.tsv b/BaseStudy/resources/data/routes.tsv
new file mode 100644
index 000000000..b0e1f0d80
--- /dev/null
+++ b/BaseStudy/resources/data/routes.tsv
@@ -0,0 +1,24 @@
+value title
+IM
+intracardiac
+intracarotid
+intracorneal Intracorneal
+intracranial
+IP intraperitoneal
+ID
+INH
+IT
+IV
+CRI
+IVAG
+oral
+PO
+rectal
+Spillage
+SQ
+OU
+OD
+OS
+topical
+topical (eye)
+topical (skin)
\ No newline at end of file
diff --git a/BaseStudy/resources/data/species.tsv b/BaseStudy/resources/data/species.tsv
new file mode 100644
index 000000000..c071b7272
--- /dev/null
+++ b/BaseStudy/resources/data/species.tsv
@@ -0,0 +1,10 @@
+common_name scientific_name id_prefix mhc_prefix blood_per_kg max_draw_pct blood_draw_interval cites_code dateDisabled
+Baboon 60 0.2 30
+Cotton-top Tamarin Saguinus oedipus so Saoe 60 0.2 30
+Cynomolgus Macaca fascicularis cy Mafa 60 0.2 30
+Marmoset Callithrix jacchus cj Caja 60 0.15 30
+Pigtail Macaca Nemestrina Mane 60 0.2 30
+Rhesus Macaca mulatta r|rh Mamu 60 0.2 30
+Sooty Mangabey Cercocebus atys Ceat 60 0.2 30
+Stump Tailed Macaca Arctoides Maar 60 0.2 30
+Vervet Chlorocebus sabaeus ag Chsa 60 0.2 30
diff --git a/BaseStudy/resources/data/vl_sample_types.tsv b/BaseStudy/resources/data/vl_sample_types.tsv
new file mode 100644
index 000000000..51943b0b3
--- /dev/null
+++ b/BaseStudy/resources/data/vl_sample_types.tsv
@@ -0,0 +1,3 @@
+value
+Plasma
+Cells
\ No newline at end of file
diff --git a/BaseStudy/resources/data/volume_units.tsv b/BaseStudy/resources/data/volume_units.tsv
new file mode 100644
index 000000000..fc2c76822
--- /dev/null
+++ b/BaseStudy/resources/data/volume_units.tsv
@@ -0,0 +1,13 @@
+value
+capsule(s)
+cup
+drop(s)
+cube
+mL
+mL/hr
+no units
+ounce(s)
+pan
+piece(s)
+tablet(s)
+tsp
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/laboratory/reports.js b/BaseStudy/resources/queries/laboratory/reports.js
new file mode 100644
index 000000000..c6f5589e9
--- /dev/null
+++ b/BaseStudy/resources/queries/laboratory/reports.js
@@ -0,0 +1,11 @@
+function afterInsert() {
+ org.labkey.api.laboratory.LaboratoryService.get().clearDataProviderCache();
+}
+
+function afterUpdate() {
+ org.labkey.api.laboratory.LaboratoryService.get().clearDataProviderCache();
+}
+
+function afterDelete() {
+ org.labkey.api.laboratory.LaboratoryService.get().clearDataProviderCache();
+}
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/additionalDatatypes.query.xml b/BaseStudy/resources/queries/study/additionalDatatypes.query.xml
new file mode 100644
index 000000000..7efac0999
--- /dev/null
+++ b/BaseStudy/resources/queries/study/additionalDatatypes.query.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Category
+
+
+ Accession #(s)
+
+ org.labkey.studies.query.AccessionsDisplayColumnFactory
+
+
+
+ Data Source
+
+
+ Description
+
+
+ Comments
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/assignment.query.xml b/BaseStudy/resources/queries/study/assignment.query.xml
new file mode 100644
index 000000000..f7e42cfd5
--- /dev/null
+++ b/BaseStudy/resources/queries/study/assignment.query.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+ Start Date
+ Date
+
+
+ End Date
+ Date
+
+
+ Study Name
+
+
+ Cohort ID
+
+ studies
+ studyCohorts
+ rowId
+ studyAndCohort
+
+
+
+
+ Sub-Group
+
+
+
+ Cohort Alias
+
+
+ Data Source
+
+
+ Category
+
+
+ Description
+ true
+
+
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/chemistryPivot.query.xml b/BaseStudy/resources/queries/study/chemistryPivot.query.xml
new file mode 100644
index 000000000..92c8a7384
--- /dev/null
+++ b/BaseStudy/resources/queries/study/chemistryPivot.query.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ Chemistry Results
+
+
+
+ http://cpas.labkey.com/Study#ParticipantId
+
+ study
+ animal
+ Id
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/chemistryPivot.sql b/BaseStudy/resources/queries/study/chemistryPivot.sql
new file mode 100644
index 000000000..139f2cb9e
--- /dev/null
+++ b/BaseStudy/resources/queries/study/chemistryPivot.sql
@@ -0,0 +1,24 @@
+SELECT
+ b.Id,
+ b.date,
+ b.method,
+ b.test,
+ group_concat(b.result) as result
+
+FROM (SELECT
+ b.Id,
+ b.date,
+ b.test,
+ b.method,
+ CASE
+ WHEN b.result IS NULL THEN b.qualresult
+ ELSE CAST(CAST(b.result AS float) AS VARCHAR)
+ END as result
+ FROM study.labwork b
+ WHERE b.test.category = 'Chemistry' AND b.test.sort_order != 999
+) b
+
+GROUP BY b.id, b.date, b.test, b.method
+PIVOT result BY test IN (select value from studies.labwork_types t WHERE t.sort_order != 999 AND t.category = 'Chemistry' order by sort_order)
+
+
diff --git a/BaseStudy/resources/queries/study/demographics.query.xml b/BaseStudy/resources/queries/study/demographics.query.xml
new file mode 100644
index 000000000..2a019cc9f
--- /dev/null
+++ b/BaseStudy/resources/queries/study/demographics.query.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+ f
+
+
+
+
+ true
+
+
+ true
+ false
+
+
+ Date
+ Birth
+ /query/executeQuery.view?
+ schemaName=study&
+ query.queryName=Birth&
+ query.Id~eq=${Id}
+
+
+
+ Date
+ Death
+ /query/executeQuery.view?
+ schemaName=study&
+ query.queryName=Deaths&
+ query.Id~eq=${Id}
+
+
+
+ true
+ true
+ false
+
+
+ Sex
+
+
+ Geographic Origin
+
+
+ Birth
+
+
+ Death
+
+
+ Species
+
+
+ Mother/Dam
+
+
+ Father/Sire
+
+
+ Status
+
+
+ Data Source
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/demographicsImmunizations.query.xml b/BaseStudy/resources/queries/study/demographicsImmunizations.query.xml
new file mode 100644
index 000000000..bd3587c51
--- /dev/null
+++ b/BaseStudy/resources/queries/study/demographicsImmunizations.query.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ Immunization Summary
+
+
+ true
+ true
+
+
+ Immunizations
+ /query/executeQuery.view?schemaName=study&query.queryName=immunizations&query.Id~eq=${Id}
+ _blank
+
+
+ Immunization Types
+ /query/executeQuery.view?schemaName=study&query.queryName=immunizations&query.Id~eq=${Id}
+ _blank
+
+
+ immunizations
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/demographicsImmunizations.sql b/BaseStudy/resources/queries/study/demographicsImmunizations.sql
new file mode 100644
index 000000000..4f28d89b5
--- /dev/null
+++ b/BaseStudy/resources/queries/study/demographicsImmunizations.sql
@@ -0,0 +1,7 @@
+SELECT
+ s.Id,
+ group_concat(DISTINCT COALESCE(s.backbone, s.treatment), char(10)) as immunizations,
+ group_concat(DISTINCT s.category, char(10)) as immunizationTypes,
+
+FROM study.immunizations s
+GROUP BY s.Id
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/demographicsMHC.query.xml b/BaseStudy/resources/queries/study/demographicsMHC.query.xml
new file mode 100644
index 000000000..e07992b49
--- /dev/null
+++ b/BaseStudy/resources/queries/study/demographicsMHC.query.xml
@@ -0,0 +1,31 @@
+
+
+
+
+ MHC Genotype
+
+
+ true
+ true
+
+
+ All MHC Alleles
+
+
+ Mamu-A01
+
+
+ Mamu-A02
+
+
+ Mamu-B08
+
+
+ Mamu-B17
+
+
+ allAlleles
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/demographicsMHC.sql b/BaseStudy/resources/queries/study/demographicsMHC.sql
new file mode 100644
index 000000000..45f842b4a
--- /dev/null
+++ b/BaseStudy/resources/queries/study/demographicsMHC.sql
@@ -0,0 +1,29 @@
+SELECT
+ s.Id,
+ count(s.Id) as totalTests,
+ group_concat(DISTINCT s.assayType) as assayTypes,
+
+ --special case A01/B17/B08
+ max(CASE
+ WHEN (s.marker = 'Mamu-A1*001g' AND (s.result = 'POS' OR s.result = 'NEG')) THEN s.result
+ ELSE null
+ END) as A01,
+
+ max(CASE
+ WHEN (s.marker = 'Mamu-A1*002g' AND (s.result = 'POS' OR s.result = 'NEG')) THEN s.result
+ ELSE null
+ END) as A02,
+
+ max(CASE
+ WHEN (s.marker = 'Mamu-B*008g' AND (s.result = 'POS' OR s.result = 'NEG')) THEN s.result
+ ELSE ''
+ END) as B08,
+
+ max(CASE
+ WHEN (s.marker = 'Mamu-B*017g' AND (s.result = 'POS' OR s.result = 'NEG')) THEN s.result
+ ELSE ''
+ END) as B17,
+ GROUP_CONCAT(distinct CASE WHEN s.result = 'POS' THEN s.marker ELSE null END, char(10)) as allAlleles
+FROM study.genetics s
+WHERE s.category = 'MHC Typing'
+GROUP BY s.Id
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/demographicsOutcomes.query.xml b/BaseStudy/resources/queries/study/demographicsOutcomes.query.xml
new file mode 100644
index 000000000..22acc4fac
--- /dev/null
+++ b/BaseStudy/resources/queries/study/demographicsOutcomes.query.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ Outcome Summary
+
+
+ true
+ true
+
+
+ Outcomes
+
+
+ outcomes
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/demographicsOutcomes.sql b/BaseStudy/resources/queries/study/demographicsOutcomes.sql
new file mode 100644
index 000000000..22ffd948f
--- /dev/null
+++ b/BaseStudy/resources/queries/study/demographicsOutcomes.sql
@@ -0,0 +1,6 @@
+SELECT
+ s.Id,
+ group_concat(DISTINCT s.outcome, char(10)) as outcomes
+
+FROM study.outcomes s
+GROUP BY s.Id
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/demographicsProjects.query.xml b/BaseStudy/resources/queries/study/demographicsProjects.query.xml
new file mode 100644
index 000000000..11e8665c4
--- /dev/null
+++ b/BaseStudy/resources/queries/study/demographicsProjects.query.xml
@@ -0,0 +1,34 @@
+
+
+
+
+ Project Summary
+
+
+ true
+ true
+
+
+ Study Categories
+
+
+ Studies
+ /query/executeQuery.view?schemaName=study&query.queryName=assignment&query.Id~eq=${Id}
+ _blank
+
+
+ Studies and Analyses
+
+
+ Analysis Groups
+ 150
+
+
+ Subgroups/Treatments
+
+
+ categories
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/demographicsProjects.sql b/BaseStudy/resources/queries/study/demographicsProjects.sql
new file mode 100644
index 000000000..b54d15915
--- /dev/null
+++ b/BaseStudy/resources/queries/study/demographicsProjects.sql
@@ -0,0 +1,12 @@
+SELECT
+ s.Id,
+ count(s.Id) as totalProjects,
+ group_concat(DISTINCT s.study, char(10)) as allStudiesAndAnalyses,
+ group_concat(DISTINCT CASE WHEN s.category = 'Analysis Cohorts' THEN NULL ELSE s.study END, char(10)) as allStudies,
+ group_concat(DISTINCT CASE WHEN s.category = 'Analysis Cohorts' THEN s.study ELSE NULL END, char(10)) as analysisGroups,
+ group_concat(DISTINCT s.cohortId.studyId.description, char(10)) as studyDescription,
+ group_concat(DISTINCT s.category, char(10)) as categories,
+ group_concat(DISTINCT s.subgroup, char(10)) as subgroups
+
+FROM study.assignment s
+GROUP BY s.Id
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/flags.query.xml b/BaseStudy/resources/queries/study/flags.query.xml
new file mode 100644
index 000000000..23071f2b8
--- /dev/null
+++ b/BaseStudy/resources/queries/study/flags.query.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+ Start Date
+ Date
+
+
+ End Date
+ Date
+
+
+ Flag
+
+
+ Data Source
+
+
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/flow.query.xml b/BaseStudy/resources/queries/study/flow.query.xml
new file mode 100644
index 000000000..3ca630fea
--- /dev/null
+++ b/BaseStudy/resources/queries/study/flow.query.xml
@@ -0,0 +1,46 @@
+
+
+
+
+ Flow Cytometry
+
+
+
+ Start Date
+ Date
+
+
+ Tissue
+
+
+ Sample Type
+
+
+ Assay Type
+
+
+ Population
+
+
+ Parent Population
+
+
+ % of Parent
+
+
+ Absolute Count
+
+
+ Units
+
+
+ Comments
+
+
+ Data Source
+
+
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/genetics.query.xml b/BaseStudy/resources/queries/study/genetics.query.xml
new file mode 100644
index 000000000..07774ea71
--- /dev/null
+++ b/BaseStudy/resources/queries/study/genetics.query.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+ Date
+ Date
+
+
+ Category
+
+
+ Assay Type
+
+
+ Library Type
+
+
+ Marker/Allele
+
+
+ Result
+
+
+ Score
+
+
+ Comments
+ textarea
+
+
+ Data Source
+
+
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/genomicsDataSource.sql b/BaseStudy/resources/queries/study/genomicsDataSource.sql
new file mode 100644
index 000000000..38d6b4454
--- /dev/null
+++ b/BaseStudy/resources/queries/study/genomicsDataSource.sql
@@ -0,0 +1,16 @@
+SELECT
+
+s1.subjectId as Id,
+s1.date,
+
+('Assay(s): ' || application) as description,
+'ONPRC Genetics Core' as dataSource
+
+FROM (SELECT
+ s.subjectId,
+ coalesce(s.sampleDate, now()) as date,
+ GROUP_CONCAT(DISTINCT s.application, ', ') as application
+
+ FROM "/Internal/ColonyData".sequenceanalysis.sequence_readsets s
+ GROUP BY s.subjectId, s.sampleDate
+) s1
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/hematologyPivot.query.xml b/BaseStudy/resources/queries/study/hematologyPivot.query.xml
new file mode 100644
index 000000000..92d4b22f6
--- /dev/null
+++ b/BaseStudy/resources/queries/study/hematologyPivot.query.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ Hematology Results
+
+
+
+ http://cpas.labkey.com/Study#ParticipantId
+
+ study
+ animal
+ Id
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/hematologyPivot.sql b/BaseStudy/resources/queries/study/hematologyPivot.sql
new file mode 100644
index 000000000..c15d59969
--- /dev/null
+++ b/BaseStudy/resources/queries/study/hematologyPivot.sql
@@ -0,0 +1,24 @@
+SELECT
+ b.Id,
+ b.date,
+ b.method,
+ b.test,
+ group_concat(b.result) as result
+
+FROM (SELECT
+ b.Id,
+ b.date,
+ b.test,
+ b.method,
+ CASE
+ WHEN b.result IS NULL THEN b.qualresult
+ ELSE CAST(CAST(b.result AS float) AS VARCHAR)
+ END as result
+ FROM study.labwork b
+ WHERE b.test.category = 'Hematology' AND b.test.sort_order != 999
+) b
+
+GROUP BY b.id, b.date, b.test, b.method
+PIVOT result BY test IN (select value from studies.labwork_types t WHERE t.sort_order != 999 AND t.category = 'Hematology' order by sort_order)
+
+
diff --git a/BaseStudy/resources/queries/study/immunizations.query.xml b/BaseStudy/resources/queries/study/immunizations.query.xml
new file mode 100644
index 000000000..2fc7f169d
--- /dev/null
+++ b/BaseStudy/resources/queries/study/immunizations.query.xml
@@ -0,0 +1,53 @@
+
+
+
+
+ Immunizations/Vaccinations
+
+
+
+ Date
+ Date
+
+
+ Category
+
+
+ Treatment
+
+
+ Vector Backbone
+
+
+ Antigens
+
+
+ Route
+
+
+ Quantity
+
+
+ Quantity Units
+
+
+ Reason
+
+
+ Vector ID
+
+
+ Is Mock?
+
+
+ Comments
+ textarea
+
+
+ Data Source
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/labwork.query.xml b/BaseStudy/resources/queries/study/labwork.query.xml
new file mode 100644
index 000000000..1cb7b4022
--- /dev/null
+++ b/BaseStudy/resources/queries/study/labwork.query.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+ Date
+ Date
+
+
+ Category
+
+
+ Test
+
+ studies
+ labwork_types
+ value
+
+
+
+
+ Result
+
+
+ Units
+
+
+ Qualitative Result
+ true
+ false
+
+
+ Method
+
+
+ Comments
+ textarea
+
+
+ Data Source
+
+
+ Result OOR Indicator
+ true
+
+
+ true
+
+
+ Result In Range?
+ true
+
+
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/outcomes.query.xml b/BaseStudy/resources/queries/study/outcomes.query.xml
new file mode 100644
index 000000000..59e38fcac
--- /dev/null
+++ b/BaseStudy/resources/queries/study/outcomes.query.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+ Date
+ Date
+
+
+ Outcome/Phenotype
+
+
+ Sub-Outcome
+
+
+ Comments
+
+
+ Data Source
+
+
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/procedures.query.xml b/BaseStudy/resources/queries/study/procedures.query.xml
new file mode 100644
index 000000000..1f5446fe1
--- /dev/null
+++ b/BaseStudy/resources/queries/study/procedures.query.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Category
+
+
+ Procedure
+
+
+ Comments
+ textarea
+
+
+ Data Source
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/samples.query.xml b/BaseStudy/resources/queries/study/samples.query.xml
new file mode 100644
index 000000000..3d5fc433c
--- /dev/null
+++ b/BaseStudy/resources/queries/study/samples.query.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+ Date
+ Date
+
+
+ Sample ID
+
+
+ Sample Type
+
+
+ Preservation
+
+
+ Quantity
+
+
+ Quantity Units
+
+
+ Freezer
+
+
+ Rack
+
+
+ Box
+
+
+ Position
+
+
+ Comments
+ textarea
+
+
+ Data Source
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/scRNAseqDataSource.sql b/BaseStudy/resources/queries/study/scRNAseqDataSource.sql
new file mode 100644
index 000000000..2517b709b
--- /dev/null
+++ b/BaseStudy/resources/queries/study/scRNAseqDataSource.sql
@@ -0,0 +1,20 @@
+SELECT
+
+s1.subjectId as Id,
+s1.date,
+
+('Assay(s): ' || assayType || char(10) ||
+'Tissue(s): ' || tissue || char(10) ||
+'Stims(s): ' || stims || char(10)) as description,
+'Bimber Lab' as dataSource
+
+FROM (SELECT
+ s.subjectId,
+ s.sampleDate as date,
+ GROUP_CONCAT(DISTINCT s.tissue, ', ') as tissue,
+ GROUP_CONCAT(DISTINCT s.assayType, ', ') as assayType,
+ GROUP_CONCAT(DISTINCT s.stim, ', ') as stims
+
+ FROM "/Labs/Bimber".singlecell.samples s
+ GROUP BY s.subjectId, s.sampleDate
+) s1
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/studyData.query.xml b/BaseStudy/resources/queries/study/studyData.query.xml
new file mode 100644
index 000000000..ab97c463c
--- /dev/null
+++ b/BaseStudy/resources/queries/study/studyData.query.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+ http://cpas.labkey.com/Study#ParticipantId
+ laboratory/dataBrowser.view?subjectId=${Id}
+ ALWAYS_OFF
+
+
+ Date
+
+
+ End Date
+
+
+ Key
+ true
+ true
+ false
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+
+ -
+ Filter
+
+ -
+ Groups
+
+ -
+ Manage
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/queries/study/treatments.query.xml b/BaseStudy/resources/queries/study/treatments.query.xml
new file mode 100644
index 000000000..b053767c0
--- /dev/null
+++ b/BaseStudy/resources/queries/study/treatments.query.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+ Date
+ Date
+
+
+ End Date
+ Date
+
+
+ Category
+
+
+ Treatment
+
+
+ Route
+
+
+ Frequency
+
+
+ Amount
+
+
+ Amount Units
+
+
+ Volume
+ true
+ false
+
+
+ Volume Units
+ true
+ false
+
+
+ Concentration
+ true
+ false
+
+
+ Conc. Units
+ true
+ false
+
+
+ Dosage
+ true
+ false
+
+
+ Dosage Units
+ true
+ false
+
+
+ Reason
+ true
+ false
+
+
+ Comments
+ textarea
+
+
+ Data Source
+
+
+
+
+
+
diff --git a/BaseStudy/resources/queries/study/weight.query.xml b/BaseStudy/resources/queries/study/weight.query.xml
new file mode 100644
index 000000000..4550e2556
--- /dev/null
+++ b/BaseStudy/resources/queries/study/weight.query.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+ true
+
+
+ Weight (kg)
+ 0.####
+
+
+ Data Source
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/referenceStudy/folder.xml b/BaseStudy/resources/referenceStudy/folder.xml
new file mode 100644
index 000000000..e3acbb155
--- /dev/null
+++ b/BaseStudy/resources/referenceStudy/folder.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/referenceStudy/study/datasets/Studies.dataset b/BaseStudy/resources/referenceStudy/study/datasets/Studies.dataset
new file mode 100644
index 000000000..8e5970288
--- /dev/null
+++ b/BaseStudy/resources/referenceStudy/study/datasets/Studies.dataset
@@ -0,0 +1,19 @@
+# default group can be used to avoid repeating definitions for each dataset
+#
+# action=[REPLACE,APPEND,DELETE] (default:REPLACE)
+# deleteAfterImport=[TRUE|FALSE] (default:FALSE)
+
+default.action=REPLACE
+default.deleteAfterImport=FALSE
+
+# map a source tsv column (right side) to a property name or full propertyURI (left)
+# predefined properties: ParticipantId, SiteId, VisitId, Created
+default.property.ParticipantId=ptid
+default.property.Created=dfcreate
+
+# use to map from filename->datasetid
+# NOTE: if there are NO explicit import definitions, we will try to import all files matching pattern
+# NOTE: if there are ANY explicit mapping, we will only import listed datasets
+
+default.filePattern=dataset(\\d*).tsv
+default.importAllMatches=TRUE
diff --git a/BaseStudy/resources/referenceStudy/study/datasets/datasets_manifest.xml b/BaseStudy/resources/referenceStudy/study/datasets/datasets_manifest.xml
new file mode 100644
index 000000000..12d37227d
--- /dev/null
+++ b/BaseStudy/resources/referenceStudy/study/datasets/datasets_manifest.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BaseStudy/resources/referenceStudy/study/datasets/datasets_metadata.xml b/BaseStudy/resources/referenceStudy/study/datasets/datasets_metadata.xml
new file mode 100644
index 000000000..259df5f6b
--- /dev/null
+++ b/BaseStudy/resources/referenceStudy/study/datasets/datasets_metadata.xml
@@ -0,0 +1,626 @@
+
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+
+ timestamp
+
+
+ varchar
+
+
+ Flags/Misc Information
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+
+ timestamp
+
+
+ varchar
+
+
+ varchar
+
+
+ double
+
+
+ varchar
+
+
+ double
+
+
+ varchar
+
+
+ double
+
+
+ varchar
+
+
+ varchar
+
+
+ integer
+
+
+ double
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ Medications/Treatments
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ double
+
+
+ varchar
+
+
+ varchar
+
+
+ boolean
+
+
+ integer
+
+
+ varchar
+
+
+ Immunizations
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+
+ double
+
+
+ Weight
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ double
+
+
+ double
+
+
+ varchar
+ true
+
+ org.labkey.api.studies.query.ResultsOORDisplayColumn
+
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ Viral Loads
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ double
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ Lab Results
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ false
+
+
+
+ varchar
+
+
+ varchar
+
+
+ timestamp
+
+
+ timestamp
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ Demographics
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+
+ timestamp
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ integer
+
+
+ varchar
+
+
+ Project Assignment
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ double
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ Samples
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ double
+
+
+ varchar
+
+
+ Genetic Data
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ Procedures
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ Additional Datatypes
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ double
+
+
+ double
+
+
+ varchar
+
+
+ varchar
+
+
+ Flow Cytometry
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+ varchar
+
+
+ varchar
+
+
+ varchar
+
+
+ Outcomes/Phenotypes
+
+
+
+
+ varchar
+ http://cpas.labkey.com/Study#ParticipantId
+
+
+ timestamp
+ http://cpas.labkey.com/laboratory#sampleDate
+
+
+ timestamp
+
+
+ varchar
+
+
+ entityid
+ true
+
+
+ varchar
+
+
+ double
+
+
+ varchar
+
+
+ integer
+
+
+ varchar
+
+
+ PVL Outcomes
+
+
diff --git a/BaseStudy/resources/referenceStudy/study/study.xml b/BaseStudy/resources/referenceStudy/study/study.xml
new file mode 100644
index 000000000..0acc6d7dc
--- /dev/null
+++ b/BaseStudy/resources/referenceStudy/study/study.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/BaseStudy/resources/referenceStudy/study/studyPolicy.xml b/BaseStudy/resources/referenceStudy/study/studyPolicy.xml
new file mode 100644
index 000000000..3755d25b8
--- /dev/null
+++ b/BaseStudy/resources/referenceStudy/study/studyPolicy.xml
@@ -0,0 +1,10 @@
+
+
+ BASIC_WRITE
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/schemas/basestudy.xml b/BaseStudy/resources/schemas/basestudy.xml
new file mode 100644
index 000000000..6bd9f222b
--- /dev/null
+++ b/BaseStudy/resources/schemas/basestudy.xml
@@ -0,0 +1,20 @@
+
+
+
\ No newline at end of file
diff --git a/BaseStudy/resources/schemas/dbscripts/postgresql/basestudy-26.000-26.001.sql b/BaseStudy/resources/schemas/dbscripts/postgresql/basestudy-26.000-26.001.sql
new file mode 100644
index 000000000..a06573945
--- /dev/null
+++ b/BaseStudy/resources/schemas/dbscripts/postgresql/basestudy-26.000-26.001.sql
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2026 LabKey Corporation
+ *
+ * Licensed 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.
+ */
+
+-- Create schema, tables, indexes, and constraints used for BaseStudy module here
+-- All SQL VIEW definitions should be created in basestudy-create.sql and dropped in basestudy-drop.sql
+CREATE SCHEMA basestudy;
diff --git a/BaseStudy/src/org/labkey/basestudy/BaseStudyController.java b/BaseStudy/src/org/labkey/basestudy/BaseStudyController.java
new file mode 100644
index 000000000..ac889ebcb
--- /dev/null
+++ b/BaseStudy/src/org/labkey/basestudy/BaseStudyController.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2026 LabKey Corporation
+ *
+ * Licensed 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.labkey.basestudy;
+
+import org.labkey.api.action.SimpleViewAction;
+import org.labkey.api.action.SpringActionController;
+import org.labkey.api.security.RequiresPermission;
+import org.labkey.api.security.permissions.ReadPermission;
+import org.labkey.api.view.JspView;
+import org.labkey.api.view.NavTree;
+import org.springframework.validation.BindException;
+import org.springframework.web.servlet.ModelAndView;
+
+public class BaseStudyController extends SpringActionController
+{
+ private static final DefaultActionResolver _actionResolver = new DefaultActionResolver(BaseStudyController.class);
+ public static final String NAME = "basestudy";
+
+ public BaseStudyController()
+ {
+ setActionResolver(_actionResolver);
+ }
+}
diff --git a/BaseStudy/src/org/labkey/basestudy/BaseStudyManager.java b/BaseStudy/src/org/labkey/basestudy/BaseStudyManager.java
new file mode 100644
index 000000000..9169e3e77
--- /dev/null
+++ b/BaseStudy/src/org/labkey/basestudy/BaseStudyManager.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2026 LabKey Corporation
+ *
+ * Licensed 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.labkey.basestudy;
+
+public class BaseStudyManager
+{
+ private static final BaseStudyManager _instance = new BaseStudyManager();
+
+ private BaseStudyManager()
+ {
+ // prevent external construction with a private default constructor
+ }
+
+ public static BaseStudyManager get()
+ {
+ return _instance;
+ }
+}
\ No newline at end of file
diff --git a/BaseStudy/src/org/labkey/basestudy/BaseStudyModule.java b/BaseStudy/src/org/labkey/basestudy/BaseStudyModule.java
new file mode 100644
index 000000000..ae9040bac
--- /dev/null
+++ b/BaseStudy/src/org/labkey/basestudy/BaseStudyModule.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2026 LabKey Corporation
+ *
+ * Licensed 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.labkey.basestudy;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.labkey.api.data.Container;
+import org.labkey.api.data.ContainerManager;
+import org.labkey.api.module.DefaultModule;
+import org.labkey.api.module.ModuleContext;
+import org.labkey.api.view.WebPartFactory;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+public class BaseStudyModule extends DefaultModule
+{
+ public static final String NAME = "BaseStudy";
+
+ @Override
+ public String getName()
+ {
+ return NAME;
+ }
+
+ @Override
+ public @Nullable Double getSchemaVersion()
+ {
+ return 26.001;
+ }
+
+ @Override
+ public boolean hasScripts()
+ {
+ return true;
+ }
+
+ @Override
+ @NotNull
+ protected Collection createWebPartFactories()
+ {
+ return Collections.emptyList();
+ }
+
+ @Override
+ protected void init()
+ {
+ addController(BaseStudyController.NAME, BaseStudyController.class);
+ }
+
+ @Override
+ public void doStartup(ModuleContext moduleContext)
+ {
+ }
+
+ @Override
+ @NotNull
+ public Collection getSummary(Container c)
+ {
+ return Collections.emptyList();
+ }
+
+ @Override
+ @NotNull
+ public Set getSchemaNames()
+ {
+ return Collections.singleton(BaseStudySchema.NAME);
+ }
+}
\ No newline at end of file
diff --git a/BaseStudy/src/org/labkey/basestudy/BaseStudySchema.java b/BaseStudy/src/org/labkey/basestudy/BaseStudySchema.java
new file mode 100644
index 000000000..fed023cb4
--- /dev/null
+++ b/BaseStudy/src/org/labkey/basestudy/BaseStudySchema.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2026 LabKey Corporation
+ *
+ * Licensed 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.labkey.basestudy;
+
+import org.labkey.api.data.DbSchema;
+import org.labkey.api.data.DbSchemaType;
+import org.labkey.api.data.dialect.SqlDialect;
+
+public class BaseStudySchema
+{
+ private static final BaseStudySchema _instance = new BaseStudySchema();
+ public static final String NAME = "basestudy";
+
+ public static BaseStudySchema getInstance()
+ {
+ return _instance;
+ }
+
+ private BaseStudySchema()
+ {
+ // private constructor to prevent instantiation from
+ // outside this class: this singleton should only be
+ // accessed via org.labkey.basestudy.BaseStudySchema.getInstance()
+ }
+
+ public DbSchema getSchema()
+ {
+ return DbSchema.get(NAME, DbSchemaType.Module);
+ }
+
+ public SqlDialect getSqlDialect()
+ {
+ return getSchema().getSqlDialect();
+ }
+}
diff --git a/SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/run/DockerWrapper.java b/SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/run/DockerWrapper.java
index b8d56b90a..c7b3997dc 100644
--- a/SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/run/DockerWrapper.java
+++ b/SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/run/DockerWrapper.java
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
public class DockerWrapper extends AbstractCommandWrapper
@@ -33,6 +34,7 @@ public class DockerWrapper extends AbstractCommandWrapper
private String _entryPoint = null;
private boolean _runPrune = false;
private boolean _useLocalContainerStorage;
+ private boolean _enforceMaxCpus = false;
private String _alternateUserHome = null;
private final Map _dockerEnvironment = new HashMap<>();
private int _maxRetries = 3;
@@ -78,8 +80,8 @@ public void executeWithDocker(List containerArgs, File workDir, Pipeline
public void executeWithDocker(List containerArgs, File workDir, PipelineOutputTracker tracker, @Nullable Collection inputFiles) throws PipelineJobException
{
- File localBashScript = new File(workDir, "docker.sh");
- File dockerBashScript = new File(workDir, "dockerRun.sh");
+ File localBashScript = FileUtil.appendName(workDir, "docker.sh");
+ File dockerBashScript = FileUtil.appendName(workDir, "dockerRun.sh");
tracker.addIntermediateFile(localBashScript);
tracker.addIntermediateFile(dockerBashScript);
@@ -177,6 +179,12 @@ public void executeWithDocker(List containerArgs, File workDir, Pipeline
writer.println("\t--memory='" + maxRam + "g' \\");
}
+ Integer maxCores = SequencePipelineService.get().getMaxThreads(getLogger());
+ if (_enforceMaxCpus && maxCores != null)
+ {
+ writer.println("\t--cpus='" + maxCores + "' \\");
+ }
+
for (String key : _dockerEnvironment.keySet())
{
writer.println("\t-e " + key + "='" + _dockerEnvironment.get(key) + "' \\");
@@ -251,10 +259,11 @@ private void executeWithRetry(final List args) throws PipelineJobExcepti
throw e;
}
- getLogger().info("Exit code " + getLastReturnCode() + ", retrying after 1 sec (" + retries + " of " + getMaxRetries()+ ")");
+ final long randomNum = ThreadLocalRandom.current().nextInt(2, 11);
+ getLogger().info("Exit code " + getLastReturnCode() + ", retrying after " + randomNum + " sec(s) (" + retries + " of " + getMaxRetries()+ ")");
try
{
- Thread.sleep(1000);
+ Thread.sleep(1000 * randomNum);
}
catch (InterruptedException ex)
{
@@ -340,4 +349,9 @@ private String getLocalStorageArgs()
return "--root=" + getLocalContainerDir().getPath() + " ";
}
+
+ public void setEnforceMaxCpus(boolean enforceMaxCpus)
+ {
+ _enforceMaxCpus = enforceMaxCpus;
+ }
}
diff --git a/SequenceAnalysis/resources/queries/sequenceanalysis/barcodes.js b/SequenceAnalysis/resources/queries/sequenceanalysis/barcodes.js
index 6cb13095a..965508993 100644
--- a/SequenceAnalysis/resources/queries/sequenceanalysis/barcodes.js
+++ b/SequenceAnalysis/resources/queries/sequenceanalysis/barcodes.js
@@ -17,4 +17,12 @@ function beforeInsert(row, errors) {
function beforeUpdate(row, oldRow, errors) {
beforeUpsert(row, errors);
+}
+
+function managedColumns() {
+ const theColumns = ['reverse_complement']
+ return {
+ update: theColumns,
+ insert: theColumns
+ }
}
\ No newline at end of file
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java
index 8338f7c35..82ac01298 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java
@@ -149,6 +149,7 @@
import org.labkey.sequenceanalysis.run.preprocessing.CutadaptCropWrapper;
import org.labkey.sequenceanalysis.run.preprocessing.CutadaptWrapper;
import org.labkey.sequenceanalysis.run.preprocessing.DownsampleFastqWrapper;
+import org.labkey.sequenceanalysis.run.preprocessing.FastpStep;
import org.labkey.sequenceanalysis.run.preprocessing.FastqcProcessingStep;
import org.labkey.sequenceanalysis.run.preprocessing.FilterReadsStep;
import org.labkey.sequenceanalysis.run.preprocessing.FlashPipelineStep;
@@ -278,6 +279,7 @@ public static void registerPipelineSteps()
//preprocessing
SequencePipelineService.get().registerPipelineStep(new DownsampleFastqWrapper.Provider());
+ SequencePipelineService.get().registerPipelineStep(new FastpStep.Provider());
SequencePipelineService.get().registerPipelineStep(new TrimmomaticWrapper.ReadLengthFilterProvider());
SequencePipelineService.get().registerPipelineStep(new TrimmomaticWrapper.SlidingWindowTrimmingProvider());
SequencePipelineService.get().registerPipelineStep(new TrimmomaticWrapper.CropReadsProvider());
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/DeepVariantHandler.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/DeepVariantHandler.java
index 04d2c919e..cb02b0995 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/DeepVariantHandler.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/DeepVariantHandler.java
@@ -125,7 +125,8 @@ public void processFilesRemote(List inputFiles, JobContext c
}
boolean retainVcf = ctx.getParams().optBoolean("retainVcf", false);
- wrapper.execute(so.getFile(), referenceGenome.getWorkingFastaFile(), outputFile, retainVcf, ctx.getFileManager(), binVersion, args, ctx);
+ int cpuBuffer = ctx.getParams().optInt("cpuBuffer", 0);
+ wrapper.execute(so.getFile(), referenceGenome.getWorkingFastaFile(), outputFile, retainVcf, ctx.getFileManager(), binVersion, args, ctx, cpuBuffer);
action.addOutput(outputFile, "gVCF File", false);
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java
index c9b05c323..be404e01e 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java
@@ -325,7 +325,7 @@ private Map> performFastqPreprocessing(SequenceReadse
RecordedAction copyAction = new RecordedAction(COPY_INPUTS_ACTIONNAME);
preprocessingActions.add(copyAction);
- File target = new File(getHelper().getWorkingDirectory(), pair.first.getName());
+ File target = FileUtil.appendName(getHelper().getWorkingDirectory(), pair.first.getName());
target = _wd.inputFile(pair.first, target, false);
copiedInputs.put(pair.first, target);
@@ -335,7 +335,7 @@ private Map> performFastqPreprocessing(SequenceReadse
if (pair.second != null)
{
- File target2 = new File(getHelper().getWorkingDirectory(), pair.second.getName());
+ File target2 = FileUtil.appendName(getHelper().getWorkingDirectory(), pair.second.getName());
target2 = _wd.inputFile(pair.second, target2, false);
copiedInputs.put(pair.second, target2);
getHelper().getFileManager().addInput(copyAction, "Input FASTQ", pair.second);
@@ -426,7 +426,7 @@ private void copyReferenceResources() throws PipelineJobException
//check client-supplied params
String val = getJob().getParameters().get(AlignerIndexUtil.COPY_LOCALLY);
- boolean doCopy = val == null || ConvertHelper.convert(val, Boolean.class);
+ boolean doCopy = val == null || Boolean.TRUE.equals(ConvertHelper.convert(val, Boolean.class));
//but let aligners override this.
AlignmentStep alignmentStep = getHelper().getSingleStep(AlignmentStep.class).create(getHelper());
@@ -447,13 +447,13 @@ else if (doCopy)
action.setStartTime(start);
String basename = FileUtil.getBaseName(refFasta);
- File targetDir = new File(_wd.getDir().toNioPathForRead().toFile(), "Shared");
+ File targetDir = FileUtil.appendName(_wd.getDir().toNioPathForRead().toFile(), "Shared");
for (File f : refFasta.getParentFile().listFiles())
{
if (f.getName().startsWith(basename))
{
getJob().getLogger().debug("copying reference file: " + f.getPath());
- File movedFile = _wd.inputFile(f, new File(targetDir, f.getName()), true);
+ File movedFile = _wd.inputFile(f, FileUtil.appendName(targetDir, f.getName()), true);
copiedInputs.put(f, movedFile);
action.addInputIfNotPresent(f, "Reference File");
action.addOutputIfNotPresent(movedFile, "Copied Reference File", true);
@@ -465,7 +465,7 @@ else if (doCopy)
getJob().getLogger().info("Copy Reference Duration: " + DurationFormatUtils.formatDurationWords(end.getTime() - start.getTime(), true, true));
actions.add(action);
- referenceGenome.setWorkingFasta(new File(targetDir, refFasta.getName()));
+ referenceGenome.setWorkingFasta(FileUtil.appendName(targetDir, refFasta.getName()));
getTaskFileManagerImpl().addIntermediateFile(targetDir);
}
@@ -560,8 +560,8 @@ public Pair preprocessFastq(File inputFile1, @Nullable File inputFil
}
}
- File outputDir = new File(getHelper().getWorkingDirectory(), originalbaseName);
- outputDir = new File(outputDir, SequenceTaskHelper.PREPROCESSING_SUBFOLDER_NAME);
+ File outputDir = FileUtil.appendName(getHelper().getWorkingDirectory(), originalbaseName);
+ outputDir = FileUtil.appendName(outputDir, SequenceTaskHelper.PREPROCESSING_SUBFOLDER_NAME);
if (!outputDir.exists())
{
getJob().getLogger().debug("creating output directory: " + outputDir.getPath());
@@ -628,7 +628,7 @@ else if (pair.first.equals(pair.second))
RecordedAction action = new RecordedAction(NORMALIZE_FILENAMES_ACTION);
Date start = new Date();
action.setStartTime(start);
- File renamed1 = new File(pair.first.getParentFile(), originalbaseName + ".preprocessed" + extension);
+ File renamed1 = FileUtil.appendName(pair.first.getParentFile(), originalbaseName + ".preprocessed" + extension);
if (renamed1.exists())
{
getJob().getLogger().debug("deleting existing file prior to rename: " + renamed1.getName());
@@ -644,7 +644,7 @@ else if (pair.first.equals(pair.second))
if (pair.second != null)
{
- File renamed2 = new File(pair.second.getParentFile(), originalbaseName2 + ".preprocessed" + extension);
+ File renamed2 = FileUtil.appendName(pair.second.getParentFile(), originalbaseName2 + ".preprocessed" + extension);
if (renamed2.exists())
{
getJob().getLogger().debug("deleting existing file prior to rename: " + renamed2.getName());
@@ -876,7 +876,7 @@ else if (step.expectToCreateNewBam())
Date start = new Date();
renameAction.setStartTime(start);
getHelper().getFileManager().addInput(renameAction, "Input BAM", bam);
- renamedBam = new File(bam.getParentFile(), basename + ".bam");
+ renamedBam = FileUtil.appendName(bam.getParentFile(), basename + ".bam");
if (!renamedBam.getPath().equalsIgnoreCase(bam.getPath()))
{
getJob().getLogger().info("\tnormalizing BAM name to: " + renamedBam.getPath());
@@ -940,7 +940,7 @@ else if (step.expectToCreateNewBam())
originalIndex.delete();
}
- renamedBam = new File(bam.getParentFile(), basename + ".bam");
+ renamedBam = FileUtil.appendName(bam.getParentFile(), basename + ".bam");
getHelper().getFileManager().addInput(indexAction, FINAL_BAM_ROLE, renamedBam);
File bai = SequenceAnalysisService.get().getExpectedBamOrCramIndex(renamedBam);
@@ -998,7 +998,7 @@ else if (step.expectToCreateNewBam())
metricsAction.setStartTime(start);
getJob().getLogger().info("calculating alignment metrics");
getJob().setStatus(PipelineJob.TaskStatus.running, "CALCULATING ALIGNMENT SUMMARY METRICS");
- File metricsFile = new File(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".summary.metrics");
+ File metricsFile = FileUtil.appendName(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".summary.metrics");
AlignmentSummaryMetricsWrapper wrapper = new AlignmentSummaryMetricsWrapper(getJob().getLogger());
wrapper.executeCommand(renamedBam, referenceGenome.getWorkingFastaFile(), metricsFile);
getHelper().getFileManager().addInput(metricsAction, "BAM File", renamedBam);
@@ -1014,7 +1014,7 @@ else if (step.expectToCreateNewBam())
{
getJob().getLogger().info("calculating wgs metrics");
getJob().setStatus(PipelineJob.TaskStatus.running, "CALCULATING WGS METRICS");
- File wgsMetricsFile = new File(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".wgs.metrics");
+ File wgsMetricsFile = FileUtil.appendName(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".wgs.metrics");
CollectWgsMetricsWrapper wgsWrapper = new CollectWgsMetricsWrapper(getJob().getLogger());
wgsWrapper.executeCommand(renamedBam, wgsMetricsFile, referenceGenome.getWorkingFastaFile());
getHelper().getFileManager().addOutput(metricsAction, "WGS Metrics File", wgsMetricsFile);
@@ -1030,7 +1030,7 @@ else if (step.expectToCreateNewBam())
{
getJob().getLogger().info("calculating wgs metrics over non-zero coverage");
getJob().setStatus(PipelineJob.TaskStatus.running, "CALCULATING WGS METRICS OVER NON-ZERO COVERAGE");
- File wgsMetricsFile = new File(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".wgsNonZero.metrics");
+ File wgsMetricsFile = FileUtil.appendName(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".wgsNonZero.metrics");
CollectWgsMetricsWithNonZeroCoverageWrapper wgsWrapper = new CollectWgsMetricsWithNonZeroCoverageWrapper(getJob().getLogger());
wgsWrapper.executeCommand(renamedBam, wgsMetricsFile, referenceGenome.getWorkingFastaFile());
getHelper().getFileManager().addOutput(metricsAction, "WGS Non-Zero Coverage Metrics File", wgsMetricsFile);
@@ -1043,8 +1043,8 @@ else if (step.expectToCreateNewBam())
{
getJob().getLogger().info("calculating insert size metrics");
getJob().setStatus(PipelineJob.TaskStatus.running, "CALCULATING INSERT SIZE METRICS");
- File metricsFile2 = new File(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".insertsize.metrics");
- File metricsHistogram = new File(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".insertsize.metrics.pdf");
+ File metricsFile2 = FileUtil.appendName(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".insertsize.metrics");
+ File metricsHistogram = FileUtil.appendName(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".insertsize.metrics.pdf");
CollectInsertSizeMetricsWrapper collectInsertSizeMetricsWrapper = new CollectInsertSizeMetricsWrapper(getJob().getLogger());
if (collectInsertSizeMetricsWrapper.executeCommand(renamedBam, metricsFile2, metricsHistogram, referenceGenome.getWorkingFastaFile()) != null)
{
@@ -1072,7 +1072,7 @@ else if (step.expectToCreateNewBam())
{
IdxStatsRunner idxRunner = new IdxStatsRunner(getJob().getLogger());
idxRunner.execute(renamedBam);
- idxRunner.executeAndSave(renamedBam, new File(renamedBam.getParentFile(), "idxstats.txt"));
+ idxRunner.executeAndSave(renamedBam, FileUtil.appendName(renamedBam.getParentFile(), "idxstats.txt"));
getHelper().getFileManager().addCommandsToAction(idxRunner.getCommandsExecuted(), metricsAction);
}
else
@@ -1145,7 +1145,7 @@ else if (step.expectToCreateNewBam())
if (doCramConvert)
{
getJob().getLogger().info("BAM will be converted to CRAM");
- final File cramFile = new File(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".cram");
+ final File cramFile = FileUtil.appendName(renamedBam.getParentFile(), FileUtil.getBaseName(renamedBam) + ".cram");
final File cramFileIdx = new File(cramFile.getPath() + ".crai");
Integer threads = SequenceTaskHelper.getMaxThreads(getJob());
if (!cramFileIdx.exists())
@@ -1204,7 +1204,7 @@ private File doMergeThenAlign(ReferenceGenome referenceGenome, Readset rs, Map typesFound = new HashSet<>();
for (Pair pair : files.values())
{
@@ -1224,7 +1224,7 @@ private File doMergeThenAlign(ReferenceGenome referenceGenome, Readset rs, Map getHelper().getFileManager().addInput(mergeAction2, "Input FASTQ", x));
- mergedReverse = new File(getHelper().getWorkingDirectory(), SequenceTaskHelper.getMinimalBaseName(forward.get(0).getName()) + ".merged.R2.fastq.gz");
+ mergedReverse = FileUtil.appendName(getHelper().getWorkingDirectory(), SequenceTaskHelper.getMinimalBaseName(forward.get(0).getName()) + ".merged.R2.fastq.gz");
if (doneFile.exists())
{
getJob().getLogger().info("FASTQ merge completed, skipping reverse merge");
@@ -1421,8 +1421,8 @@ public File doAlignmentForSet(List> inputFiles, ReferenceGenome
getHelper().getFileManager().addInput(alignmentAction, IndexOutputImpl.REFERENCE_DB_FASTA, referenceGenome.getSourceFastaFile());
- File outputDirectory = new File(getHelper().getWorkingDirectory(), SequenceTaskHelper.getMinimalBaseName(inputFiles.get(0).first.getName()));
- outputDirectory = new File(outputDirectory, ALIGNMENT_SUBFOLDER_NAME);
+ File outputDirectory = FileUtil.appendName(getHelper().getWorkingDirectory(), SequenceTaskHelper.getMinimalBaseName(inputFiles.get(0).first.getName()));
+ outputDirectory = FileUtil.appendName(outputDirectory, ALIGNMENT_SUBFOLDER_NAME);
if (!outputDirectory.exists())
{
getJob().getLogger().debug("creating directory: " + outputDirectory.getPath());
@@ -1854,7 +1854,7 @@ public void serializeRecordedActionTest() throws Exception
action1.addOutput(new File("/output"), "Output", false);
File tmp = new File(System.getProperty("java.io.tmpdir"));
- File xml = new File(tmp, Resumer.JSON_NAME);
+ File xml = FileUtil.appendName(tmp, Resumer.JSON_NAME);
ObjectMapper objectMapper = PipelineJob.createObjectMapper();
objectMapper.writeValue(xml, action1);
@@ -1893,7 +1893,7 @@ public void serializeTest() throws Exception
r._filesToAlign.put(rd, pair);
File tmp = new File(System.getProperty("java.io.tmpdir"));
- File file = new File(tmp, Resumer.JSON_NAME);
+ File file = FileUtil.appendName(tmp, Resumer.JSON_NAME);
r.writeToJson(tmp);
//after deserialization the RecordedAction should match the original
@@ -1921,7 +1921,7 @@ public void serializeTest() throws Exception
private File getCachedReadDataDir()
{
- return new File(getHelper().getWorkingDirectory(), "cachedReadData");
+ return FileUtil.appendName(getHelper().getWorkingDirectory(), "cachedReadData");
}
private void restoreArchivedReadDataIfNeeded(Readset rs) throws PipelineJobException
@@ -2003,16 +2003,16 @@ else if (sraIDs.contains(rd.getSra_accession()))
File outDir = getCachedReadDataDir();
getTaskFileManagerImpl().addDeferredIntermediateFile(outDir); // NOTE: this must be deferred so it remains until the end
- File doneFile = new File(outDir, rd.getSra_accession() + ".done");
+ File doneFile = FileUtil.appendName(outDir, rd.getSra_accession() + ".done");
sraIDs.add(rd.getSra_accession());
RestoreSraDataHandler.FastqDumpWrapper sra = new RestoreSraDataHandler.FastqDumpWrapper(getJob().getLogger());
if (doneFile.exists())
{
getPipelineJob().getLogger().debug("Re-using existing SRA download: " + rd.getSra_accession());
- rdi.setFile(new File(outDir, rd.getSra_accession() + (rd.isPairedEnd() ? "_1" : "") + ".fastq.gz"), 1);
+ rdi.setFile(FileUtil.appendName(outDir, rd.getSra_accession() + (rd.isPairedEnd() ? "_1" : "") + ".fastq.gz"), 1);
if (rd.getFileId2() != null)
{
- rdi.setFile(new File(outDir, rd.getSra_accession() + "_2.fastq.gz"), 2);
+ rdi.setFile(FileUtil.appendName(outDir, rd.getSra_accession() + "_2.fastq.gz"), 2);
}
}
else
@@ -2036,7 +2036,7 @@ else if (sraIDs.contains(rd.getSra_accession()))
}
Pair downloaded = sra.downloadSra(rd.getSra_accession(), unzippedOutDir, rd.isPairedEnd(), false);
- File moved1 = new File(outDir, downloaded.first.getName());
+ File moved1 = FileUtil.appendName(outDir, downloaded.first.getName());
if (moved1.exists())
{
moved1.delete();
@@ -2048,7 +2048,7 @@ else if (sraIDs.contains(rd.getSra_accession()))
if (downloaded.second != null)
{
- File moved2 = new File(outDir, downloaded.second.getName());
+ File moved2 = FileUtil.appendName(outDir, downloaded.second.getName());
if (moved2.exists())
{
moved2.delete();
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceTaskHelper.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceTaskHelper.java
index eb03ac8d6..fb42006a9 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceTaskHelper.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceTaskHelper.java
@@ -254,11 +254,7 @@ public static boolean isAlignmentUsed(PipelineJob job)
public static void logModuleVersions(Logger log)
{
- String vcs1 = ModuleLoader.getInstance().getModule(SequenceAnalysisModule.NAME).getVcsRevision();
- log.info("SequenceAnalysis Module Version: " + ModuleLoader.getInstance().getModule(SequenceAnalysisModule.NAME).getReleaseVersion() + (StringUtils.isEmpty(vcs1) ? "" : " (r" + vcs1 + ")"));
-
- String vcs2 = ModuleLoader.getInstance().getModule("pipeline").getVcsRevision();
- log.info("Pipeline Module Version: " + ModuleLoader.getInstance().getModule("pipeline").getReleaseVersion() + (StringUtils.isEmpty(vcs2) ? "" : " (r" + vcs2 + ")"));
+ log.info("SequenceAnalysis Module Version: " + ModuleLoader.getInstance().getModule(SequenceAnalysisModule.NAME).getReleaseVersion());
log.debug("java.io.tmpDir: " + System.getProperty("java.io.tmpdir"));
try
{
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/RestoreSraDataHandler.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/RestoreSraDataHandler.java
index 8145a40c9..2baee7478 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/RestoreSraDataHandler.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/RestoreSraDataHandler.java
@@ -165,7 +165,7 @@ public void init(PipelineJob job, SequenceAnalysisJobSupport support, List readsets, JobContext ctx) throws Un
if (!expectedFile1.getParentFile().exists())
{
ctx.getLogger().info("Creating folder: " + expectedFile1.getParentFile().getPath());
- expectedFile1.getParentFile().mkdirs();
+ try
+ {
+ FileUtil.mkdirs(expectedFile1.getParentFile());
+ }
+ catch (IOException e)
+ {
+ throw new PipelineJobException(e);
+ }
}
FastqDumpWrapper wrapper = new FastqDumpWrapper(ctx.getLogger());
@@ -475,7 +482,7 @@ public void processFilesRemote(List readsets, JobContext ctx) throws Un
}
}
- File sraLog = new File(expectedFile1.getParentFile(), FileUtil.makeLegalName("sraDownload.txt"));
+ File sraLog = FileUtil.appendName(expectedFile1.getParentFile(), "sraDownload.txt");
try (PrintWriter writer = PrintWriters.getPrintWriter(IOUtil.openFileForWriting(sraLog, sraLog.exists())))
{
ctx.getLogger().info("Copying file to: " + expectedFile1.getPath());
@@ -557,7 +564,7 @@ public Pair downloadSra(String dataset, File outDir, boolean expectP
List files = new ArrayList<>(Arrays.asList(Objects.requireNonNull(outDir.listFiles((dir, name) -> name.startsWith(dataset)))));
- File file1 = new File(outDir, dataset + (expectPaired ? "_1" : "") + ".fastq");
+ File file1 = FileUtil.appendName(outDir, dataset + (expectPaired ? "_1" : "") + ".fastq");
if (!file1.exists())
{
throw new PipelineJobException("Missing file: " + file1.getPath());
@@ -565,7 +572,7 @@ public Pair downloadSra(String dataset, File outDir, boolean expectP
file1 = doGzip(file1);
files.remove(file1);
- File file2 = new File(outDir, dataset + "_2.fastq");
+ File file2 = FileUtil.appendName(outDir, dataset + "_2.fastq");
if (expectPaired & !file2.exists())
{
throw new PipelineJobException("Missing file: " + file2.getPath());
@@ -611,8 +618,17 @@ private File doGzip(File input) throws PipelineJobException
else
{
// run gzip directly for speed:
+ Integer threads = SequencePipelineService.get().getMaxThreads(getLogger());
+ File pigz = SimpleScriptWrapper.resolveFileInPath("pigz", null, false);
SimpleScriptWrapper wrapper = new SimpleScriptWrapper(getLogger());
- wrapper.execute(Arrays.asList("/bin/bash", "-c", "gzip -f '" + input.getPath() + "'"));
+ if (threads != null && pigz != null)
+ {
+ wrapper.execute(Arrays.asList("/bin/bash", "-c", pigz.getPath() + " -p " + threads + " '" + input.getPath() + "'"));
+ }
+ else
+ {
+ wrapper.execute(Arrays.asList("/bin/bash", "-c", "gzip -f '" + input.getPath() + "'"));
+ }
return new File(input.getPath() + ".gz");
}
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAMem2Wrapper.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAMem2Wrapper.java
index 24a959dc3..b91e570aa 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAMem2Wrapper.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAMem2Wrapper.java
@@ -2,18 +2,14 @@
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;
-import org.json.JSONObject;
import org.labkey.api.pipeline.PipelineJob;
import org.labkey.api.sequenceanalysis.pipeline.AbstractAlignmentStepProvider;
import org.labkey.api.sequenceanalysis.pipeline.AlignmentStep;
import org.labkey.api.sequenceanalysis.pipeline.AlignmentStepProvider;
-import org.labkey.api.sequenceanalysis.pipeline.CommandLineParam;
import org.labkey.api.sequenceanalysis.pipeline.PipelineContext;
import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService;
-import org.labkey.api.sequenceanalysis.pipeline.ToolParameterDescriptor;
import java.io.File;
-import java.util.Arrays;
/**
* User: bimber
@@ -53,17 +49,7 @@ public static class Provider extends AbstractAlignmentStepProvider additionalArgs) throws PipelineJobException
+ protected static List getToolParams()
+ {
+ return Arrays.asList(
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.createSwitch("-a"), "outputAll", "Output All Hits", "Output all found alignments for single-end or unpaired paired-end reads. These alignments will be flagged as secondary alignments.", "checkbox", new JSONObject(){{
+ put("checked", false);
+ }}, true),
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.createSwitch("-M"), "markSplit", "Mark Shorter Hits As Secondary", "Mark shorter split hits as secondary (for Picard compatibility).", "checkbox", new JSONObject(){{
+ put("checked", true);
+ }}, true),
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.createSwitch("-k"), "minSeedLength", "Min Seed Length", "Matches shorter than this value will be missed. The alignment speed is usually insensitive to this value unless it significantly deviates 20. Default value: 19", "ldk-integerfield", new JSONObject(){{
+
+ }}, null),
+ ToolParameterDescriptor.create("threadsForSamtools", "Threads For Samtools View", "If provided, the threads for BWA will be reduced by this value, and these will be given to samtools view. If this value is <1, it will be treated as a fraction of cores (rounded down). If above 1, it will be treated as total cores. We recommend about 0.20 of threads", "ldk-numberfield", new JSONObject(){{
+ put("minValue", 0);
+ }}, 0.2)
+ );
+ }
+
+ public void performMemAlignment(PipelineJob job, AlignmentOutputImpl output, File inputFastq1, @Nullable File inputFastq2, File outputDirectory, ReferenceGenome referenceGenome, String basename, List additionalArgs, int threadsForSamtools) throws PipelineJobException
{
setOutputDir(outputDirectory);
@@ -114,9 +144,10 @@ public void performMemAlignment(PipelineJob job, AlignmentOutputImpl output, Fil
{
bwaArgs.addAll(additionalArgs);
}
- appendThreads(job, bwaArgs);
- bwaArgs.add("'" + new File(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath() + "'");
+ appendThreads(job, bwaArgs, threadsForSamtools);
+
+ bwaArgs.add("'" + FileUtil.appendName(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath() + "'");
bwaArgs.add("'" + inputFastq1.getPath() + "'");
if (inputFastq2 != null)
@@ -125,11 +156,18 @@ public void performMemAlignment(PipelineJob job, AlignmentOutputImpl output, Fil
}
//run BWA and pipe directly to samtools to make BAM
- File bam = new File(outputDirectory, basename + ".bam");
+ File bam = FileUtil.appendName(outputDirectory, basename + ".bam");
output.addCommandExecuted(StringUtils.join(bwaArgs, " "));
SamtoolsRunner sr = new SamtoolsRunner(getLogger());
- List samtoolsArgs = Arrays.asList(sr.getSamtoolsPath().getPath(), "view", "-b", "-h", "-S", "-T", "'" + referenceGenome.getWorkingFastaFile().getPath() + "'", "-o", "'" + bam.getPath() + "'", "-");
+ List samtoolsArgs = new ArrayList<>(Arrays.asList(sr.getSamtoolsPath().getPath(), "view"));
+ if (threadsForSamtools > 0)
+ {
+ samtoolsArgs.add("-@");
+ samtoolsArgs.add(String.valueOf(threadsForSamtools));
+ }
+
+ samtoolsArgs.addAll(Arrays.asList("-b", "-h", "-S", "-T", "'" + referenceGenome.getWorkingFastaFile().getPath() + "'", "-o", "'" + bam.getPath() + "'", "-"));
output.addCommandExecuted(StringUtils.join(samtoolsArgs, " "));
List bashArgs = new ArrayList<>();
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWASWWrapper.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWASWWrapper.java
index 8350f7ff5..e9e8e4410 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWASWWrapper.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWASWWrapper.java
@@ -71,9 +71,9 @@ private void performSWAlignment(PipelineJob job, AlignmentOutputImpl output, Fil
args.add("bwasw");
if (additionalArgs != null)
args.addAll(additionalArgs);
- appendThreads(job, args);
+ appendThreads(job, args, 0);
- args.add(new File(referenceGenome.getAlignerIndexDir("bwa"), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
+ args.add(FileUtil.appendName(referenceGenome.getAlignerIndexDir("bwa"), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
args.add(inputFastq1.getPath());
if (inputFastq2 != null)
@@ -81,7 +81,7 @@ private void performSWAlignment(PipelineJob job, AlignmentOutputImpl output, Fil
args.add(inputFastq2.getPath());
}
- File sam = new File(outputDirectory, basename + ".sam");
+ File sam = FileUtil.appendName(outputDirectory, basename + ".sam");
execute(args, sam);
if (!sam.exists() || !SequenceUtil.hasMinLineCount(sam, 2))
{
@@ -89,7 +89,7 @@ private void performSWAlignment(PipelineJob job, AlignmentOutputImpl output, Fil
}
//convert to BAM
- File bam = new File(outputDirectory, basename + ".bam");
+ File bam = FileUtil.appendName(outputDirectory, basename + ".bam");
SamFormatConverterWrapper converter = new SamFormatConverterWrapper(getLogger());
converter.setStringency(ValidationStringency.SILENT);
bam = converter.execute(sam, bam, true);
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAWrapper.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAWrapper.java
index 70e240a8c..2485ff422 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAWrapper.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/BWAWrapper.java
@@ -107,7 +107,7 @@ public IndexOutput createIndex(ReferenceGenome referenceGenome, File outputDir)
getPipelineCtx().getLogger().info("Creating " + getProvider().getName() + " index");
IndexOutputImpl output = new IndexOutputImpl(referenceGenome);
- File indexDir = new File(outputDir, getIndexCachedDirName(getPipelineCtx().getJob()));
+ File indexDir = FileUtil.appendName(outputDir, getIndexCachedDirName(getPipelineCtx().getJob()));
boolean hasCachedIndex = AlignerIndexUtil.hasCachedIndex(this.getPipelineCtx(), getIndexCachedDirName(getPipelineCtx().getJob()), referenceGenome);
if (!hasCachedIndex)
{
@@ -131,7 +131,7 @@ public IndexOutput createIndex(ReferenceGenome referenceGenome, File outputDir)
indexDir.mkdirs();
}
- args.add(new File(indexDir, outPrefix).getPath());
+ args.add(FileUtil.appendName(indexDir, outPrefix).getPath());
args.add(referenceGenome.getWorkingFastaFile().getPath());
getWrapper().execute(args);
}
@@ -195,12 +195,12 @@ private File runBWAAln(PipelineJob job, ReferenceGenome referenceGenome, File in
List args = new ArrayList<>();
args.add(getExe().getPath());
args.add("aln");
- appendThreads(job, args);
+ appendThreads(job, args, 0);
args.addAll(bwaAlnArgs);
- args.add(new File(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
+ args.add(FileUtil.appendName(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
args.add(inputFile.getPath());
- File output = new File(getOutputDir(inputFile), inputFile.getName() + ".sai");
+ File output = FileUtil.appendName(getOutputDir(inputFile), inputFile.getName() + ".sai");
execute(args, output);
@@ -230,12 +230,12 @@ protected void performBwaAlignment(PipelineJob job, AlignmentOutputImpl output,
throw new PipelineJobException("Reference FASTA does not exist: " + referenceGenome.getWorkingFastaFile().getPath());
}
- File expectedIndex = new File(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile()) + ".bwa.index.sa");
+ File expectedIndex = FileUtil.appendName(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile()) + ".bwa.index.sa");
if (!expectedIndex.exists())
{
throw new PipelineJobException("Expected index does not exist: " + expectedIndex);
}
- args.add(new File(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
+ args.add(FileUtil.appendName(referenceGenome.getAlignerIndexDir(getIndexDirName()), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".bwa.index").getPath());
//add SAI
args.add(sai1.getPath());
@@ -251,7 +251,7 @@ protected void performBwaAlignment(PipelineJob job, AlignmentOutputImpl output,
args.add(inputFastq2.getPath());
}
- File sam = new File(outputDirectory, basename + ".sam");
+ File sam = FileUtil.appendName(outputDirectory, basename + ".sam");
execute(args, sam);
if (!sam.exists() || !SequenceUtil.hasMinLineCount(sam, 2))
{
@@ -259,7 +259,7 @@ protected void performBwaAlignment(PipelineJob job, AlignmentOutputImpl output,
}
//convert to BAM
- File bam = new File(outputDirectory, basename + ".bam");
+ File bam = FileUtil.appendName(outputDirectory, basename + ".bam");
bam = new SamFormatConverterWrapper(getLogger()).execute(sam, bam, true);
if (!bam.exists())
{
@@ -269,11 +269,20 @@ protected void performBwaAlignment(PipelineJob job, AlignmentOutputImpl output,
output.addOutput(bam, AlignmentOutputImpl.BAM_ROLE);
}
- protected void appendThreads(PipelineJob job, List args)
+ protected void appendThreads(PipelineJob job, List args, int threadsForSamtools)
{
Integer threads = SequenceTaskHelper.getMaxThreads(job);
if (threads != null)
{
+ if (threadsForSamtools > 0)
+ {
+ threads = threads - threadsForSamtools;
+ if (threads < 1)
+ {
+ throw new IllegalArgumentException("Cannot reserve for threads for samtools (" + threadsForSamtools + ") than available threads");
+ }
+ }
+
args.add("-t"); //multi-threaded
args.add(threads.toString());
}
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/DeepVariantAnalysis.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/DeepVariantAnalysis.java
index 3f8968831..fb39e8031 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/DeepVariantAnalysis.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/DeepVariantAnalysis.java
@@ -65,8 +65,9 @@ public static List getToolDescriptors()
}}, "X,Y"),
ToolParameterDescriptor.create("binVersion", "DeepVariant Version", "The version of DeepVariant to run, which is passed to their docker container", "textfield", new JSONObject(){{
put("allowBlank", false);
- }}, "1.6.0"),
- ToolParameterDescriptor.create("retainVcf", "Retain VCF", "If selected, the VCF with called genotypes will be retained", "checkbox", null, false)
+ }}, "1.10.0"),
+ ToolParameterDescriptor.create("retainVcf", "Retain VCF", "If selected, the VCF with called genotypes will be retained", "checkbox", null, false),
+ ToolParameterDescriptor.create("cpuBuffer", "CPU Buffer", "If provided, the docker process will reduce --num-shards by this value (it is otherwise limited by the job's CPU limit", "ldk-integerfield", null, 2)
);
}
@@ -104,7 +105,7 @@ public static void inferModelType(String modelType, PipelineContext ctx) throws
modelType = "WGS";
break;
case "Whole Exome":
- modelType = "WXS";
+ modelType = "WES";
break;
default:
throw new IllegalArgumentException("Unknown application: " + rs.getApplication());
@@ -130,8 +131,8 @@ public Output performAnalysisPerSampleRemote(Readset rs, File inputBam, Referenc
AnalysisOutputImpl output = new AnalysisOutputImpl();
output.addInput(inputBam, "Input BAM File");
- File outputFile = new File(outputDir, FileUtil.getBaseName(inputBam) + ".g.vcf.gz");
- File idxFile = new File(outputDir, FileUtil.getBaseName(inputBam) + ".g.vcf.gz.idx");
+ File outputFile = FileUtil.appendName(outputDir, FileUtil.getBaseName(inputBam) + ".g.vcf.gz");
+ File idxFile = FileUtil.appendName(outputDir, FileUtil.getBaseName(inputBam) + ".g.vcf.gz.idx");
String inferredModelType = getPipelineCtx().getSequenceSupport().getCachedObject("modelType", String.class);
String modelType = inferredModelType == null ? getProvider().getParameterByName("modelType").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), String.class) : inferredModelType;
@@ -150,10 +151,11 @@ public Output performAnalysisPerSampleRemote(Readset rs, File inputBam, Referenc
}
boolean retainVcf = getProvider().getParameterByName("retainVcf").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Boolean.class, false);
+ int cpuBuffer = getProvider().getParameterByName("cpuBuffer").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Integer.class, 0);
getWrapper().setOutputDir(outputDir);
getWrapper().setWorkingDir(outputDir);
- getWrapper().execute(inputBam, referenceGenome.getWorkingFastaFile(), outputFile, retainVcf, output, binVersion, args, getPipelineCtx());
+ getWrapper().execute(inputBam, referenceGenome.getWorkingFastaFile(), outputFile, retainVcf, output, binVersion, args, getPipelineCtx(), cpuBuffer);
output.addOutput(outputFile, "gVCF File");
output.addSequenceOutput(outputFile, outputFile.getName(), "DeepVariant gVCF File", rs.getReadsetId(), null, referenceGenome.getGenomeId(), "DeepVariant Version: " + binVersion);
@@ -164,7 +166,7 @@ public Output performAnalysisPerSampleRemote(Readset rs, File inputBam, Referenc
if (retainVcf)
{
- File outputFileVcf = new File(outputDir, FileUtil.getBaseName(inputBam) + ".vcf.gz");
+ File outputFileVcf = FileUtil.appendName(outputDir, FileUtil.getBaseName(inputBam) + ".vcf.gz");
if (!outputFileVcf.exists())
{
throw new PipelineJobException("Missing expected file: " + outputFileVcf.getPath());
@@ -189,7 +191,7 @@ public DeepVariantWrapper(Logger logger)
super(logger);
}
- public void execute(File inputBam, File refFasta, File outputGvcf, boolean retainVcf, PipelineOutputTracker tracker, String binVersion, List extraArgs, PipelineContext ctx) throws PipelineJobException
+ public void execute(File inputBam, File refFasta, File outputGvcf, boolean retainVcf, PipelineOutputTracker tracker, String binVersion, List extraArgs, PipelineContext ctx, int cpuBuffer) throws PipelineJobException
{
File workDir = outputGvcf.getParentFile();
File outputVcf = new File(outputGvcf.getPath().replaceAll(".g.vcf", ".vcf"));
@@ -206,6 +208,9 @@ public void execute(File inputBam, File refFasta, File outputGvcf, boolean retai
List bashArgs = new ArrayList<>(Arrays.asList("/opt/deepvariant/bin/run_deepvariant"));
bashArgs.add("--make_examples_extra_args='normalize_reads=true'");
+
+ // NOTE: consider this:
+ //bashArgs.add("--call_variants_extra_args='writer_threads=" + writerThreads + "'");
bashArgs.add("--ref=" + refFasta.getPath());
bashArgs.add("--reads=" + inputBam.getPath());
bashArgs.add("--output_gvcf=" + outputGvcf.getPath());
@@ -213,7 +218,18 @@ public void execute(File inputBam, File refFasta, File outputGvcf, boolean retai
Integer maxThreads = SequencePipelineService.get().getMaxThreads(getLogger());
if (maxThreads != null)
{
- bashArgs.add("--num_shards=" + maxThreads);
+ if (cpuBuffer > 0)
+ {
+ getLogger().debug("Reducing maxThreads based on cpuBuffer, by: " + cpuBuffer);
+ }
+
+ int effectiveMaxThreads = maxThreads - cpuBuffer;
+ if (effectiveMaxThreads < 1)
+ {
+ throw new PipelineJobException("The combination of maxThreads (" + maxThreads + ") and cpuBuffer (" + cpuBuffer + ") resulted in a negative value");
+ }
+
+ bashArgs.add("--num_shards=" + effectiveMaxThreads);
}
if (extraArgs != null)
@@ -223,6 +239,13 @@ public void execute(File inputBam, File refFasta, File outputGvcf, boolean retai
DockerWrapper wrapper = new DockerWrapper("google/deepvariant:" + binVersion, ctx.getLogger(), ctx);
wrapper.setEntryPoint("/bin/bash");
+ // NOTE: this is designed to avoid errors in make_examples, where the subprocesses use all cores on the node:
+ wrapper.addToDockerEnvironment("OPENBLAS_NUM_THREADS", "1");
+ wrapper.addToDockerEnvironment("OMP_NUM_THREADS", "1");
+ wrapper.addToDockerEnvironment("MKL_NUM_THREADS", "1");
+ wrapper.addToDockerEnvironment("TF_NUM_INTEROP_THREADS", "1");
+ wrapper.addToDockerEnvironment("TF_NUM_INTRAOP_THREADS", "1");
+
wrapper.executeWithDocker(bashArgs, ctx.getWorkingDirectory(), tracker, inputFiles);
if (!outputGvcf.exists())
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptCropWrapper.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptCropWrapper.java
index a9c657583..cd84f8a23 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptCropWrapper.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptCropWrapper.java
@@ -22,6 +22,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Objects;
public class CutadaptCropWrapper extends AbstractCommandWrapper
{
@@ -70,8 +71,8 @@ public PreprocessingOutputImpl processInputFile(File inputFile, @Nullable File i
PreprocessingOutputImpl output = new PreprocessingOutputImpl(inputFile, inputFile2);
String extension = getExtension(inputFile);
- File output1 = new File(outputDir, SequenceTaskHelper.getUnzippedBaseName(inputFile.getName()) + ".crop" + extension);
- File output2 = inputFile2 == null ? null : new File(outputDir, SequenceTaskHelper.getUnzippedBaseName(inputFile2.getName()) + ".crop" + extension);
+ File output1 = FileUtil.appendName(outputDir, SequenceTaskHelper.getUnzippedBaseName(inputFile.getName()) + ".crop" + extension);
+ File output2 = inputFile2 == null ? null : FileUtil.appendName(outputDir, SequenceTaskHelper.getUnzippedBaseName(inputFile2.getName()) + ".crop" + extension);
Integer both = getProvider().getParameterByName("bothReads").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Integer.class);
Integer r1 = getProvider().getParameterByName("read1").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Integer.class);
@@ -127,7 +128,7 @@ else if (inputFile2 != null)
private static String getExtension(File input)
{
- return FileUtil.getExtension(input).endsWith("gz") ? ".fastq.gz" : ".fastq";
+ return Objects.requireNonNull(FileUtil.getExtension(input)).endsWith("gz") ? ".fastq.gz" : ".fastq";
}
}
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptWrapper.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptWrapper.java
index be370eef0..c658dddf1 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptWrapper.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptWrapper.java
@@ -80,8 +80,8 @@ public PreprocessingOutputImpl processInputFile(File inputFile, @Nullable File i
PreprocessingOutputImpl output = new PreprocessingOutputImpl(inputFile, inputFile2);
String extension = getExtension(inputFile);
- File output1 = new File(outputDir, SequenceTaskHelper.getUnzippedBaseName(inputFile.getName()) + ".adaptertrimmed" + extension);
- File output2 = inputFile2 == null ? null : new File(outputDir, SequenceTaskHelper.getUnzippedBaseName(inputFile2.getName()) + ".adaptertrimmed" + extension);
+ File output1 = FileUtil.appendName(outputDir, SequenceTaskHelper.getUnzippedBaseName(inputFile.getName()) + ".adaptertrimmed" + extension);
+ File output2 = inputFile2 == null ? null : FileUtil.appendName(outputDir, SequenceTaskHelper.getUnzippedBaseName(inputFile2.getName()) + ".adaptertrimmed" + extension);
List adapters = TrimmomaticWrapper.AdapterTrimmingProvider.getAdapters(getPipelineCtx().getJob(), getProvider().getName());
if (adapters == null || adapters.isEmpty())
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/FastpStep.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/FastpStep.java
new file mode 100644
index 000000000..e360a467f
--- /dev/null
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/FastpStep.java
@@ -0,0 +1,143 @@
+package org.labkey.sequenceanalysis.run.preprocessing;
+
+import org.apache.logging.log4j.Logger;
+import org.jetbrains.annotations.Nullable;
+import org.json.JSONObject;
+import org.labkey.api.pipeline.PipelineJobException;
+import org.labkey.api.sequenceanalysis.SequenceAnalysisService;
+import org.labkey.api.sequenceanalysis.pipeline.AbstractPipelineStepProvider;
+import org.labkey.api.sequenceanalysis.pipeline.CommandLineParam;
+import org.labkey.api.sequenceanalysis.pipeline.PipelineContext;
+import org.labkey.api.sequenceanalysis.pipeline.PipelineStepProvider;
+import org.labkey.api.sequenceanalysis.pipeline.PreprocessingStep;
+import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService;
+import org.labkey.api.sequenceanalysis.pipeline.ToolParameterDescriptor;
+import org.labkey.api.sequenceanalysis.run.AbstractCommandPipelineStep;
+import org.labkey.api.sequenceanalysis.run.AbstractCommandWrapper;
+import org.labkey.api.util.FileUtil;
+import org.labkey.api.util.Pair;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class FastpStep extends AbstractCommandPipelineStep implements PreprocessingStep
+{
+ public FastpStep(PipelineStepProvider> provider, PipelineContext ctx)
+ {
+ super(provider, ctx, new FastpWrapper(ctx.getLogger()));
+ }
+
+ public static class Provider extends AbstractPipelineStepProvider
+ {
+ public Provider()
+ {
+ super("Fastp", "Fastp Preprocessing", "Fastp", "This provides the ability to trim adapters from the 5' and/or 3' end of the reads. 5' trimming will always be performed first, followed by a second round if 3' adapter trimming was selected.", Arrays.asList(
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.createSwitch("--trim_poly_g"), "trim_poly_g", "Trim polyG stretches", "Trim polyG stretches. This is critical for Illumina data", "checkbox", new JSONObject()
+ {{
+
+ }}, true),
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.createSwitch("--trim_poly_x"), "trim_poly_x", "Trim polyX stretches", "Enable polyX trimming in 3' ends", "checkbox", new JSONObject()
+ {{
+
+ }}, true),
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.createSwitch("--detect_adapter_for_pe"), "detect_adapter_for_pe", "Detect Adapter For PE", "Enable adapter detection for PE data to get ultra-clean data. It takes more time to find just a little bit more adapters", "checkbox", new JSONObject()
+ {{
+
+ }}, true),
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.create("--qualified_quality_phred"), "qualified_quality_phred", "Qualified Quality PHRED", "The quality value that a base is qualified. Default 15 means phred quality >=Q15 is qualified", "ldk-integerfield", new JSONObject()
+ {{
+ put("minValue", 0);
+ }}, 15),
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.create("--length_required"), "length_required", "Length Required", "Min read length required", "ldk-integerfield", new JSONObject()
+ {{
+ put("minValue", 0);
+ }}, 36),
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.createSwitch("--cut_tail"), "cut_tail", "Cut Tail", "Move a sliding window from tail (3') to front, drop the bases in the window if its mean quality is below cut_mean_quality, stop otherwise. Default is disabled.", "checkbox", new JSONObject()
+ {{
+
+ }}, false),
+ ToolParameterDescriptor.createCommandLineParam(CommandLineParam.create("--cut_mean_quality"), "cut_mean_quality", "Cut Mean Quality", "Min read length required", "ldk-integerfield", new JSONObject()
+ {{
+ put("minValue", 0);
+ }}, 20)
+ ), null, "https://github.com/opengene/fastp");
+ }
+
+ @Override
+ public FastpStep create(PipelineContext context)
+ {
+ return new FastpStep(this, context);
+ }
+ }
+
+ @Override
+ public Output processInputFile(File inputFile, @Nullable File inputFile2, File outputDir) throws PipelineJobException
+ {
+ PreprocessingOutputImpl output = new PreprocessingOutputImpl(inputFile, inputFile2);
+
+ List args = new ArrayList<>();
+ args.add("--in1");
+ args.add(inputFile.getPath());
+
+ if (inputFile2 != null)
+ {
+ args.add("--in2");
+ args.add(inputFile2.getPath());
+ }
+
+ File outputFile1 = FileUtil.appendName(outputDir, SequenceAnalysisService.get().getUnzippedBaseName(inputFile.getName()) + ".fastp.fastq.gz");
+ args.add("--out1");
+ args.add(outputFile1.getPath());
+
+ File outputFile2 = inputFile2 == null ? null : FileUtil.appendName(outputDir, SequenceAnalysisService.get().getUnzippedBaseName(inputFile2.getName()) + ".fastp.fastq.gz");
+ if (inputFile2 != null)
+ {
+ args.add("--out2");
+ args.add(outputFile2.getPath());
+ }
+
+ File json = FileUtil.appendName(outputDir, SequenceAnalysisService.get().getUnzippedBaseName(inputFile.getName()) + ".json");
+ args.add("--json");
+ args.add(json.getPath());
+
+ File html = FileUtil.appendName(outputDir, SequenceAnalysisService.get().getUnzippedBaseName(inputFile.getName()) + ".html");
+ args.add("--html");
+ args.add(html.getPath());
+
+ args.addAll(getClientCommandArgs());
+
+ getWrapper().run(args);
+
+ output.setProcessedFastq(Pair.of(outputFile1, outputFile2));
+ output.addCommandsExecuted(getWrapper().getCommandsExecuted());
+
+ return output;
+ }
+
+ public static class FastpWrapper extends AbstractCommandWrapper
+ {
+ public FastpWrapper(Logger logger)
+ {
+ super(logger);
+ }
+
+ public void run(List extraParams) throws PipelineJobException
+ {
+ List params = new ArrayList<>();
+ File fastp = AbstractCommandWrapper.resolveFileInPath("fastp", null, true);
+ params.add(fastp.getAbsolutePath());
+ params.addAll(extraParams);
+
+ Integer maxThreads = SequencePipelineService.get().getMaxThreads(getLogger());
+ if (maxThreads != null)
+ {
+ params.add("--thread");
+ params.add(maxThreads.toString());
+ }
+
+ execute(params);
+ }
+ }
+}
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/FilterReadsStep.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/FilterReadsStep.java
index ecbd31d0a..c64a9ba72 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/FilterReadsStep.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/FilterReadsStep.java
@@ -76,16 +76,16 @@ public Output processInputFile(File inputFile, @Nullable File inputFile2, File o
AlignmentOutputImpl alignmentOutput = new AlignmentOutputImpl();
String basename = SequenceAnalysisService.get().getUnzippedBaseName(inputFile.getName()) + ".filterAlign";
- wrapper.performMemAlignment(getPipelineCtx().getJob(), alignmentOutput, inputFile, inputFile2, outputDir, genome, basename, bwaArgs);
+ wrapper.performMemAlignment(getPipelineCtx().getJob(), alignmentOutput, inputFile, inputFile2, outputDir, genome, basename, bwaArgs, 0);
SequencePipelineService.get().ensureBamIndex(alignmentOutput.getBAM(), getPipelineCtx().getLogger(), true);
output.addIntermediateFile(alignmentOutput.getBAM());
output.addIntermediateFile(SequenceUtil.getExpectedIndex(alignmentOutput.getBAM()));
- File unmappedReadsF = new File(alignmentOutput.getBAM().getParentFile(), FileUtil.getBaseName(alignmentOutput.getBAM()) + "_unmapped_F.fastq");
- File unmappedReadsR = new File(alignmentOutput.getBAM().getParentFile(), FileUtil.getBaseName(alignmentOutput.getBAM()) + "_unmapped_R.fastq");
- File singletons = new File(alignmentOutput.getBAM().getParentFile(), FileUtil.getBaseName(alignmentOutput.getBAM()) + "_unmapped_singletons.fastq");
+ File unmappedReadsF = FileUtil.appendName(alignmentOutput.getBAM().getParentFile(), FileUtil.getBaseName(alignmentOutput.getBAM()) + "_unmapped_F.fastq");
+ File unmappedReadsR = FileUtil.appendName(alignmentOutput.getBAM().getParentFile(), FileUtil.getBaseName(alignmentOutput.getBAM()) + "_unmapped_R.fastq");
+ File singletons = FileUtil.appendName(alignmentOutput.getBAM().getParentFile(), FileUtil.getBaseName(alignmentOutput.getBAM()) + "_unmapped_singletons.fastq");
UnmappedReadExportHandler.Processor.writeUnmappedReadsAsFastq(alignmentOutput.getBAM(), unmappedReadsF, unmappedReadsR, singletons, getPipelineCtx().getLogger());
output.addIntermediateFile(singletons);
diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/AnnotateByLiftoverStep.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/AnnotateByLiftoverStep.java
index 880ac0ea5..3b26d05fa 100644
--- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/AnnotateByLiftoverStep.java
+++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/AnnotateByLiftoverStep.java
@@ -27,6 +27,7 @@
import org.labkey.api.sequenceanalysis.run.AbstractCommandPipelineStep;
import org.labkey.api.sequenceanalysis.run.DISCVRSeqRunner;
import org.labkey.api.sequenceanalysis.run.LiftoverBcfToolsWrapper;
+import org.labkey.api.sequenceanalysis.run.SelectVariantsWrapper;
import org.labkey.api.util.FileUtil;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.sequenceanalysis.SequenceAnalysisSchema;
@@ -137,7 +138,34 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
// Subset, drop annotations and genotypes:
File subsetVcf = FileUtil.appendName(outputDirectory, SequenceAnalysisService.get().getUnzippedBaseName(inputVCF.getName()) + ".subset.vcf.gz");
- if (!indexExists(subsetVcf))
+ if (intervals != null)
+ {
+ if (!indexExists(subsetVcf))
+ {
+ List selectArgs = new ArrayList<>();
+ for (Interval interval : intervals)
+ {
+ selectArgs.add("-L");
+ selectArgs.add(interval.getContig() + ":" + interval.getStart() + "-" + interval.getEnd());
+ }
+
+ SelectVariantsWrapper wrapper = new SelectVariantsWrapper(getPipelineCtx().getLogger());
+ wrapper.execute(genome.getWorkingFastaFile(), inputVCF, subsetVcf, selectArgs);
+ }
+ else
+ {
+ getPipelineCtx().getLogger().debug("VCF index exists, skipping subset: " + subsetVcf.getPath());
+ }
+ }
+ else
+ {
+ subsetVcf = inputVCF;
+ }
+
+
+ // Drop annotations and genotypes:
+ File subsetVcfNoAnn = FileUtil.appendName(outputDirectory, SequenceAnalysisService.get().getUnzippedBaseName(inputVCF.getName()) + ".noann.vcf.gz");
+ if (!indexExists(subsetVcfNoAnn))
{
BcftoolsRunner br = new BcftoolsRunner(getPipelineCtx().getLogger());
@@ -148,7 +176,7 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
selectArgs.add("INFO,FORMAT");
selectArgs.add("-o");
- selectArgs.add(subsetVcf.getPath());
+ selectArgs.add(subsetVcfNoAnn.getPath());
if (intervals != null)
{
@@ -156,13 +184,13 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
selectArgs.add(intervals.stream().map(interval -> interval.getContig() + ":" + interval.getStart() + "-" + interval.getEnd()).collect(Collectors.joining(",")));
}
- selectArgs.add(inputVCF.getPath());
+ selectArgs.add(subsetVcf.getPath());
br.execute(selectArgs);
try
{
- SequenceAnalysisService.get().ensureVcfIndex(subsetVcf, getPipelineCtx().getLogger());
+ SequenceAnalysisService.get().ensureVcfIndex(subsetVcfNoAnn, getPipelineCtx().getLogger());
}
catch (IOException e)
{
@@ -171,17 +199,17 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
}
else
{
- getPipelineCtx().getLogger().debug("VCF index exists, skipping subset: " + subsetVcf.getPath());
+ getPipelineCtx().getLogger().debug("VCF index exists, skipping genotype/annotation removal: " + subsetVcfNoAnn.getPath());
}
- output.addIntermediateFile(subsetVcf);
- output.addIntermediateFile(new File(subsetVcf.getPath() + ".tbi"));
+ output.addIntermediateFile(subsetVcfNoAnn);
+ output.addIntermediateFile(new File(subsetVcfNoAnn.getPath() + ".tbi"));
// Lift
File liftedVcf = FileUtil.appendName(outputDirectory, SequenceAnalysisService.get().getUnzippedBaseName(inputVCF.getName()) + ".lifted.vcf.gz");
if (!indexExists(liftedVcf))
{
LiftoverBcfToolsWrapper lbw = new LiftoverBcfToolsWrapper(getPipelineCtx().getLogger());
- lbw.doLiftover(subsetVcf, chainFile, genome.getWorkingFastaFile(), targetGenome.getWorkingFastaFile(), null, liftedVcf);
+ lbw.doLiftover(subsetVcfNoAnn, chainFile, genome.getWorkingFastaFile(), targetGenome.getWorkingFastaFile(), null, liftedVcf);
try
{
@@ -236,20 +264,7 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
if (!indexExists(vcfAnnotated))
{
VariantAnnotatorWrapper bpRunner = new VariantAnnotatorWrapper(getPipelineCtx().getLogger());
- List args = bpRunner.getBaseArgs("VariantAnnotator");
-
- args.add("-V");
- args.add(liftedVcfBackport.getPath());
-
- args.add("-R");
- args.add(genome.getWorkingFastaFile().getPath());
-
- args.add("-O");
- args.add(vcfAnnotated.getPath());
-
- args.add("-O");
- args.add(vcfAnnotated.getPath());
-
+ List args = new ArrayList<>();
args.add("-resource:lifted");
args.add(liftedVcfBackport.getPath());
@@ -264,8 +279,9 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
args.add("-E");
args.add("lifted.LiftedStop");
- bpRunner.execute(args);
- if (!liftedVcfBackport.exists())
+ // NOTE: this should use the original VCF, with annotations and genotypes:
+ bpRunner.execute(genome.getWorkingFastaFile(), subsetVcf, vcfAnnotated, args);
+ if (!vcfAnnotated.exists())
{
throw new PipelineJobException("Unable to find file: " + vcfAnnotated.getPath());
}
diff --git a/SequenceAnalysis/test/src/org/labkey/test/tests/external/labModules/SequenceTest.java b/SequenceAnalysis/test/src/org/labkey/test/tests/external/labModules/SequenceTest.java
index 855efcf7b..30928947e 100644
--- a/SequenceAnalysis/test/src/org/labkey/test/tests/external/labModules/SequenceTest.java
+++ b/SequenceAnalysis/test/src/org/labkey/test/tests/external/labModules/SequenceTest.java
@@ -741,7 +741,7 @@ private void analysisPanelTest() throws Exception
assertEquals(invalidJSONError, analysisDescription, params.get("jobDescription"));
assertEquals(invalidJSONError, jobName, params.get("jobName"));
- assertEquals(invalidJSONError, "IlluminaAdapterTrimming;AdapterTrimming;AvgQualFilter;CropReads;FASTQC;DownsampleReads;PrintReadsContaining;LeadingTrim;Flash;MaxInfoTrim;SlidingWindowTrim;ReadCropping;ReadLengthFilter;TrailingTrim", params.get("fastqProcessing"));
+ assertEquals(invalidJSONError, "IlluminaAdapterTrimming;AdapterTrimming;AvgQualFilter;CropReads;Fastp;DownsampleReads;FASTQC;PrintReadsContaining;LeadingTrim;Flash;MaxInfoTrim;SlidingWindowTrim;ReadCropping;ReadLengthFilter;TrailingTrim", params.get("fastqProcessing"));
assertEquals(invalidJSONError, overlapLength.toString(), params.get("fastqProcessing.AdapterTrimming.overlapLength").toString());
assertEquals(invalidJSONError, errorRate.toString(), params.get("fastqProcessing.AdapterTrimming.errorRate").toString());
assertEquals(invalidJSONError, minReadLength, params.get("fastqProcessing.AdapterTrimming.minLength").toString());
diff --git a/Studies/src/org/labkey/studies/query/AccessionsDisplayColumnFactory.java b/Studies/src/org/labkey/studies/query/AccessionsDisplayColumnFactory.java
new file mode 100644
index 000000000..284b471fb
--- /dev/null
+++ b/Studies/src/org/labkey/studies/query/AccessionsDisplayColumnFactory.java
@@ -0,0 +1,71 @@
+package org.labkey.studies.query;
+
+import org.apache.commons.lang3.StringUtils;
+import org.labkey.api.data.ColumnInfo;
+import org.labkey.api.data.DataColumn;
+import org.labkey.api.data.DisplayColumn;
+import org.labkey.api.data.DisplayColumnFactory;
+import org.labkey.api.data.RenderContext;
+import org.labkey.api.query.FieldKey;
+import org.labkey.api.util.HtmlString;
+import org.labkey.api.util.LinkBuilder;
+import org.labkey.api.writer.HtmlWriter;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+public class AccessionsDisplayColumnFactory implements DisplayColumnFactory
+{
+ @Override
+ public DisplayColumn createRenderer(ColumnInfo colInfo)
+ {
+ return new DataColumn(colInfo)
+ {
+ @Override
+ public void addQueryFieldKeys(Set keys)
+ {
+ super.addQueryFieldKeys(keys);
+ }
+
+ private FieldKey getBoundKey(String colName)
+ {
+ return new FieldKey(getBoundColumn().getFieldKey().getParent(), colName);
+ }
+
+ @Override
+ public void renderGridCellContents(RenderContext ctx, HtmlWriter out)
+ {
+ String rawValue = StringUtils.trimToNull(ctx.get(getBoundKey("accessions"), String.class));
+ if (rawValue == null)
+ {
+ return;
+ }
+
+ List tokens = Arrays.asList(rawValue.split(","));
+ Collections.sort(tokens);
+
+ HtmlString delim = HtmlString.EMPTY_STRING;
+ for (String accession : tokens)
+ {
+ out.write(delim);
+ if (accession.startsWith("SRA"))
+ {
+ out.write(LinkBuilder.simpleLink(accession, "https://trace.ncbi.nlm.nih.gov/Traces/sra/?run=" + accession).target("_blank"));
+ }
+ else if (accession.startsWith("GS"))
+ {
+ out.write(LinkBuilder.simpleLink(accession, "https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=" + accession).target("_blank"));
+ }
+ else
+ {
+ out.write(accession);
+ }
+
+ delim = HtmlString.BR;
+ }
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/jbrowse/package-lock.json b/jbrowse/package-lock.json
index f26d28668..a4e153df2 100644
--- a/jbrowse/package-lock.json
+++ b/jbrowse/package-lock.json
@@ -135,7 +135,6 @@
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz",
"integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=6.9.0"
}
@@ -215,7 +214,6 @@
"dev": true,
"license": "MIT",
"optional": true,
- "peer": true,
"dependencies": {
"@emnapi/wasi-threads": "1.2.3",
"tslib": "^2.4.0"
@@ -228,7 +226,6 @@
"dev": true,
"license": "MIT",
"optional": true,
- "peer": true,
"dependencies": {
"tslib": "^2.4.0"
}
@@ -1997,7 +1994,6 @@
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
"loose-envify": "^1.1.0"
},
@@ -2074,7 +2070,6 @@
"resolved": "https://registry.npmjs.org/@mui/material/-/material-7.3.11.tgz",
"integrity": "sha512-yq8bPc3LxOwKRWpcjRgDkYFmpM6aKlARfESTmOQcvLYFeJwtHte2tw6hJDrb8sk8wcvpDprHEHVaoUU0MslIkw==",
"license": "MIT",
- "peer": true,
"dependencies": {
"@babel/runtime": "^7.28.6",
"@mui/core-downloads-tracker": "^7.3.11",
@@ -2185,7 +2180,6 @@
"resolved": "https://registry.npmjs.org/@mui/system/-/system-7.3.11.tgz",
"integrity": "sha512-7izwGWdNawAKpBKcRlx7f2gFnAAjmASBWvMcyX4YYEeLOFsbfGRbUYGInvnAcUeql3rPxI7F9Ft4oY2OLRz44g==",
"license": "MIT",
- "peer": true,
"dependencies": {
"@babel/runtime": "^7.28.6",
"@mui/private-theming": "^7.3.11",
@@ -2951,7 +2945,6 @@
"integrity": "sha512-YSS2/Xxz8uiG/KXDkqOoA3dTetNo/vysk7bAexQOrU8iuq7JuzDTTAwLKvWZnwmvME8M8m5wcM4YvfIwYmidHA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@rspack/binding": "2.1.10"
},
@@ -2995,7 +2988,6 @@
"integrity": "sha512-Il8HbYGK3rH5rM0XmUOsOGZVw69BKRpBZ61P28Fy8ry35CtfniDBWtbo/rvJtIT/sK0qwijmNrhF498ltsV+uA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@rspack/dev-middleware": "^2.0.3"
},
@@ -3047,7 +3039,6 @@
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.2.tgz",
"integrity": "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==",
"license": "MIT",
- "peer": true,
"dependencies": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
@@ -3227,7 +3218,8 @@
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
"integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@types/file-saver-es": {
"version": "2.0.3",
@@ -3239,7 +3231,8 @@
"version": "2.0.46",
"resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.46.tgz",
"integrity": "sha512-ynRvcq6wvqexJ9brDMS4BnBLzmr0e14d6ZJTEShTBWKymQiHwlAyGu0ZPEFI2Fh1U53F7tN9ufClWM5KvqkKOw==",
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@types/html-minifier-terser": {
"version": "6.1.0",
@@ -3320,7 +3313,8 @@
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@types/node": {
"version": "26.6.3",
@@ -3349,7 +3343,6 @@
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",
"integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",
"license": "MIT",
- "peer": true,
"dependencies": {
"csstype": "^3.2.2"
}
@@ -3360,7 +3353,6 @@
"integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==",
"devOptional": true,
"license": "MIT",
- "peer": true,
"peerDependencies": {
"@types/react": "^19.3.0"
}
@@ -3417,6 +3409,7 @@
"integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@webassemblyjs/helper-numbers": "1.13.2",
"@webassemblyjs/helper-wasm-bytecode": "1.13.2"
@@ -3427,21 +3420,24 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz",
"integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@webassemblyjs/helper-api-error": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz",
"integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@webassemblyjs/helper-buffer": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz",
"integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@webassemblyjs/helper-numbers": {
"version": "1.13.2",
@@ -3449,6 +3445,7 @@
"integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@webassemblyjs/floating-point-hex-parser": "1.13.2",
"@webassemblyjs/helper-api-error": "1.13.2",
@@ -3460,7 +3457,8 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz",
"integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@webassemblyjs/helper-wasm-section": {
"version": "1.14.1",
@@ -3468,6 +3466,7 @@
"integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-buffer": "1.14.1",
@@ -3481,6 +3480,7 @@
"integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@xtuc/ieee754": "^1.2.0"
}
@@ -3491,6 +3491,7 @@
"integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==",
"dev": true,
"license": "Apache-2.0",
+ "peer": true,
"dependencies": {
"@xtuc/long": "4.2.2"
}
@@ -3500,7 +3501,8 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz",
"integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@webassemblyjs/wasm-edit": {
"version": "1.14.1",
@@ -3508,6 +3510,7 @@
"integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-buffer": "1.14.1",
@@ -3525,6 +3528,7 @@
"integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
@@ -3539,6 +3543,7 @@
"integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-buffer": "1.14.1",
@@ -3552,6 +3557,7 @@
"integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-api-error": "1.13.2",
@@ -3567,6 +3573,7 @@
"integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@xtuc/long": "4.2.2"
@@ -3577,14 +3584,16 @@
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
"integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
"dev": true,
- "license": "BSD-3-Clause"
+ "license": "BSD-3-Clause",
+ "peer": true
},
"node_modules/@xtuc/long": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
"dev": true,
- "license": "Apache-2.0"
+ "license": "Apache-2.0",
+ "peer": true
},
"node_modules/acorn": {
"version": "8.18.0",
@@ -3650,6 +3659,7 @@
"integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"ajv": "^8.0.0"
},
@@ -3668,6 +3678,7 @@
"integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"fast-deep-equal": "^3.1.3"
},
@@ -3890,6 +3901,7 @@
"integrity": "sha512-GLQdD3y6UF8iVuMJl5fHgE4jdn/ua7n+toKfLgNlg3BqQtOZjpy68T8Tup8/wGWZCDlm7KMg7tPb4MPn7oN0TQ==",
"dev": true,
"license": "Apache-2.0",
+ "peer": true,
"bin": {
"baseline-browser-mapping": "dist/cli.cjs"
},
@@ -4095,7 +4107,8 @@
"url": "https://github.com/sponsors/ai"
}
],
- "license": "CC-BY-4.0"
+ "license": "CC-BY-4.0",
+ "peer": true
},
"node_modules/canvas-sequencer-ts": {
"version": "3.1.3",
@@ -4167,6 +4180,7 @@
"integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=6.0"
}
@@ -4602,7 +4616,6 @@
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz",
"integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==",
"license": "MIT",
- "peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/kossnocorp"
@@ -4794,9 +4807,9 @@
}
},
"node_modules/dompurify": {
- "version": "3.4.16",
- "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.16.tgz",
- "integrity": "sha512-sqo+pNp3qRhCIpbgRi1y8Tgk27Bo2Ry7w0dC1NBeNTdZChWjz9Xb/KOoZbRP/R6pQZ80Qw8YhXw13hWWBbMRnQ==",
+ "version": "3.4.17",
+ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.17.tgz",
+ "integrity": "sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
@@ -4857,7 +4870,8 @@
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.443.tgz",
"integrity": "sha512-TDJG36L9A3CWWwZ97HKaE+Iz1sW80pNp6sAU0owzCIV3Zc9eVyRqZK8Vz6NKuMIU8WjP0pIkoqCa0VRf/yFD0Q==",
"dev": true,
- "license": "ISC"
+ "license": "ISC",
+ "peer": true
},
"node_modules/emojis-list": {
"version": "3.0.0",
@@ -4875,6 +4889,7 @@
"integrity": "sha512-9vhedylFonb2YGogzUKX6+Ja72gOJbN1QHAqdrvqLwhdl/QWbKopzoUC9EbQNVsAns/bx/4uyqalrQAoy1IByw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"graceful-fs": "^4.2.4",
"tapable": "^2.3.3"
@@ -4925,7 +4940,8 @@
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz",
"integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/es-object-atoms": {
"version": "1.1.2",
@@ -4945,6 +4961,7 @@
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=6"
}
@@ -4973,6 +4990,7 @@
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=0.8.x"
}
@@ -5016,7 +5034,8 @@
"url": "https://opencollective.com/fastify"
}
],
- "license": "BSD-3-Clause"
+ "license": "BSD-3-Clause",
+ "peer": true
},
"node_modules/file-saver-es": {
"version": "2.0.5",
@@ -5856,6 +5875,7 @@
"integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@types/node": "*",
"merge-stream": "^2.0.0",
@@ -5871,6 +5891,7 @@
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"has-flag": "^4.0.0"
},
@@ -5910,7 +5931,8 @@
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/json5": {
"version": "2.2.3",
@@ -6089,7 +6111,8 @@
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
"dev": true,
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/mime-db": {
"version": "1.54.0",
@@ -6097,6 +6120,7 @@
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">= 0.6"
}
@@ -6132,6 +6156,7 @@
"integrity": "sha512-PCN1x1OzFeFB2GlP91s46q7Gz8Jf16Z7M45bzpoqrYZlh12QeY6tYVM5h299wbwy1DxnQ69VFmmh8Hb2Ff8mbw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.31",
"jest-worker": "^27.4.5",
@@ -6227,7 +6252,6 @@
"resolved": "https://registry.npmjs.org/mobx/-/mobx-6.16.1.tgz",
"integrity": "sha512-syNcDdX3KT+Jq3je6eGjBhuc24Z68td2VG0zNFqRswaE433D9SNH5VRy/xrGbJsUixfppLLccXhAW9JSf6n+SQ==",
"license": "MIT",
- "peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mobx"
@@ -6350,6 +6374,7 @@
"integrity": "sha512-kQK9LGGFiHtrWiNhZtA7Qbw17AQz+dmsEKODRIVTXA9+e5MS/2gZEBhYJt13GrAz5/IOZKddH/0Z3TP/Zgo+yw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=18"
}
@@ -6597,7 +6622,6 @@
}
],
"license": "MIT",
- "peer": true,
"dependencies": {
"nanoid": "^3.3.18",
"picocolors": "^1.1.1",
@@ -6746,7 +6770,6 @@
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
"license": "MIT",
- "peer": true,
"dependencies": {
"loose-envify": "^1.4.0",
"object-assign": "^4.1.1",
@@ -6770,7 +6793,6 @@
"resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz",
"integrity": "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -6813,7 +6835,6 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.0.tgz",
"integrity": "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==",
"license": "MIT",
- "peer": true,
"dependencies": {
"scheduler": "^0.28.0"
},
@@ -6886,7 +6907,6 @@
"integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==",
"dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -7081,8 +7101,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
- "license": "MIT",
- "peer": true
+ "license": "MIT"
},
"node_modules/regex-parser": {
"version": "2.3.1",
@@ -7141,6 +7160,7 @@
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -7331,6 +7351,7 @@
"integrity": "sha512-zJlMCZ0cAR5p/Y4oVpRoqioDMJcGxaXRrQ/4rP4WyR84vc5z/DolXdbvXeDpTwbtocDFr2rhPqHPErDCUtz2kA==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@types/json-schema": "^7.0.15",
"ajv": "^8.20.0",
@@ -7853,8 +7874,7 @@
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
- "license": "0BSD",
- "peer": true
+ "license": "0BSD"
},
"node_modules/typescript": {
"version": "6.0.3",
@@ -7862,7 +7882,6 @@
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
"dev": true,
"license": "Apache-2.0",
- "peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -7922,6 +7941,7 @@
}
],
"license": "MIT",
+ "peer": true,
"dependencies": {
"escalade": "^3.2.0",
"picocolors": "^1.1.1"
@@ -7995,7 +8015,6 @@
"resolved": "https://registry.npmjs.org/vis-data/-/vis-data-8.0.5.tgz",
"integrity": "sha512-tRQKcTGaclo60rTY1j4v7BgD9v5jfD3wl+JgR1q6I4AI7go3QH5OjMCLIuZPpL2sf4IRMlwyPlRLnK4m+Phjsw==",
"license": "(Apache-2.0 OR MIT)",
- "peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/visjs"
@@ -8047,6 +8066,7 @@
"integrity": "sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"graceful-fs": "^4.1.2"
},
@@ -8150,6 +8170,7 @@
"integrity": "sha512-EIMmPVvNI0CYXyRPp34F2Qk7W37/BZVZIofS6LAUnrNjCVahS+hO4mxwFJDjQjODTGZDtVzLYoN2+1dYkhk9qA==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=10.13.0"
}
diff --git a/singlecell/resources/chunks/ApplyKnownClonotypicData.R b/singlecell/resources/chunks/ApplyKnownClonotypicData.R
index fa4f36ce8..fe9913e7b 100644
--- a/singlecell/resources/chunks/ApplyKnownClonotypicData.R
+++ b/singlecell/resources/chunks/ApplyKnownClonotypicData.R
@@ -11,7 +11,7 @@ for (datasetId in names(seuratObjects)) {
printName(datasetId)
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
- seuratObj <- ApplyKnownClonotypicData(seuratObj, antigenInclusionList = antigenInclusionList, antigenExclusionList = antigenExclusionList, minActivationFrequency = minActivationFrequency, minFractionCloneActivated = minFractionCloneActivated)
+ seuratObj <- ApplyKnownClonotypicData(seuratObj, methods = calculationMethods, antigenInclusionList = antigenInclusionList, antigenExclusionList = antigenExclusionList, minActivationFrequency = minActivationFrequency, minFractionCloneActivated = minFractionCloneActivated)
saveData(seuratObj, datasetId)
# Cleanup
diff --git a/singlecell/resources/chunks/CalculatePerforinUCell.R b/singlecell/resources/chunks/CalculatePerforinUCell.R
new file mode 100644
index 000000000..bbbe1638e
--- /dev/null
+++ b/singlecell/resources/chunks/CalculatePerforinUCell.R
@@ -0,0 +1,24 @@
+if (Sys.getenv('SEURAT_MAX_THREADS') != '') {
+ nCores <- Sys.getenv('SEURAT_MAX_THREADS')
+} else {
+ nCores <- 1
+}
+
+for (datasetId in names(seuratObjects)) {
+ printName(datasetId)
+ seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
+
+ message(paste0('Loading dataset ', datasetId, ', with total cells: ', ncol(seuratObj)))
+ seuratObj <- UCell::AddModuleScore_UCell(seuratObj, features = list(
+ PRF1 = c('PRF1'),
+ PRF1_GZMB = c('PRF1', 'GZMB')
+ ), ncores = nCores, assay = assayName)
+
+ seuratObj <- UCell::SmoothKNN(seuratObj, signature.names = 'PRF1_UCell', 'PRF1_GZMB_UCell')
+
+ saveData(seuratObj, datasetId)
+
+ # Cleanup
+ rm(seuratObj)
+ gc()
+}
\ No newline at end of file
diff --git a/singlecell/resources/chunks/IdentifyAndStoreActiveClonotypes.R b/singlecell/resources/chunks/IdentifyAndStoreActiveClonotypes.R
index ee5de2b82..b6bfd2123 100644
--- a/singlecell/resources/chunks/IdentifyAndStoreActiveClonotypes.R
+++ b/singlecell/resources/chunks/IdentifyAndStoreActiveClonotypes.R
@@ -16,9 +16,12 @@ for (datasetId in names(seuratObjects)) {
seuratObj <- Rdiscvr::DownloadAndAppendTcrClonotypes(seuratObj, allowMissing = TRUE)
}
- Rdiscvr::IdentifyAndStoreActiveClonotypes(seuratObj, chain = 'TRA', storeStimLevelData = FALSE, minEDS = minEDS)
- Rdiscvr::IdentifyAndStoreActiveClonotypes(seuratObj, chain = 'TRD', storeStimLevelData = FALSE, minEDS = minEDS)
- Rdiscvr::IdentifyAndStoreActiveClonotypes(seuratObj, chain = 'TRB', minEDS = minEDS)
+ for (calculationMethod in calculationMethods) {
+ Rdiscvr::IdentifyAndStoreActiveClonotypes(seuratObj, chain = 'TRA', storeStimLevelData = FALSE, minEDS = minEDS, method = calculationMethod)
+ Rdiscvr::IdentifyAndStoreActiveClonotypes(seuratObj, chain = 'TRD', storeStimLevelData = FALSE, minEDS = minEDS, method = calculationMethod)
+ Rdiscvr::IdentifyAndStoreActiveClonotypes(seuratObj, chain = 'TRG', storeStimLevelData = FALSE, minEDS = minEDS, method = calculationMethod)
+ Rdiscvr::IdentifyAndStoreActiveClonotypes(seuratObj, chain = 'TRB', minEDS = minEDS, method = calculationMethod)
+ }
saveData(seuratObj, datasetId)
diff --git a/singlecell/resources/chunks/StudyMetadata.R b/singlecell/resources/chunks/StudyMetadata.R
index a54383add..b36df87be 100644
--- a/singlecell/resources/chunks/StudyMetadata.R
+++ b/singlecell/resources/chunks/StudyMetadata.R
@@ -34,6 +34,8 @@ for (datasetId in names(seuratObjects)) {
seuratObj <- Rdiscvr::ApplyPPG_Stim_Metadata(seuratObj, errorIfUnknownIdsFound = errorIfUnknownIdsFound)
} else if (studyName == 'IMPAC_TB_Human') {
seuratObj <- Rdiscvr::ApplyIMPAC_TB_Human_Metadata(seuratObj, errorIfUnknownIdsFound = errorIfUnknownIdsFound)
+ } else if (studyName == 'SIV_Metadata') {
+ seuratObj <- Rdiscvr::AppendSivStudyInfo(seuratObj)
} else {
stop(paste0('Unknown study: ', studyName))
}
diff --git a/singlecell/resources/queries/singlecell/samples.js b/singlecell/resources/queries/singlecell/samples.js
index 6b3ec2600..06e4dcb70 100644
--- a/singlecell/resources/queries/singlecell/samples.js
+++ b/singlecell/resources/queries/singlecell/samples.js
@@ -32,6 +32,9 @@ function beforeUpsert(row, oldRow, errors){
else if (['Infected cells: Mock', 'Infected Cells: Mock'].indexOf(row.stim) !== -1){
row.stim = 'Mock-Infected CD4s';
}
+ else if (['mock'].indexOf(row.stim) !== -1){
+ row.stim = 'Mock';
+ }
var lookupFields = ['stim'];
for (var i=0;i
+ {
+ public Provider()
+ {
+ super("CalculatePerforinUCell", "Calculate Perforin UCell", "Seurat", "This will calculate two neighbor-smoothed UCells. One using PRF1, and one using PRF1+GZMB.", Arrays.asList(
+ SeuratToolParameter.create("assayName", "Assay Name", "Passed directly to UCell::AddModuleScore_UCell.", "textfield", new JSONObject(){{
+
+ }}, "RNA"),
+ SeuratToolParameter.create("forceRecalculate", "Force Recalculate", "If checked, the UCell score will always be re-calculated.", "checkbox", new JSONObject(){{
+
+ }}, false)
+ ), null, null);
+ }
+
+ @Override
+ public CalculatePerforinUCell create(PipelineContext ctx)
+ {
+ return new CalculatePerforinUCell(ctx, this);
+ }
+ }
+
+ @Override
+ public Collection getRLibraries()
+ {
+ return PageFlowUtil.set("Seurat", "patchwork");
+ }
+
+ @Override
+ public String getFileSuffix()
+ {
+ return "ucell";
+ }
+}
diff --git a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/IdentifyAndStoreActiveClonotypes.java b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/IdentifyAndStoreActiveClonotypes.java
index 7ce42f8f1..58da4a8c3 100644
--- a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/IdentifyAndStoreActiveClonotypes.java
+++ b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/IdentifyAndStoreActiveClonotypes.java
@@ -1,5 +1,6 @@
package org.labkey.singlecell.pipeline.singlecell;
+import org.json.JSONObject;
import org.labkey.api.sequenceanalysis.pipeline.AbstractPipelineStepProvider;
import org.labkey.api.sequenceanalysis.pipeline.PipelineContext;
import org.labkey.api.singlecell.pipeline.SeuratToolParameter;
@@ -19,7 +20,8 @@ public static class Provider extends AbstractPipelineStepProvider inputFastqs1, @Nullable List inputFastqs2, File outputDirectory, ReferenceGenome referenceGenome, String basename, String readGroupId, @Nullable String platformUnit) throws PipelineJobException
{
- getPipelineCtx().getJob().setStatus(PipelineJob.TaskStatus.running, "Running Cellranger GEX");
+ getPipelineCtx().getJob().setStatus(PipelineJob.TaskStatus.running, "Running CellRanger GEX");
- File localBam = new File(outputDirectory, basename + ".cellranger.bam");
+ File localBam = FileUtil.appendName(outputDirectory, basename + ".cellranger.bam");
File localBamIdx = SequenceAnalysisService.get().getExpectedBamOrCramIndex(localBam);
String idParam = StringUtils.trimToNull(getProvider().getParameterByName("id").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), String.class));
- File cellrangerOutdir = new File(outputDirectory, CellRangerWrapper.getId(idParam, rs));
+ File cellrangerOutdir = FileUtil.appendName(outputDirectory, CellRangerWrapper.getId(idParam, rs));
if (localBam.exists() && localBamIdx.exists())
{
@@ -49,7 +51,7 @@ protected File runCellRanger(AlignmentOutputImpl output, Readset rs, List
}
else
{
- File crBam = new File(cellrangerOutdir, "outs/possorted_genome_bam.bam");
+ File crBam = FileUtil.appendName(cellrangerOutdir, "outs/possorted_genome_bam.bam");
if (crBam.exists())
{
getPipelineCtx().getLogger().info("Using previous cellranger count run");
@@ -78,7 +80,7 @@ protected File runCellRanger(AlignmentOutputImpl output, Readset rs, List
if (localBamIdx.exists())
{
- localBamIdx.delete();
+ Files.delete(localBamIdx.toPath());
}
FileUtils.moveFile(SequenceAnalysisService.get().getExpectedBamOrCramIndex(crBam), localBamIdx);
}
@@ -96,11 +98,4 @@ public void complete(SequenceAnalysisJobSupport support, AnalysisModel model, Co
{
// Skip GEX-specific complete steps.
}
-
- @Override
- public boolean alwaysCopyIndexToWorkingDir()
- {
- return false;
- }
-
}
diff --git a/singlecell/src/org/labkey/singlecell/run/CellRangerFeatureBarcodeHandler.java b/singlecell/src/org/labkey/singlecell/run/CellRangerFeatureBarcodeHandler.java
index 5f875c4f2..9f1b4d443 100644
--- a/singlecell/src/org/labkey/singlecell/run/CellRangerFeatureBarcodeHandler.java
+++ b/singlecell/src/org/labkey/singlecell/run/CellRangerFeatureBarcodeHandler.java
@@ -34,6 +34,7 @@
import org.labkey.api.sequenceanalysis.run.SimpleScriptWrapper;
import org.labkey.api.util.FileUtil;
import org.labkey.api.util.PageFlowUtil;
+import org.labkey.api.util.Path;
import org.labkey.api.writer.PrintWriters;
import org.labkey.singlecell.CellHashingServiceImpl;
import org.labkey.singlecell.SingleCellModule;
@@ -236,7 +237,7 @@ private void processType(List> inputFastqs, AlignmentOutputImpl
List args = wrapper.prepareCountArgs(output, id, ctx.getOutputDir(), rs, inputFastqs, extraArgs, false);
//https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/using/feature-bc-analysis
- File libraryCsv = new File(ctx.getOutputDir(), "libraries.csv");
+ File libraryCsv = FileUtil.appendName(ctx.getOutputDir(), "libraries.csv");
try (CSVWriter writer = new CSVWriter(PrintWriters.getPrintWriter(libraryCsv), ',', CSVWriter.NO_QUOTE_CHARACTER))
{
writer.writeNext(new String[]{"fastqs", "sample", "library_type"});
@@ -256,7 +257,7 @@ private void processType(List> inputFastqs, AlignmentOutputImpl
wrapper.setWorkingDir(ctx.getOutputDir());
//Note: we can safely assume only this server is working on these files, so if the _lock file exists, it was from a previous failed job.
- File lockFile = new File(ctx.getOutputDir(), id + "/_lock");
+ File lockFile = FileUtil.appendPath(ctx.getOutputDir(), Path.parse(id + "/_lock"));
if (lockFile.exists())
{
ctx.getLogger().info("Lock file exists, deleting: " + lockFile.getPath());
@@ -265,7 +266,7 @@ private void processType(List> inputFastqs, AlignmentOutputImpl
wrapper.execute(args);
- File crDir = new File(ctx.getOutputDir(), id);
+ File crDir = FileUtil.appendName(ctx.getOutputDir(), id);
if (idSuffix != null)
{
File toMove = new File(crDir.getPath() + idSuffix);
@@ -282,9 +283,9 @@ private void processType(List> inputFastqs, AlignmentOutputImpl
crDir = toMove;
}
- File outsdir = new File(crDir, "outs");
+ File outsdir = FileUtil.appendName(crDir, "outs");
- File bam = new File(outsdir, "possorted_genome_bam.bam");
+ File bam = FileUtil.appendName(outsdir, "possorted_genome_bam.bam");
if (bam.exists())
{
throw new PipelineJobException("Did not expect to find BAM: " + bam.getPath());
@@ -295,13 +296,13 @@ private void processType(List> inputFastqs, AlignmentOutputImpl
try
{
String prefix = FileUtil.makeLegalName(rs.getName() + "_");
- File outputHtml = new File(outsdir, "web_summary.html");
+ File outputHtml = FileUtil.appendName(outsdir, "web_summary.html");
if (!outputHtml.exists())
{
throw new PipelineJobException("Unable to find file: " + outputHtml.getPath());
}
- File outputHtmlRename = new File(outsdir, prefix + outputHtml.getName());
+ File outputHtmlRename = FileUtil.appendName(outsdir, prefix + outputHtml.getName());
if (outputHtmlRename.exists())
{
outputHtmlRename.delete();
@@ -315,7 +316,7 @@ private void processType(List> inputFastqs, AlignmentOutputImpl
}
output.addSequenceOutput(outputHtmlRename, rs.getName() + " 10x " + rs.getApplication() + " Summary", "10x Run Summary", rs.getRowId(), null, null, description);
- File rawCounts = new File(outsdir, "raw_feature_bc_matrix/matrix.mtx.gz");
+ File rawCounts = FileUtil.appendName(outsdir, "raw_feature_bc_matrix/matrix.mtx.gz");
if (rawCounts.exists())
{
output.addSequenceOutput(rawCounts, rs.getName() + ": " + rs.getApplication() + " Raw Counts", category, rs.getRowId(), null, null, description);
@@ -332,7 +333,7 @@ private void processType(List> inputFastqs, AlignmentOutputImpl
}
//NOTE: this folder has many unnecessary files and symlinks that get corrupted when we rename the main outputs
- File directory = new File(outsdir.getParentFile(), "SC_RNA_COUNTER_CS");
+ File directory = FileUtil.appendName(outsdir.getParentFile(), "SC_RNA_COUNTER_CS");
if (directory.exists())
{
//NOTE: this will have lots of symlinks, including corrupted ones, which java handles badly
@@ -348,20 +349,20 @@ private File makeDummyIndex(JobContext ctx) throws PipelineJobException
{
try
{
- File indexDir = new File(ctx.getOutputDir(), "cellrangerIndex");
+ File indexDir = FileUtil.appendName(ctx.getOutputDir(), "cellrangerIndex");
if (indexDir.exists())
{
FileUtils.deleteDirectory(indexDir);
}
- File fasta = new File(ctx.getOutputDir(), "genome.fasta");
+ File fasta = FileUtil.appendName(ctx.getOutputDir(), "genome.fasta");
try (PrintWriter writer = PrintWriters.getPrintWriter(fasta))
{
writer.println(">1");
writer.println("ATGATGATGATGATG");
}
- File gtf = new File(ctx.getOutputDir(), "genome.gtf");
+ File gtf = FileUtil.appendName(ctx.getOutputDir(), "genome.gtf");
try (PrintWriter writer = PrintWriters.getPrintWriter(gtf))
{
writer.println("1\tnowhere\texon\t1\t4\t.\t+\t.\ttranscript_id \"transcript1\"; gene_id \"gene1\"; gene_name \"gene1\";");
@@ -404,7 +405,7 @@ private File makeDummyIndex(JobContext ctx) throws PipelineJobException
private File createFeatureRefForCiteSeq(File outputDir, File adtWhitelist) throws PipelineJobException
{
- File featuresCsv = new File(outputDir, "adtFeatureRef.csv");
+ File featuresCsv = FileUtil.appendName(outputDir, "adtFeatureRef.csv");
try (CSVReader reader = new CSVReader(Readers.getReader(adtWhitelist), '\t'); CSVWriter writer = new CSVWriter(PrintWriters.getPrintWriter(featuresCsv), ',', CSVWriter.DEFAULT_QUOTE_CHARACTER))
{
writer.writeNext(new String[]{"id", "name", "read", "pattern", "sequence", "feature_type"});
@@ -438,7 +439,7 @@ private File createFeatureRefForCiteSeq(File outputDir, File adtWhitelist) throw
private File createFeatureRefForHashing(File outputDir, File hashingWhitelist) throws PipelineJobException
{
- File featuresCsv = new File(outputDir, "hashingFeatureRef.csv");
+ File featuresCsv = FileUtil.appendName(outputDir, "hashingFeatureRef.csv");
try (CSVReader reader = new CSVReader(Readers.getReader(hashingWhitelist), ',');CSVWriter writer = new CSVWriter(PrintWriters.getPrintWriter(featuresCsv), ',', CSVWriter.DEFAULT_QUOTE_CHARACTER))
{
writer.writeNext(new String[]{"id", "name", "read", "pattern", "sequence", "feature_type"});
@@ -482,9 +483,9 @@ public void complete(PipelineJob job, List readsets, List inputFastqs1, @Nu
getWrapper().setWorkingDir(outputDirectory);
//Note: we can safely assume only this server is working on these files, so if the _lock file exists, it was from a previous failed job.
- File lockFile = new File(outputDirectory, id + "/_lock");
+ File lockFile = FileUtil.appendPath(outputDirectory, org.labkey.api.util.Path.parse(id + "/_lock"));
if (lockFile.exists())
{
getPipelineCtx().getLogger().info("Lock file exists, deleting: " + lockFile.getPath());
@@ -398,10 +398,10 @@ public AlignmentOutput performAlignment(Readset rs, List inputFastqs1, @Nu
getWrapper().execute(args);
- File outdir = new File(outputDirectory, id);
- outdir = new File(outdir, "outs");
+ File outdir = FileUtil.appendName(outputDirectory, id);
+ outdir = FileUtil.appendName(outdir, "outs");
- File bam = new File(outdir, "possorted_genome_bam.bam");
+ File bam = FileUtil.appendName(outdir, "possorted_genome_bam.bam");
if (!shouldDiscardBam())
{
if (!bam.exists())
@@ -416,13 +416,13 @@ public AlignmentOutput performAlignment(Readset rs, List inputFastqs1, @Nu
try
{
String prefix = FileUtil.makeLegalName(rs.getName() + "_");
- File outputHtml = new File(outdir, "web_summary.html");
+ File outputHtml = FileUtil.appendName(outdir, "web_summary.html");
if (!outputHtml.exists())
{
throw new PipelineJobException("Unable to find file: " + outputHtml.getPath());
}
- File outputHtmlRename = new File(outdir, prefix + outputHtml.getName());
+ File outputHtmlRename = FileUtil.appendName(outdir, prefix + outputHtml.getName());
if (outputHtmlRename.exists())
{
outputHtmlRename.delete();
@@ -431,10 +431,10 @@ public AlignmentOutput performAlignment(Readset rs, List inputFastqs1, @Nu
String description = getAlignDescription(getProvider(), getPipelineCtx(), getStepIdx(), false, getWrapper().getVersionString());
output.addSequenceOutput(outputHtmlRename, rs.getName() + " 10x Count Summary", "10x Run Summary", rs.getRowId(), null, referenceGenome.getGenomeId(), description);
- File loupe = new File(outdir, "cloupe.cloupe");
+ File loupe = FileUtil.appendName(outdir, "cloupe.cloupe");
if (loupe.exists())
{
- File loupeRename = new File(outdir, prefix + loupe.getName());
+ File loupeRename = FileUtil.appendName(outdir, prefix + loupe.getName());
if (loupeRename.exists())
{
loupeRename.delete();
@@ -453,7 +453,7 @@ public AlignmentOutput performAlignment(Readset rs, List inputFastqs1, @Nu
}
//NOTE: this folder has many unnecessary files and symlinks that get corrupted when we rename the main outputs
- File directory = new File(outdir.getParentFile(), "SC_RNA_COUNTER_CS");
+ File directory = FileUtil.appendName(outdir.getParentFile(), "SC_RNA_COUNTER_CS");
if (directory.exists())
{
//NOTE: this will have lots of symlinks, including corrupted ones, which java handles badly
@@ -506,7 +506,7 @@ public void complete(SequenceAnalysisJobSupport support, AnalysisModel model, Co
throw new PipelineJobException("Unable to find rowId for analysis");
}
- File metrics = new File(outsDir, "metrics_summary.csv");
+ File metrics = FileUtil.appendName(outsDir, "metrics_summary.csv");
if (metrics.exists())
{
getPipelineCtx().getLogger().debug("adding 10x metrics");
@@ -664,7 +664,7 @@ public File getInclusionListFile(Logger logger) throws PipelineJobException
}
}
- File il = new File(exe.getParentFile(), "../lib/python/cellranger/barcodes/" + _inclusionListFile);
+ File il = FileUtil.appendName(exe.getParentFile(), "../lib/python/cellranger/barcodes/" + _inclusionListFile);
if (!il.exists())
{
throw new PipelineJobException("Unable to find file: " + il.getPath());
diff --git a/singlecell/src/org/labkey/singlecell/run/CellRangerVDJWrapper.java b/singlecell/src/org/labkey/singlecell/run/CellRangerVDJWrapper.java
index e3ebe6dbe..9d8c7a1d8 100644
--- a/singlecell/src/org/labkey/singlecell/run/CellRangerVDJWrapper.java
+++ b/singlecell/src/org/labkey/singlecell/run/CellRangerVDJWrapper.java
@@ -42,6 +42,7 @@
import org.labkey.api.sequenceanalysis.run.SimpleScriptWrapper;
import org.labkey.api.util.FileUtil;
import org.labkey.api.util.PageFlowUtil;
+import org.labkey.api.util.Path;
import org.labkey.api.writer.PrintWriters;
import java.io.BufferedReader;
@@ -311,8 +312,7 @@ public AlignmentStep.AlignmentOutput performAlignment(Readset rs, List inp
args.add("--disable-ui");
String idParam = StringUtils.trimToNull(getProvider().getParameterByName("id").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), String.class));
- String id = FileUtil.makeLegalName(rs.getName()) + (idParam == null ? "" : "-" + idParam);
- id = id.replaceAll("[^a-zA-z0-9_\\-]", "_");
+ String id = CellRangerWrapper.getId(idParam, rs);
args.add("--id=" + id);
File indexDir = AlignerIndexUtil.getIndexDir(referenceGenome, getIndexCachedDirName(getPipelineCtx().getJob()));
@@ -323,7 +323,7 @@ public AlignmentStep.AlignmentOutput performAlignment(Readset rs, List inp
throw new PipelineJobException("Enrichment primers are required");
}
- File primerFile = new File(outputDirectory, "primers.txt");
+ File primerFile = FileUtil.appendName(outputDirectory, "primers.txt");
primers = primers.replaceAll("\\s+", ",");
primers = primers.replaceAll(",+", ",");
@@ -356,13 +356,13 @@ public AlignmentStep.AlignmentOutput performAlignment(Readset rs, List inp
args.add("--localmem=" + maxRam);
}
- File localFqDir = new File(outputDirectory, "localFq");
+ File localFqDir = FileUtil.appendName(outputDirectory, "localFq");
output.addIntermediateFile(localFqDir);
Set sampleNames = prepareFastqSymlinks(rs, localFqDir);
getPipelineCtx().getLogger().debug("Sample names: [" + StringUtils.join(sampleNames, ",") + "]");
- File sampleFile = new File(getPipelineCtx().getWorkingDirectory(), "sample.csv");
+ File sampleFile = FileUtil.appendName(getPipelineCtx().getWorkingDirectory(), "sample.csv");
output.addIntermediateFile(sampleFile);
try (PrintWriter writer = PrintWriters.getPrintWriter(sampleFile))
{
@@ -392,7 +392,7 @@ public AlignmentStep.AlignmentOutput performAlignment(Readset rs, List inp
getWrapper().setWorkingDir(outputDirectory);
//Note: we can safely assume only this server is working on these files, so if the _lock file exists, it was from a previous failed job.
- File lockFile = new File(outputDirectory, id + "/_lock");
+ File lockFile = FileUtil.appendPath(outputDirectory, Path.parse(id + "/_lock"));
if (lockFile.exists())
{
getPipelineCtx().getLogger().info("Lock file exists, deleting: " + lockFile.getPath());
@@ -401,8 +401,8 @@ public AlignmentStep.AlignmentOutput performAlignment(Readset rs, List inp
getWrapper().execute(args);
- File outdir = new File(outputDirectory, id);
- outdir = new File(outdir, "outs");
+ File outdir = FileUtil.appendName(outputDirectory, id);
+ outdir = FileUtil.appendName(outdir, "outs");
File csvAB = processOutputsForType(id, rs, referenceGenome, outdir, output, "vdj_t");
@@ -411,10 +411,10 @@ public AlignmentStep.AlignmentOutput performAlignment(Readset rs, List inp
processAndMergeCSVs(csvAB, csvGD, getPipelineCtx().getLogger());
// Repeat for filtered contig annotations:
- processAndMergeCSVs(new File(csvAB.getParentFile(), "filtered_contig_annotations.csv"), new File(csvGD.getParentFile(), "filtered_contig_annotations.csv"), getPipelineCtx().getLogger());
+ processAndMergeCSVs(FileUtil.appendName(csvAB.getParentFile(), "filtered_contig_annotations.csv"), FileUtil.appendName(csvGD.getParentFile(), "filtered_contig_annotations.csv"), getPipelineCtx().getLogger());
//NOTE: this folder has many unnecessary files and symlinks that get corrupted when we rename the main outputs
- File directory = new File(outdir.getParentFile(), "SC_MULTI_CS");
+ File directory = FileUtil.appendName(outdir.getParentFile(), "SC_MULTI_CS");
if (directory.exists())
{
//NOTE: this will have lots of symlinks, including corrupted ones, which java handles badly
@@ -425,18 +425,18 @@ public AlignmentStep.AlignmentOutput performAlignment(Readset rs, List inp
getPipelineCtx().getLogger().warn("Unable to find folder: " + directory.getPath());
}
- output.addIntermediateFile(new File(outdir, "vdj_reference"));
- output.addIntermediateFile(new File(outdir, "multi"));
+ output.addIntermediateFile(FileUtil.appendName(outdir, "vdj_reference"));
+ output.addIntermediateFile(FileUtil.appendName(outdir, "multi"));
try
{
- File outputHtml = new File(outdir, "per_sample_outs/" + id + "/web_summary.html");
+ File outputHtml = FileUtil.appendPath(outdir, Path.parse("per_sample_outs/" + id + "/web_summary.html"));
if (!outputHtml.exists())
{
throw new PipelineJobException("Unable to find file: " + outputHtml.getPath());
}
- File outputHtmlRename = new File(outputHtml.getParentFile(), FileUtil.makeLegalName(rs.getName() + "_") + outputHtml.getName());
+ File outputHtmlRename = FileUtil.appendName(outputHtml.getParentFile(), FileUtil.makeLegalName(rs.getName() + "_") + outputHtml.getName());
if (outputHtmlRename.exists())
{
outputHtmlRename.delete();
@@ -460,13 +460,13 @@ private File processOutputsForType(String sampleId, Readset rs, ReferenceGenome
{
boolean isPrimaryDir = "vdj_t".equals(subdirName);
- File multiDir = new File(outdir, "multi/" + subdirName);
+ File multiDir = FileUtil.appendPath(outdir, Path.parse("multi/" + subdirName));
if (!multiDir.exists())
{
throw new PipelineJobException("Missing folder: " + multiDir.getPath());
}
- File sampleDir = new File(outdir, "per_sample_outs/" + sampleId + "/" + subdirName);
+ File sampleDir = FileUtil.appendPath(outdir, Path.parse("per_sample_outs/" + sampleId + "/" + subdirName));
if (!sampleDir.exists())
{
throw new PipelineJobException("Missing folder: " + sampleDir.getPath());
@@ -477,7 +477,7 @@ private File processOutputsForType(String sampleId, Readset rs, ReferenceGenome
{
try
{
- File dest = new File(sampleDir, f.getName());
+ File dest = FileUtil.appendName(sampleDir, f.getName());
if (dest.exists())
{
dest.delete();
@@ -491,7 +491,7 @@ private File processOutputsForType(String sampleId, Readset rs, ReferenceGenome
}
}
- File bam = new File(sampleDir, "all_contig.bam");
+ File bam = FileUtil.appendName(sampleDir, "all_contig.bam");
if (!bam.exists())
{
throw new PipelineJobException("Unable to find file: " + bam.getPath());
@@ -508,14 +508,14 @@ private File processOutputsForType(String sampleId, Readset rs, ReferenceGenome
new File(bam.getPath() + ".bai").delete();
}
- File allContigAnnotations = new File(sampleDir, "all_contig_annotations.csv");
+ File allContigAnnotations = FileUtil.appendName(sampleDir, "all_contig_annotations.csv");
if (!allContigAnnotations.exists())
{
throw new PipelineJobException("Missing file: " + allContigAnnotations.getPath());
}
- File outputVloupe = new File(sampleDir, "vloupe.vloupe");
- File csv = new File(sampleDir, "all_contig_annotations.csv");
+ File outputVloupe = FileUtil.appendName(sampleDir, "vloupe.vloupe");
+ File csv = FileUtil.appendName(sampleDir, "all_contig_annotations.csv");
if (!outputVloupe.exists())
{
//NOTE: if there were no A/B hits, the vLoupe isnt created, but all other outputs exist
@@ -548,18 +548,18 @@ private File processOutputsForType(String sampleId, Readset rs, ReferenceGenome
output.addSequenceOutput(outputVloupe, rs.getName() + " 10x VLoupe", VLOUPE_CATEGORY, rs.getRowId(), null, referenceGenome.getGenomeId(), versionString);
}
- output.addIntermediateFile(new File(sampleDir, "airr_rearrangement.tsv"));
- output.addIntermediateFile(new File(sampleDir, "all_contig_annotations.bed"));
- output.addIntermediateFile(new File(sampleDir, "all_contig_annotations.json"));
- output.addIntermediateFile(new File(sampleDir, "cell_barcodes.json"));
- output.addIntermediateFile(new File(sampleDir, "concat_ref.bam"));
- output.addIntermediateFile(new File(sampleDir, "concat_ref.bam.bai"));
- output.addIntermediateFile(new File(sampleDir, "concat_ref.fasta"));
- output.addIntermediateFile(new File(sampleDir, "concat_ref.fasta.fai"));
- output.addIntermediateFile(new File(sampleDir, "consensus.bam"));
- output.addIntermediateFile(new File(sampleDir, "consensus.bam.bai"));
- output.addIntermediateFile(new File(sampleDir, "donor_regions.fa"));
- output.addIntermediateFile(new File(sampleDir, "vdj_contig_info.pb"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "airr_rearrangement.tsv"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "all_contig_annotations.bed"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "all_contig_annotations.json"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "cell_barcodes.json"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "concat_ref.bam"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "concat_ref.bam.bai"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "concat_ref.fasta"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "concat_ref.fasta.fai"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "consensus.bam"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "consensus.bam.bai"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "donor_regions.fa"));
+ output.addIntermediateFile(FileUtil.appendName(sampleDir, "vdj_contig_info.pb"));
return csv;
}
@@ -621,7 +621,7 @@ public Set prepareFastqSymlinks(Readset rs, File localFqDir) throws Pipe
try
{
// a/b:
- File target1 = new File(localFqDir, getSymlinkFileName(rs.getName(), idx, false));
+ File target1 = FileUtil.appendName(localFqDir, getSymlinkFileName(rs.getName(), idx, false));
getPipelineCtx().getLogger().debug("file: " + rd.getFile1().getPath());
getPipelineCtx().getLogger().debug("target: " + target1.getPath());
if (target1.exists())
@@ -634,7 +634,7 @@ public Set prepareFastqSymlinks(Readset rs, File localFqDir) throws Pipe
ret.add(getSampleName(target1.getName()));
// repeat for g/d:
- File target1gd = new File(localFqDir, getSymlinkFileName(rs.getName(), idx, false, "-GD"));
+ File target1gd = FileUtil.appendName(localFqDir, getSymlinkFileName(rs.getName(), idx, false, "-GD"));
getPipelineCtx().getLogger().debug("file: " + rd.getFile1().getPath());
getPipelineCtx().getLogger().debug("target: " + target1gd.getPath());
if (target1gd.exists())
@@ -648,7 +648,7 @@ public Set prepareFastqSymlinks(Readset rs, File localFqDir) throws Pipe
if (rd.getFile2() != null)
{
// a/b:
- File target2 = new File(localFqDir, getSymlinkFileName(rs.getName(), idx, true));
+ File target2 = FileUtil.appendName(localFqDir, getSymlinkFileName(rs.getName(), idx, true));
getPipelineCtx().getLogger().debug("file: " + rd.getFile2().getPath());
getPipelineCtx().getLogger().debug("target: " + target2.getPath());
if (target2.exists())
@@ -660,7 +660,7 @@ public Set prepareFastqSymlinks(Readset rs, File localFqDir) throws Pipe
ret.add(getSampleName(target2.getName()));
// g/d
- File target2gd = new File(localFqDir, getSymlinkFileName(rs.getName(), idx, true, "-GD"));
+ File target2gd = FileUtil.appendName(localFqDir, getSymlinkFileName(rs.getName(), idx, true, "-GD"));
getPipelineCtx().getLogger().debug("file: " + rd.getFile2().getPath());
getPipelineCtx().getLogger().debug("target: " + target2gd.getPath());
if (target2gd.exists())
@@ -700,7 +700,7 @@ public void addMetrics(File outDir, AnalysisModel model, long dataId) throws Pip
{
getPipelineCtx().getLogger().debug("adding 10x metrics");
- File metrics = new File(outDir, "metrics_summary.csv");
+ File metrics = FileUtil.appendName(outDir, "metrics_summary.csv");
if (!metrics.exists())
{
throw new PipelineJobException("Unable to find file: " + metrics.getPath());
@@ -858,7 +858,7 @@ protected File getExe(boolean useCellRanger7)
private static void processAndMergeCSVs(File abCSV, File gdCSV, Logger log) throws PipelineJobException
{
- File output = new File(abCSV.getParentFile(), FileUtil.getBaseName(abCSV) + "_combined.csv");
+ File output = FileUtil.appendName(abCSV.getParentFile(), FileUtil.getBaseName(abCSV) + "_combined.csv");
try (PrintWriter writer = PrintWriters.getPrintWriter(output))
{
diff --git a/singlecell/src/org/labkey/singlecell/run/CellRangerWrapper.java b/singlecell/src/org/labkey/singlecell/run/CellRangerWrapper.java
index 80ef3c95c..6e89e4b77 100644
--- a/singlecell/src/org/labkey/singlecell/run/CellRangerWrapper.java
+++ b/singlecell/src/org/labkey/singlecell/run/CellRangerWrapper.java
@@ -18,6 +18,7 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -58,7 +59,7 @@ public static Set getRawDataDirs(File outputDir, boolean filteredOnly, boo
Set toAdd = new HashSet<>();
for (String dir : dirs)
{
- File subDir = new File(outputDir, dir);
+ File subDir = FileUtil.appendName(outputDir, dir);
if (subDir.exists())
{
toAdd.add(subDir);
@@ -70,7 +71,7 @@ public static Set getRawDataDirs(File outputDir, boolean filteredOnly, boo
public File getLocalFastqDir(File outputDirectory)
{
- return new File(outputDirectory, "localFq");
+ return FileUtil.appendName(outputDirectory, "localFq");
}
public List prepareCountArgs(AlignmentOutputImpl output, String id, File outputDirectory, Readset rs, List> inputFastqPairs, List extraArgs, boolean writeFastqArgs) throws PipelineJobException
@@ -138,13 +139,13 @@ public Set prepareFastqSymlinks(Readset rs, File localFqDir, List