Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TADs calls problem #338

Open
shiyi-pan opened this issue Dec 22, 2020 · 3 comments
Open

TADs calls problem #338

shiyi-pan opened this issue Dec 22, 2020 · 3 comments

Comments

@shiyi-pan
Copy link

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/valid_reads12_{0}.bam'
bias_path = 'results/fragment/{0}/04_normalizing/valid_reads12_{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.

@shiyi-pan
Copy link
Author

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.

@david-castillo
Copy link
Contributor

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

@shiyi-pan
Copy link
Author

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:

start end score

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants