Open shiyi-pan opened 3 years ago
Hi, I find a function 'save_chromosome' can the Chromosome object with TAD definition . I'm not sure it contain the TADs and it's a binary file. Is there a function that can write the TADs into a text file ? thank you very much.
Hi,
Inside Cromosome you have a list of experiments (like here https://3dgenomes.github.io/TADbit/tutorial/tutorial_8-Compartments_and_TADs_detection.html)
Each experiment has an attribute tads (exp.tads) with the list of start and end of border, strength and density. You also have a function to save them to text: https://3dgenomes.github.io/TADbit/reference/reference_experiment.html#pytadbit.experiment.Experiment.write_tad_borders
David
Thank you for your reply,David. here is my code:
crm.find_tad(['NN1138'], n_cpus=8) exp = crm.get_experiment("NN1138") exp.write_tad_borders(density=False, savedata='results/fragment/Chr03_tad_borders.txt', normalized=False)
here is my result:
1 1 4 2.0 2 5 14 3.0 3 15 19 5.0 4 20 29 5.0
I have two questions . am I understand your answer correctly and is the numbers of start and end represent the bins ?
Hi, I want to detect TADs using this amazing software but I met some problem. here is my code, I just have one experiment
from pytadbit import Chromosome from pytadbit.parsers.hic_parser import load_hic_data_from_bam species = 'soybean' base_path = 'results/fragment/{0}/03_filtering/validreads12{0}.bam' bias_path = 'results/fragment/{0}/04_normalizing/validreads12{0}ICE{1}kb.biases' reso = 100000 hic_data = load_hic_data_from_bam(base_path.format(species), resolution=reso, region='Chr03', biases=bias_path.format(species, reso // 1000), ncpus=8) chrname = 'Chr03' crm = Chromosome(chrname) crm.add_experiment('NN1138-2', hic_data=[hic_data.get_matrix(focus='Chr03')], norm_data=[hic_data.get_matrix(focus='Chr03',normalized=True)], resolution=reso) crm.find_tad(['NN1138-2'], n_cpus=8)
I followed this workflow described in tutorial but I confused because there is no outfile , could you give me some advise ? Thank you very much.