Skip to content

Commit 1323530

Browse files
committed
Add TCR info to prototype description
1 parent 1639340 commit 1323530

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

singlecell/src/org/labkey/singlecell/analysis/AbstractSingleCellHandler.java

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,17 @@ public static String getOutputDescription(JobContext ctx, File seuratObj, @Nulla
10151015
int hashingIdx = -1;
10161016
int saturationIdx = -1;
10171017
boolean hashingUsed = true;
1018+
int riraIdx = -1;
1019+
int traIdx = -1;
1020+
int trbIdx = -1;
1021+
int trdIdx = -1;
1022+
int trgIdx = -1;
1023+
1024+
int totalTNK = 0;
1025+
int cellsWithTRA = 0;
1026+
int cellsWithTRB = 0;
1027+
int cellsWithTRD = 0;
1028+
int cellsWithTRG = 0;
10181029
while ((line = reader.readNext()) != null)
10191030
{
10201031
// This will test whether this is the first line or not
@@ -1029,6 +1040,11 @@ public static String getOutputDescription(JobContext ctx, File seuratObj, @Nulla
10291040
}
10301041

10311042
saturationIdx = Arrays.asList(line).indexOf("Saturation.RNA");
1043+
traIdx = Arrays.asList(line).indexOf("TRA");
1044+
trbIdx = Arrays.asList(line).indexOf("TRB");
1045+
trdIdx = Arrays.asList(line).indexOf("TRD");
1046+
trgIdx = Arrays.asList(line).indexOf("TRG");
1047+
riraIdx = Arrays.asList(line).indexOf("RIRA_Immune_v2.cellclass");
10321048
}
10331049
else
10341050
{
@@ -1063,6 +1079,49 @@ else if ("NotUsed".equals(val))
10631079
double saturation = Double.parseDouble(line[saturationIdx]);
10641080
totalSaturation += saturation;
10651081
}
1082+
1083+
if (riraIdx >= 0)
1084+
{
1085+
if ("T_NK".equals(line[riraIdx]))
1086+
{
1087+
totalTNK++;
1088+
if (traIdx >= 0)
1089+
{
1090+
String tra = StringUtils.trimToNull(line[traIdx]);
1091+
if (tra != null)
1092+
{
1093+
cellsWithTRA++;
1094+
}
1095+
}
1096+
1097+
if (trbIdx >= 0)
1098+
{
1099+
String trb = StringUtils.trimToNull(line[trbIdx]);
1100+
if (trb != null)
1101+
{
1102+
cellsWithTRB++;
1103+
}
1104+
}
1105+
1106+
if (trdIdx >= 0)
1107+
{
1108+
String trd = StringUtils.trimToNull(line[trdIdx]);
1109+
if (trd != null)
1110+
{
1111+
cellsWithTRD++;
1112+
}
1113+
}
1114+
1115+
if (trgIdx >= 0)
1116+
{
1117+
String trg = StringUtils.trimToNull(line[trgIdx]);
1118+
if (trg != null)
1119+
{
1120+
cellsWithTRG++;
1121+
}
1122+
}
1123+
}
1124+
}
10661125
}
10671126
}
10681127

@@ -1090,6 +1149,19 @@ else if ("NotUsed".equals(val))
10901149
{
10911150
descriptions.add("Mean RNA Saturation: " + (totalSaturation / (double) totalCells));
10921151
}
1152+
1153+
if (totalTNK > 0)
1154+
{
1155+
descriptions.add("Total T/NK Cells: " + totalTNK);
1156+
descriptions.add("Fraction T/NK Cells with TRA: " + (cellsWithTRA / (double)totalTNK));
1157+
descriptions.add("Fraction T/NK Cells with TRB: " + (cellsWithTRB / (double)totalTNK));
1158+
descriptions.add("Fraction T/NK Cells with TRD: " + (cellsWithTRD / (double)totalTNK));
1159+
descriptions.add("Fraction T/NK Cells with TRG: " + (cellsWithTRG / (double)totalTNK));
1160+
}
1161+
else if (riraIdx == -1 || traIdx == -1)
1162+
{
1163+
descriptions.add("TCR information not present");
1164+
}
10931165
}
10941166
catch (IOException e)
10951167
{

0 commit comments

Comments
 (0)