Skip to content

Commit fb0a306

Browse files
committed
Initial support for the archiving sequence data to SRA while retaining record of files
1 parent f84235c commit fb0a306

File tree

13 files changed

+88
-9
lines changed

13 files changed

+88
-9
lines changed

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/model/ReadData.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@ public interface ReadData extends Serializable
5555
public Date getModified();
5656

5757
public Integer getModifiedBy();
58+
59+
public boolean isArchived();
5860
}

SequenceAnalysis/resources/queries/sequenceanalysis/readData/.qview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<column name="date" />
1313
<column name="description" />
1414
<column name="sra_accession" />
15+
<column name="archived" />
1516

1617
<column name="created" />
1718
<column name="workbook" />

SequenceAnalysis/resources/queries/sequenceanalysis/readData/File Details.qview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<column name="date" />
1313
<column name="description" />
1414
<column name="sra_accession" />
15+
<column name="archived" />
1516

1617
<column name="created" />
1718
<column name="workbook" />

SequenceAnalysis/resources/queries/sequenceanalysis/readData/With Filepath.qview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<column name="date" />
1313
<column name="description" />
1414
<column name="sra_accession" />
15+
<column name="archived" />
1516

1617
<column name="created" />
1718
<column name="workbook" />
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER TABLE sequenceanalysis.barcodes ADD reverse_complement varchar(4000);
2+
ALTER TABLE sequenceanalysis.readdata ADD archived bool default false;
3+
4+
UPDATE sequenceanalysis.readdata SET archived = false;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER TABLE sequenceanalysis.barcodes ADD reverse_complement varchar(4000);
2+
ALTER TABLE sequenceanalysis.readdata ADD archived bit default 0;
3+
GO
4+
UPDATE sequenceanalysis.readdata SET archived = 0;

SequenceAnalysis/resources/schemas/sequenceanalysis.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
<inputType>textarea</inputType>
1515
<description>This should be the forward orientation of the sequence, as it appears in the adapter sequence</description>
1616
</column>
17+
<column columnName="reverse_complement">
18+
<nullable>false</nullable>
19+
<inputType>textarea</inputType>
20+
<description>The reverse complement of the sequence</description>
21+
</column>
1722
<column columnName="group_name">
1823
<nullable>false</nullable>
1924
</column>
@@ -1303,6 +1308,9 @@
13031308
<columnTitle>SRA Run</columnTitle>
13041309
<url>https://trace.ncbi.nlm.nih.gov/Traces/sra/?run=${sra_accession}</url>
13051310
</column>
1311+
<column columnName="archived">
1312+
<columnTitle>Archived to SRA?</columnTitle>
1313+
</column>
13061314
<column columnName="container">
13071315
</column>
13081316
<column columnName="createdby">

SequenceAnalysis/src/org/labkey/sequenceanalysis/ReadDataImpl.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class ReadDataImpl implements ReadData
3030
private Date _modified;
3131
private Integer _modifiedBy;
3232
private Integer _runId;
33+
private boolean _archived = false;
3334

3435
private Map<Integer, File> _cachedFiles = new HashMap<>();
3536

@@ -239,4 +240,15 @@ public boolean isPairedEnd()
239240
{
240241
return getFile2() != null;
241242
}
243+
244+
@Override
245+
public boolean isArchived()
246+
{
247+
return _archived;
248+
}
249+
250+
public void setArchived(boolean archived)
251+
{
252+
_archived = archived;
253+
}
242254
}

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisController.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,6 +3508,14 @@ private JSONObject getDataJsonForReadset(SequenceOutputHandler handler, Readset
35083508
o.put("totalReadData", rs.getReadData().size());
35093509
for (ReadData rd : rs.getReadData())
35103510
{
3511+
if (rd.isArchived())
3512+
{
3513+
o.put("fileExists", false);
3514+
o.put("isArchived", true);
3515+
o.put("error", true);
3516+
return o;
3517+
}
3518+
35113519
ExpData d = rd.getFileId1() == 0 ? null : ExperimentService.get().getExpData(rd.getFileId1());
35123520
if (d == null || d.getFile() == null || !d.getFile().exists())
35133521
{

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisMaintenanceTask.java

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,47 @@ private void verifySequenceDataPresent(Logger log)
7777
{
7878
ExpData d = ExperimentService.get().getExpData(rd.getFileId1());
7979
Container c = ContainerManager.getForId(rd.getContainer());
80-
if (d == null || d.getFile() == null)
80+
if (!rd.isArchived())
8181
{
82-
log.error("Unable to find file associated with ReadData: " + rd.getRowid() + ", " + rd.getFileId1() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
82+
if (d == null || d.getFile() == null)
83+
{
84+
log.error("Unable to find file associated with ReadData: " + rd.getRowid() + ", " + rd.getFileId1() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
85+
}
86+
else if (!d.getFile().exists())
87+
{
88+
log.error("Unable to find file associated with ReadData: " + rd.getRowid() + ", " + rd.getFileId1() + ", " + d.getFile().getPath() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
89+
}
8390
}
84-
else if (!d.getFile().exists())
91+
else
8592
{
86-
log.error("Unable to find file associated with ReadData: " + rd.getRowid() + ", " + rd.getFileId1() + ", " + d.getFile().getPath() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
93+
if (d != null && d.getFile() != null && d.getFile().exists())
94+
{
95+
log.error("ReadData marked as archived, but file exists: " + rd.getRowid() + ", " + rd.getFileId1() + ", " + d.getFile().getPath() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
96+
}
8797
}
8898
}
8999

90100
if (rd.getFileId2() != null)
91101
{
92102
ExpData d = ExperimentService.get().getExpData(rd.getFileId2());
93103
Container c = ContainerManager.getForId(rd.getContainer());
94-
if (d == null || d.getFile() == null)
104+
if (!rd.isArchived())
95105
{
96-
log.error("Unable to find file associated with ReadData: " + rd.getRowid() + ", " + rd.getFileId2() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
106+
if (d == null || d.getFile() == null)
107+
{
108+
log.error("Unable to find file associated with ReadData: " + rd.getRowid() + ", " + rd.getFileId2() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
109+
}
110+
else if (!d.getFile().exists())
111+
{
112+
log.error("Unable to find file associated with ReadData: " + rd.getRowid() + ", " + rd.getFileId2() + ", " + d.getFile().getPath() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
113+
}
97114
}
98-
else if (!d.getFile().exists())
115+
else
99116
{
100-
log.error("Unable to find file associated with ReadData: " + rd.getRowid() + ", " + rd.getFileId2() + ", " + d.getFile().getPath() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
117+
if (d != null && d.getFile() != null && d.getFile().exists())
118+
{
119+
log.error("ReadData marked as archived, but file exists: " + rd.getRowid() + ", " + rd.getFileId1() + ", " + d.getFile().getPath() + " for container: " + (c == null ? rd.getContainer() : c.getPath()));
120+
}
101121
}
102122
}
103123
}

0 commit comments

Comments
 (0)