CAFE5 icon indicating copy to clipboard operation
CAFE5 copied to clipboard

Potential issue with longest_iso.py

Open jaredbernard opened this issue 2 years ago • 3 comments

Hi there. I would like to use the longest isoform script (which seems to be only nested in the tutorial), but I am getting an error and no output. I also had to make some adjustments to the input files and command -- please tell me if this is wrong.

First, I had to modify this command

$ python longest_iso.py -d twelve_spp_proteins/

to use python3 instead of python after upgrading to the latest python.

Next, the proteome files seem to need to be .fa, not .fasta or .faa as are typically used, so I adjusted the inputs.

However, aside from all that, I still end up with the error

File "tutorial/longest_iso.py", line 9
   print f
         ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print (f)?

I see this line in the script for the command, but a parenthesis doesn't seem warranted. Do you have any suggestions? Thanks.

jaredbernard avatar May 06 '22 17:05 jaredbernard

Python3 requires parens around print statements, so it should be print(f). You can also run the "2to3" application which should be available and will catch many problems converting from Python2 to Python3.

benfulton avatar May 11 '22 13:05 benfulton

Thanks for getting back to me, @benfulton. I adjusted the syntax, but still not getting anything. The only output is a list of .fa files in the directory, but no new ones filtered for longest isoforms. I'll check the 2to3 application to see if other adjustments are necessary.

jaredbernard avatar May 11 '22 14:05 jaredbernard

Hi, having the same problem. I have tried multiple versions of python and made a first try at using the 2to3 application for a fix. This has not worked for me. Thus far I have only tried as below with no luck. I still get only a list of the .fa files in the specified protein director.

2to3 -f all -W -n -o ./cafe ./bin/CAFE5/tutorial/longest_iso.py WARNING: --write-unchanged-files/-W implies -w. lib2to3.main: Output in './cafe' will mirror the input directory './bin/CAFE5/tutorial' layout. RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored ./bin/CAFE5/tutorial/longest_iso.py --- ./bin/CAFE5/tutorial/longest_iso.py (original) +++ ./bin/CAFE5/tutorial/longest_iso.py (refactored) @@ -70,7 +70,7 @@ except: continue

  •    print(fa_file_name + "...done!")  
    
  •    print((fa_file_name + "...done!"))  
    

if name == "main": parser = argparse.ArgumentParser(description=doc, prog="cafetutorial_longest_iso.py") RefactoringTool: Writing converted ./bin/CAFE5/tutorial/longest_iso.py to ./cafe/longest_iso.py. RefactoringTool: Files that were modified: RefactoringTool: ./bin/CAFE5/tutorial/longest_iso.py

jand75236 avatar May 13 '22 01:05 jand75236

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Nov 09 '22 03:11 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Nov 24 '22 02:11 github-actions[bot]