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
TypeError: can only concatenate str (not "int") to str #42
Comments
I believe the error is coming from "ch" in the line below being an integer for at least one chr. Can you check all your contigs/chrs to make sure none of them are somehow integers (I see you are saying that already but) |
Thank you for your reply. |
Can you confirm you're using Python3? If you are and are still getting this, then I would recommend attempting to remove the |
Thank you for your reply again, |
after looking at the code, I think the error you're getting is actually a bug in the way we output our error message. Regardless, this is a check to make sure people don't see the #39 error. I'd go through the scaffolds in your fragments + bias file to make sure you have no scaffold which has no valid fragments. You can also throw a |
Thank you for your help one more time! Below I show the bias values of the chr names it printed (and it stopped after the last one) when I ran it by adding 517 75000 1.970547623956338 So is the problem then having 517 0 75000 17395 1 I checked out the #39 and there it seems like any chromosome below bias values all less than 0.5 I should remove actually? It looks like in my case I have quite a lot of those, probably because I mapped the HiC reads to the whole reference genome and happened to run HicPro also on small scaffolds rather than only on actual chromosomes. Anyway at least for this specific error I can say that I tried different things and saw that my error finally went away when I removed the chromosomes (in reality short scaffolds) with zero mappability from Thanks! |
"I checked out the #39 and there it seems like any chromosome below bias values all less than 0.5 I should remove actually? " |
Thank you for your suggestions one more time! As far as I understood from my attempts, it was not the bias threshold, but the mapability value of a zero for the all occurences of a scaffold that led to this error, because the scaffolds with a bias of -1 for example which had some mappability value did go through as I kept them and ran the program successfully with them in there. Thanks |
Hello,
My test run (fithic/tests/run_tests-git.sh) finished successfully, but while running it on my files using this command using version 2.0.7:
python3 fithic.py -f fithic.fragmentMappability.gz -i fithic.interactionCounts.gz -o FitHicAmphioxus -t fithic.biases.gz -r 150000
I received this error:
Reading the contact counts file to generate bins...
Interactions file read. Time took 26.23392629623413
Traceback (most recent call last):
File "/home/user/sarigoel/Programs/FITHIC/fithic/fithic/fithic.py", line 1324, in
main()
File "/home/user/sarigoel/Programs/FITHIC/fithic/fithic/fithic.py", line 323, in main
(binStats,noOfFrags, maxPossibleGenomicDist, possibleIntraInRangeCount, possibleInterAllCount, interChrProb, baselineIntraChrProb) = generate_FragPairs(observedInterAllCount, observedInterAllSum, binStats, fragsFile, resolution)
File "/home/user/sarigoel/Programs/FITHIC/fithic/fithic/fithic.py", line 600, in generate_FragPairs
print("ERROR - the chromosome " + ch + " has " + len(allFragsDic[ch]) + " valid fragments/bins and should be removed from the input fragment information !!! ")
TypeError: can only concatenate str (not "int") to str
Here is how my input files look like:
[sarigoel@myotis AMPHIOXUS]$ zcat fithic.biases.gz | head -n2
Sc7u5tJ_517 75000 1.970547623956338
Sc7u5tJ_517 225000 0.40157523166875075
[sarigoel@myotis AMPHIOXUS]$ zcat fithic.fragmentMappability.gz | head -n2
Sc7u5tJ_517 0 75000 17395 1
Sc7u5tJ_517 150000 225000 2437 1
[sarigoel@myotis AMPHIOXUS]$ zcat fithic.interactionCounts.gz | head -n2
Sc7u5tJ_517 75000 Sc7u5tJ_517 75000 1700
Sc7u5tJ_517 75000 Sc7u5tJ_517 225000 5
I used an old HicPro (version 2.10.0) to generate my initial data and used this command/script to convert it:
python3 HiCPro2FitHiC.py -i Sample1_150000.matrix -b Sample1_150000_abs.bed -s Sample1_150000_iced.matrix.biases -o . -r 150000
These files had these lengths:
3776446 Sample1_150000.matrix
3769 Sample1_150000_abs.bed
3769 Sample1_150000_iced.matrix.biases
and first two lines were as below:
**==> Sample1_150000.matrix <==
1 1 1700
1 2 5
==> Sample1_150000_abs.bed <==
Sc7u5tJ_517 0 150000 1
Sc7u5tJ_517 150000 246623 2
==> Sample1_150000_iced.matrix.biases <==
1.917118534333063673e+00
3.906869898508548156e-01**
Sample1_150000_iced.matrix.biases file had also
nan
values which were I guess converted to-1
.Following the conversion the files kept their original lengths:
[sarigoel@myotis AMPHIOXUS]$ zcat fithic.interactionCounts.gz | wc -l
3776446
[sarigoel@myotis AMPHIOXUS]$ zcat fithic.fragmentMappability.gz | wc -l
3769
[sarigoel@myotis AMPHIOXUS]$ zcat fithic.biases.gz | wc -l
3769
As for the chromosome names, all start with
Sc7u5tJ_
and there is no other special character than an underscore, each followed by a scaffold number.The log file had these lines:
###########
Interactions file read successfully
Observed, Intra-chr in range: pairs= 275495 totalCount= 6213510
Observed, Intra-chr all: pairs= 275495 totalCount= 6213510
Observed, Inter-chr all: pairs= 3500951 totalCount= 7397792
Range of observed genomic distances [0 35250000]
Making equal occupancy bins
Observed intra-chr read counts in range 6213510
Desired number of contacts per bin 62135.1,
Number of bins 100
Equal occupancy bins generated
Looping through all possible fragment pairs in-range_
############
Can you think of a reason that may have caused the error?
Thank you!
The text was updated successfully, but these errors were encountered: