Skip to content

Commit bf1901c

Browse files
committed
fixed bug in reading junction files when just list of files
1 parent 7933738 commit bf1901c

12 files changed

+19022
-495
lines changed

LeafletSC.egg-info/PKG-INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: LeafletSC
3-
Version: 0.2.19
3+
Version: 0.2.2
44
Summary: Alternative splicing quantification in single cells with Leaflet
55
Home-page: https://github.com/daklab/Leaflet
66
Author: Karin Isaev, Columbia University and NYGC

LeafletSC/clustering/find_intron_clusters.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,13 @@ def read_junction_files(junc_files, junc_suffix):
194194
junc_path = Path(junc_path)
195195
print(f"Reading in junction files from {junc_path}")
196196

197-
junc_files_in_path = list(junc_path.rglob(junc_suffix))
198-
if not junc_files_in_path:
199-
print(f"No junction files found in {junc_path} with suffix {junc_suffix}")
200-
continue
197+
if junc_path.is_dir():
198+
junc_files_in_path = list(junc_path.rglob(junc_suffix))
199+
if not junc_files_in_path:
200+
print(f"No junction files found in {junc_path} with suffix {junc_suffix}")
201+
continue
202+
else:
203+
junc_files_in_path = [junc_path]
201204

202205
print(f"The number of junction files to be processed is {len(junc_files_in_path)}")
203206

@@ -400,7 +403,11 @@ def main(junc_files, gtf_file, output_file, sequencing_type, junc_bed_file, thre
400403
#1. Check format of junc_files and convert to list if necessary
401404
# Can either be a list of folders with junction files or a single folder with junction files
402405

403-
if "," in junc_files:
406+
# first check if junc_files is a list already
407+
if type(junc_files) == list:
408+
# do nothing
409+
pass
410+
elif "," in junc_files:
404411
junc_files = junc_files.split(",")
405412
else:
406413
# if junc_files is a single file, then convert it to a list

Tutorials/01_run_intron_clustering.ipynb

Lines changed: 19 additions & 114 deletions
Large diffs are not rendered by default.

build/lib/LeafletSC/clustering/find_intron_clusters.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def read_junction_files(junc_files, junc_suffix):
210210
juncs['cell_type'] = junc_file
211211
all_juncs_list.append(juncs) # Append the DataFrame to the list
212212
except Exception as e:
213-
print(f"Could not read in {junc_file}: {e}")
213+
#print(f"Could not read in {junc_file}: {e}")
214214
files_not_read.append(junc_file)
215215

216216
if len(files_not_read) > 0:
@@ -305,10 +305,13 @@ def mapping_juncs_exons(juncs_gr, gtf_exons_gr, singletons):
305305
def basepair_to_kilobase(bp):
306306
return bp / 1000 # Convert base pairs to kilobases
307307

308-
def visualize_junctions(dat, junc_id, p_usage_ratio=True):
308+
def visualize_local_events(dat, junc_id=None, cluster_id=None, p_usage_ratio=True):
309309

310-
# Filter data for the specific junction ID
311-
dat = dat[dat.Cluster == dat[dat.junction_id == junc_id].Cluster.values[0]]
310+
# Filter dat based on junc_id, or cluster_id
311+
if junc_id is not None:
312+
dat = dat[dat.Cluster == dat[dat.junction_id == junc_id].Cluster.values[0]]
313+
elif cluster_id is not None:
314+
dat = dat[dat.Cluster == cluster_id]
312315

313316
# Get junctions
314317
juncs = dat[["chrom", "chromStart", "chromEnd", "strand", "intron_length", "counts_total", "Start_b", "End_b", "exon_id"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.

data/processed/test_juncs.bed

Lines changed: 18982 additions & 370 deletions
Large diffs are not rendered by default.

dist/LeafletSC-0.2.19.tar.gz

-26.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)