Skip to content

Commit f35a605

Browse files
committed
Rename "comment" to "N_observed"
1 parent e6cc63b commit f35a605

4 files changed

Lines changed: 34 additions & 31 deletions

File tree

alldata/bblab_site/tools/isoforms_plot/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ <h3>Transcripts</h3>
474474
</p>
475475

476476
<p>
477-
Three optional fields control how transcripts appear: <code>label</code>, <code>group</code>, and <code>comment</code>. The <code>label</code> appears at the right side above the transcript (typically a gene or isoform name). The <code>group</code> field clusters related transcripts visually—transcripts sharing the same group name are drawn as a block, marked by a vertical line on the left edge of the plot. The <code>comment</code> appears on the right side of the transcript (commonly used for read counts or sample metadata).
477+
Three optional fields control how transcripts appear: <code>label</code>, <code>group</code>, and <code>N_observed</code>. The <code>label</code> appears at the right side above the transcript (typically a gene or isoform name). The <code>group</code> field clusters related transcripts visually—transcripts sharing the same group name are drawn as a block, marked by a vertical line on the left edge of the plot. The <code>N_observed</code> appears on the right side of the transcript (commonly used for read counts or sample metadata).
478478
</p>
479479

480480
<p>

alldata/bblab_site/tools/isoforms_plot/isoforms_plot/compiler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,14 @@ def compile_transcripts(
132132
next_fragment=(next_part.start, next_part.end),
133133
)
134134

135+
# Wrap N_observed in parentheses for display as comment
136+
comment = f"({transcript.N_observed})" if transcript.N_observed else None
137+
135138
compiled_transcripts.append(
136139
CompiledTranscript(
137140
parts=parts_tuple,
138141
label=transcript.label,
139-
comment=transcript.comment,
142+
comment=comment,
140143
)
141144
)
142145

@@ -147,7 +150,7 @@ def compile_transcripts(
147150
for transcript in compiled_transcripts:
148151
current_label = transcript.label
149152
if current_label is not None and current_label == prev_label:
150-
# Remove duplicate consecutive label
153+
# Remove duplicate consecutive label (keep comment intact)
151154
deduplicated_transcripts.append(
152155
CompiledTranscript(
153156
parts=transcript.parts,

alldata/bblab_site/tools/isoforms_plot/isoforms_plot/parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Transcript:
5959
fragments: Sequence[Fragment]
6060
label: Optional[str]
6161
group: Optional[str]
62-
comment: Optional[str]
62+
N_observed: Optional[str]
6363

6464

6565
@dataclass(frozen=True)
@@ -91,7 +91,7 @@ def read_transcripts(reader: csv.DictReader) -> Iterator[Transcript]:
9191
Expected CSV columns:
9292
- fragments: Semicolon-separated list of ranges (e.g., "1-743; 4913-end")
9393
- label: Optional label for the transcript
94-
- comment: Optional comment
94+
- N_observed: Optional number of observations
9595
- group: Optional group name
9696
9797
Each fragment is "start-end" where:
@@ -185,14 +185,14 @@ def read_transcripts(reader: csv.DictReader) -> Iterator[Transcript]:
185185

186186
# Extract optional fields, converting empty strings to None
187187
label = (row.get("label") or "").strip() or None
188-
comment = (row.get("comment") or "").strip() or None
188+
N_observed = (row.get("N_observed") or "").strip() or None
189189
group = (row.get("group") or "").strip() or None
190190

191191
yield Transcript(
192192
fragments=tuple(fragments),
193193
label=label,
194194
group=group,
195-
comment=comment,
195+
N_observed=N_observed,
196196
)
197197

198198

alldata/bblab_site/tools/isoforms_plot/test_isoforms.csv

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
My Isoforms Plot Title
44

55
[transcripts]
6-
fragments,label,comment,group
7-
1-743; 4913-end,vif,(3),My First Group
8-
1-743; 5390-end,vpr,(15),My First Group
9-
1-743; 4913-4962; 5390-end,vpr,(4),My First Group
10-
1-743; 5390-5463; 5976-end,vpu/env,(4),My First Group
11-
1-743; 5976-end,vpu/env,(1),My First Group
12-
1-743; 4913-4962; 5390-5463; 5976-end,vpu/env,(1),My First Group
13-
1-743; 5390-5463; 5976-6046; 8369-end,nef,(14),My First Group
14-
1-743; 4913-4962; 5390-5463; 5976-6046; 8369-end,nef,(7)
15-
1-743; 5976-6046; 8369-end,nef,(6)
16-
1-710; 5976-6046; 8369-end,nef,(2)
17-
1-743; 4913-4962; 5976-6046; 8369-end,nef,(2)
18-
1-743; 5390-5463; 5976-6046; 8369-end,nef,(1)
19-
1-743; 5777-6046; 8369-end,tat,(2)
20-
1-743; 5390-5463; 5777-6046; 8369-end,tat,(1)
21-
1-743; 4913-4962; 5390-5463; 5777-6046; 8369-end,tat,(1)
22-
1-743; 5390-5463; 5960-6046; 8369-end,rev,(3),My last group
23-
1-743; 5960-6046; 8369-end,rev,(3),My last group
24-
1-743; 5390-5463; 5954-6046; 8369-end,rev,(2),My last group
25-
1-743; 5954-6046; 8369-end,rev,(1),My last group
26-
1-743; 4913-4962; 5390-5463; 5960-6046; 8369-end,rev,(1),My last group
27-
1-743; 4913-4962; 5390-5463; 5954-6046; 8369-end,rev,(1),My last group
28-
1-743; 4913-4962; 5390-5463; 5954-end,example user input category,(1),My last group
29-
1-743; 4913-4962; 5390-5463; 6611-end,should not happen,(1),My last group
6+
fragments,label,N_observed,group
7+
1-743; 4913-end,vif,3,My First Group
8+
1-743; 5390-end,vpr,15,My First Group
9+
1-743; 4913-4962; 5390-end,vpr,4,My First Group
10+
1-743; 5390-5463; 5976-end,vpu/env,4,My First Group
11+
1-743; 5976-end,vpu/env,1,My First Group
12+
1-743; 4913-4962; 5390-5463; 5976-end,vpu/env,1,My First Group
13+
1-743; 5390-5463; 5976-6046; 8369-end,nef,14,My First Group
14+
1-743; 4913-4962; 5390-5463; 5976-6046; 8369-end,nef,7
15+
1-743; 5976-6046; 8369-end,nef,6
16+
1-710; 5976-6046; 8369-end,nef,2
17+
1-743; 4913-4962; 5976-6046; 8369-end,nef,2
18+
1-743; 5390-5463; 5976-6046; 8369-end,nef,1
19+
1-743; 5777-6046; 8369-end,tat,2
20+
1-743; 5390-5463; 5777-6046; 8369-end,tat,1
21+
1-743; 4913-4962; 5390-5463; 5777-6046; 8369-end,tat,1
22+
1-743; 5390-5463; 5960-6046; 8369-end,rev,3,My last group
23+
1-743; 5960-6046; 8369-end,rev,3,My last group
24+
1-743; 5390-5463; 5954-6046; 8369-end,rev,2,My last group
25+
1-743; 5954-6046; 8369-end,rev,1,My last group
26+
1-743; 4913-4962; 5390-5463; 5960-6046; 8369-end,rev,1,My last group
27+
1-743; 4913-4962; 5390-5463; 5954-6046; 8369-end,rev,1,My last group
28+
1-743; 4913-4962; 5390-5463; 5954-end,example user input category,1,My last group
29+
1-743; 4913-4962; 5390-5463; 6611-end,should not happen,1,My last group
3030

3131
[donors]
3232
name,position,colour

0 commit comments

Comments
 (0)