Commit c2f605ce authored by María Morales Martínez's avatar María Morales Martínez
Browse files

Delete LAD_intervals-checkpoint.py

parent 632d75f3
import os
import shutil
import pandas as pd
from paths import *
# This script is out from the general analysis pipeline, because it is used to generate the lamin bed files that the pipeline use to determinate the ranges in which the input chromatin bed will be divided in the nuclei.
# Besides the orginal bed with Lamin B1 position,
# these parammeters limits de genomic distance to lamin of each range
LAD_ranges = [0, 250000, 1000000, 2500000, 5000000]
LAD_names = ["0kb", "250kb", "1000kb", "2500kb", "5000kb"]
# Create dir to save bed files
dir_lamin = os.path.join(lamin_b1, "window")
IsideLAD = os.path.join(dir_lamin, "Lamin_B1.InsideLAD.bed")
# Copy original Lamin B1 bed in dir
if not os.path.exists(dir_lamin):
os.makedirs(dir_lamin)
shutil.copy(os.path.join(lamin_b1, "Lamin_B1.bed"), IsideLAD)
# Loop to generate new lamin beds
for dist in range(0, len(LAD_ranges)):
if dist == 0:
continue
# Open original lamin bed
fnam = pd.read_csv(IsideLAD, sep = "\t", header=None,
names = ['Chromosome', 'Start', 'End'])
# Extend the chromatin space occuped by lamin B1 by their ends according to the established ranges.
fnam['Start'] = fnam['Start'] - LAD_ranges[dist]
fnam['End'] = fnam['End'] + LAD_ranges[dist]
fnam.loc[fnam.Start < 0, 'Start'] = 0
nf = os.path.join(dir_lamin, "Lamin_B1." + LAD_names[dist]+ ".bed")
# Save modified lamin bed
fnam.to_csv(nf, header = False, sep = "\t", index = False)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment