PoonLab / sierra-local

Retrieve HIVdb algorithm as XML and apply locally to HIV sequences
GNU General Public License v3.0
6 stars 3 forks source link

postalign vs nucamino #87

Closed Kanyerezi30 closed 1 year ago

Kanyerezi30 commented 1 year ago

I have got the error below while running with postalign. However, the program runs smoothly with nucamino

searching path /home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/sierralocal/data/HIVDB*.xml searching path /home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/sierralocal/data/apobec_drms.csv HIVdb version 9.4 Aligning using post-align Traceback (most recent call last): File "/home/kanye/anaconda3/envs/HIV-DRIVES/bin/postalign", line 8, in <module> sys.exit(cli()) File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/click/core.py", line 1675, in invoke sub_ctx = cmd.make_context( File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/click/core.py", line 920, in make_context self.parse_args(ctx, args) File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/click/core.py", line 1378, in parse_args value, args = param.handle_parse_result(ctx, opts, args) File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/click/core.py", line 2360, in handle_parse_result value = self.process_value(ctx, value) File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/click/core.py", line 2322, in process_value value = self.callback(ctx, self, value) TypeError: Argument 'value' has incorrect type (expected list, got tuple) Traceback (most recent call last): File "/home/kanye/anaconda3/envs/HIV-DRIVES/bin/sierralocal", line 11, in <module> exit_code = main.main() File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/sierralocal/main.py", line 192, in main count, time_elapsed = sierralocal(args.fasta, args.outfile, xml=args.xml, File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/sierralocal/main.py", line 133, in sierralocal sequence_lengths, file_trims, subtypes, na_sequence = scorefile(input_file, algorithm, program=program) File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/sierralocal/main.py", line 52, in scorefile result = aligner.align_file(input_file, program=program) File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/site-packages/sierralocal/nucaminohook.py", line 250, in align_file _ = subprocess.check_call(cmd) File "/home/kanye/anaconda3/envs/HIV-DRIVES/lib/python3.9/subprocess.py", line 373, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['postalign', '-i', '/tmp/tmppm6f4v5g', '-o', '/tmp/tmp4a2gsk3z', '-f', 'MINIMAP2', '-r', '/tmp/postalign-ref-vuddsj73.fas', '--minimap2-opts', '-w 5 --score-N 0 --secondary no', 'codon-alignment', '--min-gap-distance=15', '790', '2085', 'codon-alignment', '--min-gap-distance=15', '--gap-placement-score=2756/3ins:20,2756/6ins:30,2756/9ins:40,2756/12ins:50', '--gap-placement-score=4994/6ins:20', '2088', '5096', 'codon-alignment', '--min-gap-distance=15', '5095', '5619', 'codon-alignment', '--min-gap-distance=15', '5619', '5771', 'codon-alignment', '--min-gap-distance=15', '5773', '5850', 'codon-alignment', '--min-gap-distance=15', '5849', '6046', 'codon-alignment', '--min-gap-distance=15', '6062', '6226', 'codon-alignment', '--min-gap-distance=15', '6225', '8795', 'codon-alignment', '--min-gap-distance=15', '8797', '9417', 'save-json', 'HIV1gag', '790', '2289', 'HIV1CA', '1186', '1878', 'HIV1pol', '2088', '5093', 'HIV1PR', '2253', '2549', 'HIV1RT', '2550', '4229', 'HIV1IN', '4230', '5093', 'HIV1vif', '5041', '5616', 'HIV1vpr', '5559', '5771', '5773', '5847', 'HIV1tat', '5831', '6046', '8380', '8466', 'HIV1rev', '5970', '6044', '8378', '8650', 'HIV1vpu', '6062', '6307', 'HIV1env', '6225', '8792', 'HIV1nef', '8797', '9414']' returned non-zero exit status 1.

WilliamZekaiWang commented 1 year ago

Hi,

We have seen this issue as well and believe it could be an issue with the post-align module (hivdb/post-align#6). We have posted an issue on their repository about this.

However, if you have a previous environment set up that successfully ran post-align, the post-align option should still work. We are not sure why this is the case

ArtPoon commented 1 year ago

Please see discussion in PR #86

ArtPoon commented 1 year ago

@WilliamZekaiWang can you please run a diff on the click script core.py between the environment that is working and one that is not, to rule out dependency versioning issues?

WilliamZekaiWang commented 1 year ago

There was no difference between the core.py file. Looking at the dependencies on the two environments, they both have the same click version of 8.1.3

WilliamZekaiWang commented 1 year ago

I set up a new environment through exporting one of my environments that had post-align working. However, after installing post-align I still got the same error. I tried for environments in python 3.9 and 3.10.

WilliamZekaiWang commented 1 year ago

I tried installing post-align on older builds and all seemed to still give the core.py issue.

It also seems that the newest version of post-align has some updated dependencies. Notably they updated cython==0.29.35 over the previous cython==0.29.32. I built the newer version and it still gave the same error.

However, the most update version is not used in sierra's docker https://github.com/hivdb/sierra/blob/main/Dockerfile#L24-L30

WilliamZekaiWang commented 1 year ago

I think I managed to fix it. The changes passed the Unit tests too, so the results should still be proper. This worked on the version of post-align that the master branch is using

  1. The first change is in the core.py in where click is installed ~/lib/python3.9/site-packages/click/ on line 2322:
value = self.callback(ctx, self, value)

into

if type(value) == tuple:
    value = list(value)
value = self.callback(ctx, self, value)
  1. Then locate the save_json.py file in ~/lib/python3.9/site-packages/postalign/processors/ on line 25:
for one in value + ('$$', ):

into

for one in value + ['$$', ]:
GopiGugan commented 1 year ago

@WilliamZekaiWang can you confirm that the type of value in the original code is a list?

Can we try 2 above without changing code from the click package?

WilliamZekaiWang commented 1 year ago

I tried only step 2 in both python 3.9.0 and 3.10.0, and both still had the same issue in the core.py file.

I looked further into modifying the save_json.py file and changing the return variable/messing with the value variable. This doesn't eliviate the initial issue with the core.py file or change the error at all

WilliamZekaiWang commented 1 year ago

It seems like the issue is fixed in the post-align repository. I have edited the readme in the dev branch to reflect the new dependencies

ArtPoon commented 1 year ago

@WilliamZekaiWang please issue a PR so we can close this issue (and others!)