bxlab / hifive

Tools for handling HiC and 5C data
MIT License
22 stars 8 forks source link

load_data_from_matrices: Attribute not found #11

Open ArashDepp opened 6 years ago

ArashDepp commented 6 years ago

I am facing to related (possibly) issues:

I am trying to load the hic matrices which I have binned at 20kb resolution (N*M matrix, with approraite row and column names as described in input format for TXT matrices)

1. hifive workded fine till the creation of fend object file from the chromosomes lengths file using the follwing commands: import hifive fend = hifive.Fend(fend.object, mode='w', binned=20000) fend.load_bins(chrom_length_filename, genome_name='MM10', format='len') fend.save()

But next when I run, data = hifive.HiCData(out_filename, mode='w') data.load_data_from_matrices(fend.object, ['chr1.matrix', 'chr2.matrix', 'chr1_by_chr2.matrix']), I get error: AttributeError: 'HiCData' object has no attribute 'load_data_from_matrices'

2. I also tried to run in directly from linux shell, where I am able to generate the binned fend file using the chromosome lengths, But got an error when I tried to load the hic data from matrices to create the HiC-data object.

AttributeError: 'HiCData' object has no attribute 'fends'

This was generated from the following command

hifive hic-data -X /path/to/matrices.txt path/to/fend/ path/to/output.

Can you please help me regarding these issues. I am using the latest (1.5) version of hifive which I installed using pip with python 2.7.11

Thank you.

ArashDepp commented 6 years ago

In my attempt to investigate the error, I opened the 'hic_data.py' file in the hifive folder at github https://github.com/bxlab/hifive/blob/master/hifive/hic_data.py

I appear that the attribute name for loading the binned matrices is defined as load_binned_data_from_matrices, instead of load_data_from_matrices (As given on the documentation page: https://bxlab-hifive.readthedocs.io/en/latest/hic_tutorial.html).

Typing data.load_binned_data_from_matrices inside python appears to be something....So I used it as follows: data = hifive.HiCData(out_filename, mode='w') data.load_binned_data_from_matrices(fend.object, ['chr1.matrix', 'chr2.matrix', 'chr1_by_chr2.matrix'])

but this throws another error: AttributeError: 'list' object has no attribute 'split'' which is probably originating from near 785 in script hic_data.py.

please look into this matter.

msauria commented 6 years ago

Regarding the missing fend file from your first post, you need to include the fend filename in the path given on the command line.

As for the other error, I appreciate you catching this error in the documentation. If you look at the specific requirement of the 'filename' argument of 'load_binned_data_from_matices', if text files at being passed, you need to use an expression with a wildcard matching all desired text matrix files, such as 'chr*.txt' The indication to use a comma-separated list in the function description is incorrect and will be updated.

Please let me know if this doesn't solve the issue for you. Thanks!