phyloacc / PhyloAcc

PhyloAcc a software to detect the changes of conservation of a genomic region
GNU General Public License v3.0
26 stars 12 forks source link

Standard exception: basic_string::substr: __pos when running without an ID file #41

Closed gwct closed 5 months ago

gwct commented 1 year ago

A behavior I have noticed is that, even when running every element in the input bed file, the program sometimes crashes if it is not provided with an ID file specifying every element. Instead, exceptions along the lines of:

5484 Standard exception: basic_string::substr: __pos (which is 1616173) > this->size() (which is 1341856)
5485 Standard exception: basic_string::substr: __pos (which is 1616278) > this->size() (which is 1341856)
5486 Standard exception: basic_string::substr: __pos (which is 1616428) > this->size() (which is 1341856)

are reported.

If no ID file is given, we should just run on all elements in the bed file, so we need to track down what causes this. Until then, users should always provide an ID file when running PhyloAcc.

xzk-fd commented 1 year ago

Dear Gregg I have met the same problem. After I add the ID file that you sent me, it appears to be working well. image

After some time, it stops. (Segmentation fault (core dumped)) image

gwct commented 1 year ago

Hi again, Can you tell me about how long it runs before you get the Segmentation fault? Thanks.

xzk-fd commented 1 year ago

hi, It takes about 54 minutes.

gwct commented 1 year ago

Yes, actually I see the same thing happening. @xyz111131 or @HanY-H, do you think you could take a look at this?

xzk-fd commented 1 year ago

I can't find something about my problem, can you give me a link?

Do you want me to look at this one https://github.com/harvardinformatics/PhyloAcc-interface/issues/1, but I still don't know how to deal with the problem. Thank you for your any suggestions.

gwct commented 1 year ago

Hey again, No this is the right place for your issue for now. I was able to replicate the problem, but I don't currently have a solution. I tagged a couple of the other developers to take a look, so hopefully they can help out also. I'll take another look today though and we'll keep you updated!

xyz111131 commented 1 year ago

Segmentation Fault can be caused by many different reasons. Please provide your input files for better diagnostics.

gwct commented 1 year ago

Hopefully I'm not speaking too soon, but I think I found the problem: the bed file you sent me is in a 1-based coordinate system rather than the 0-based expected for bed files (https://en.wikipedia.org/wiki/BED_(file_format)#Coordinate_system). Since I have corrected this, it has been running for almost 3 hours. Using the uncorrected bed file I got the Segmentation fault after 2 hours.

To fix this, just subtract 1 from the start coordinate (column 2) of each element in the bed file. I did this with:

awk '{print $1"\t"$2-1"\t"$3}' input.bed > input0.bed

I'll let you know if this ends up erroring out again, but this might be the cause of the problem.

gwct commented 1 year ago

Just to update, the program has been running without Segmentation fault now for about 8 hours! I'm going to take that as a good sign and go ahead and cancel my run, but please let me know if the solution in the previous post works for you.

xzk-fd commented 1 year ago

oh, thank you for your help @gwct, let me have a try.

xzk-fd commented 1 year ago

Hopefully I'm not speaking too soon, but I think I found the problem: the bed file you sent me is in a 1-based coordinate system rather than the 0-based expected for bed files (https://en.wikipedia.org/wiki/BED_(file_format)#Coordinate_system). Since I have corrected this, it has been running for almost 3 hours. Using the uncorrected bed file I got the Segmentation fault after 2 hours.

To fix this, just subtract 1 from the start coordinate (column 2) of each element in the bed file. I did this with:

awk '{print $1"\t"$2-1"\t"$3}' input.bed > input0.bed

I'll let you know if this ends up erroring out again, but this might be the cause of the problem.

yes, it works well ! Thank you very much for giving me so much help all the time!

gwct commented 5 months ago

I think this issue was fixed some time ago.