TypeError: can only concatenate str (not "int") to str

102 views
Skip to first unread message

PavlaN

unread,
Jul 13, 2022, 1:26:26 PM7/13/22
to Fit-Hi-C
Hi, 
I have results from HiC-Pro and used 5000bp resolution specifically for FitHiC2 analysis.
At first, I converted the hiC-Pro data using HiCPro2FitHiC.py and continued as follows:

python3 $FITHICDIR/fithic.py -i fithic.interactionCounts.gz -f fithic.fragmentMappability.gz -o . -r 5000 -t fithic.biases.gz -U 500000 -L 10000 -v


GIVEN FIT-HI-C ARGUMENTS
=========================
Reading fragments file from: fithic.fragmentMappability.gz
Reading interactions file from: fithic.interactionCounts.gz
Output path being used from .
Fixed size option detected... Fast version of FitHiC will be used
Resolution is 5.0 kb
Reading bias file from: fithic.biases.gz
The number of spline passes is 1
The number of bins is 100
The number of reads required to consider an interaction is 1
The name of the library for outputted files will be FitHiC
Upper Distance threshold is 500000
Lower Distance threshold is 10000
Graphs will be outputted
Only intra-chromosomal regions will be analyzed
Lower bound of bias values is 0.5
Upper bound of bias values is 2
All arguments processed. Running FitHiC now...
=========================


Reading the contact counts file to generate bins...
Interactions file read. Time took 48.1283438205719
Traceback (most recent call last):
  File "/home/pavlan/tools/fithic/fithic/fithic.py", line 1324, in <module>
    main()
  File "/home/pavlan/tools/fithic/fithic/fithic.py", line 323, in main
    (binStats,noOfFrags, maxPossibleGenomicDist, possibleIntraInRangeCount, possibleInterAllCount, interChrProb, baselineIntraChrProb) = generate_FragPairs(observedInterAllCount, observedInterAllSum, binStats, fragsFile, resolution)
  File "/home/pavlan/tools/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

Could you, please help me to identify the error?

Is it better to run the analysis with -r 0 when I don't know which resolution is best?

Thanks!

PavlaN

unread,
Jul 14, 2022, 5:52:40 AM7/14/22
to Fit-Hi-C
Problem solved by removing all fragments with 0 mappability from the mappablity files and those with -1 bias from the bias file. Hope this is correct!
```
#remove the unmappable and lines with -1 bias
awk -F '\t' '!($5=="0")' fithic.fragmentMappability > fithic.fragmentMappability1
awk -F '\t' '!($3=="-1")' fithic.biases > fithic.biases1

#zip the files
gzip *

python3 $FITHICDIR/fithic.py -i fithic.interactionCounts.gz -f fithic.fragmentMappability1.gz -o . -r 5000 -t fithic.biases1.gz -U 500000 -L 10000 -v
```
Reply all
Reply to author
Forward
0 new messages