question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

csort modifies input file

See original GitHub issue

I am trying to use cooler csort (version cooler==0.5.3) without much success. My pairs file pairs.txt has the following format:

chr12   74054834        +       chr17   37101300        -
chr10   107716614       +       chr8    74236985        +
...

and the chromosome size file (hg19_chromsizes.txt):

chr1    249250621
chr10   135534747
...

When I run cooler csort hg19_chromsizes.txt pairs.txt I get the following output:

Enumerating chroms...
chr1	1
chr10	2
chr11	3
chr12	4
chr13	5
chr14	6
chr15	7
chr16	8
chr17	9
chr18	10
chr19	11
chr2	12
chr20	13
chr21	14
chr22	15
chr3	16
chr4	17
chr5	18
chr6	19
chr7	20
chr8	21
chr9	22
chrM	23
chrX	24
chrY	25

and after a few seconds my 14GB contact pairs file is converted into a useless 28 byte binary file, along with a new file pairs.txt.tbi, which I guess it’s the failed attempt to index the former with tabix.

Did I misunderstand the usage of cooler csort? Why does it modify the input file?

Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ezoritacommented, Jan 24, 2017

The last version in develop works smoothly. I tried the last commit in master and I wasn’t able to reproduce the input replacement either – the buggy version was the one provided by pip install.

btw, It would be useful to give cooler a version argument in order to ease the debugging process.

Thanks

Eduard

0reactions
ezoritacommented, Jan 24, 2017

Indeed 😃

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to sort a file in-place? - Stack Overflow
You can use the -o , --output=FILE option of sort to indicate the same input and output file: sort -o file file.
Read more >
sorting a file using the sort command and overwrite it
This happens because the input / output file is truncated before its content is actually read, so sort ends up reading an already...
Read more >
cooler/csort.py at master · open2c/cooler - GitHub
cooler/cooler/cli/csort.py. Go to file · Go to file T; Go to line L ... If input file appears gzipped based its extension, read...
Read more >
sort directories by last modified content (recursive)
The last modification time of a directory (think like phone directory, not folder) is the time it was last modified, like when an...
Read more >
Start the sort-merge utility - IBM
-c: Checks input files to ensure that they are correctly ordered according to the key position and sort ordering options that are specified,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found