Commit 68f8711d authored by fc-ibb105's avatar fc-ibb105
Browse files

modified 10 files in R

parent 1824162c
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ cvd <- function(
			chr = NA
){
	c_count <- 	hic_file |>
				lapply(
				parallel::mclapply(
					function(x){
						hic_interaction(
							hic_file = x[1],
@@ -20,7 +20,8 @@ cvd <- function(
						][
							,.(sample = base_name(x[1]),chr = chr1,distance,counts = V1)
						]
					}
					},
					mc.cores = length(hic_file)
				) |>
				rbindlist()
	
@@ -64,7 +65,7 @@ plot_cvd <- function(
#	#the contact that longer than 100Mb is rare, and we don't really need the plot the contact longer than 10Mb

	x_breaks <- log10(min):log10(max) |>
				lapply(
				parallel::mclapply(
					function(i)
					{
						if(i < 6)
@@ -74,7 +75,8 @@ plot_cvd <- function(
						{
							data.table(breaks = i, labels = paste0(10^(i-6),"Mb"))
						}
					}
					},
					mc.cores = length(log10(min):log10(max))
				) |>
				rbindlist()

+3 −2
Original line number Diff line number Diff line
@@ -10,9 +10,10 @@ bin <- function(
	if(length(column) == 1)
	{
		if(is.na(column)){
			column <- lapply(
			column <- parallel::mclapply(
							colnames(.data),
							function(i){if(is.numeric(dt[[i]])){i}}
							function(i){if(is.numeric(dt[[i]])){i}},
							mc.cores = length(colnames(.data))
						) |>
						unlist()
		}
+1 −2
Original line number Diff line number Diff line
c.revseq <-	function(
c.revseq2 <-	function(
				seq
){
	seq |>
@@ -22,7 +22,6 @@ c.revseq <- function(
			{
				"C"
			}

		}
	) |>
	unlist() |>
+9 −6
Original line number Diff line number Diff line
@@ -6,21 +6,24 @@ c.topdom <- function(
				window.size = 20,
				subsample.ratio = 1
){
	l.hic <- length(hic_files)

	info_1 <-	hic_file |>
				lapply(
					\(x){hic_info(x)[["chr"]][,hic := x][,.(hic,chr = name,length)]}
				parallel::mclapply(
					\(x){hic_info(x)[["chr"]][,hic := x][,.(hic,chr = name,length)]},
					mc.cores = l.hic
				) |>
				rbindlist()

	info_2 <-	hic_file |>
				lapply(
					\(x)
					{
				parallel::mclapply(
					\(x){
						data.table(
							hic = x,
							chr = chr_list(hic_file = x,chr_list = chr_list)
						)
					}
					},
					mc.cores = l.hic
				) |>
				rbindlist() |>
				merge(info_1)
+7 −6
Original line number Diff line number Diff line
@@ -315,17 +315,17 @@ distribution2 <- function(

	if(random_times > 0)
	{
		align_random <- lapply(
		align_random <- parallel::mclapply(
							1:random_times,
							function(x)
							{
							\(x){
								shuffle(
									align_real,
									ref = genome
								)[
									,exp := paste0("random_",x)
								]
							}
							},
							mc.cores = random_times
						) %>%
						rbindlist()
		random_col <- paste0("random_",1:random_times)
@@ -468,9 +468,10 @@ location <- function(

	if(isFALSE(single))
	{
		lapply(
		parallel::mclapply(
			0:expand,
			core_func
			core_func,
			mc.cores = length(0:expand)
		) |>
		rbindlist()
	}else
Loading