Skip to content
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

raise ValueError("can only convert an array of size 1 to a Python scalar") #14

Open
gnilihzeux opened this issue Apr 12, 2024 · 3 comments

Comments

@gnilihzeux
Copy link

Dear author,
There is an error in my running, how should i solved it?

ValueError: can only convert an array of size 1 to a Python scalar
running: ['miniconda3/envs/rMATS-long/bin/python', 'miniconda3/envs/rMATS-long/rMATS-long/FindAltTSEvents.py'
, '-i', 'li.et.al.2023_human_vascular_smooth_muscle_cells/04-alternative_splicing/ENSG00000174748.22_isoform_diffe
rences_ENST00000307839.10_to_ENST00000307839.10-03d8ejcvf_tmp_isoform.gtf', '-o', 'li.et.al.2023_human_vascular_sm
ooth_muscle_cells//04-alternative_splicing/ENSG00000174748.22_isoform_differences_ENST00000307839.10_to_ENST00000307839.10-0.tsv']
Traceback (most recent call last):
  File "miniconda3/envs/rMATS-long/rMATS-long/classify_isoform_differences.py", line 179, in <module>
    main()
  File "miniconda3/envs/rMATS-long/rMATS-long/classify_isoform_differences.py", line 175, in main
    classify_isoform_differences(args)
  File "miniconda3/envs/rMATS-long/rMATS-long/classify_isoform_differences.py", line 55, in classify_isoform_differences
    classify_isoform_differences_with_temp_files(
  File "miniconda3/envs/rMATS-long/rMATS-long/classify_isoform_differences.py", line 152, in classify_isoform_differences_with_temp_files
    rmats_long_utils.run_command(command)
  File "miniconda3/envs/rMATS-long/rMATS-long/rmats_long_utils.py", line 283, in run_command
    subprocess.run(command, check=True)
  File "miniconda3/envs/rMATS-long/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
    ```
@EricKutschera
Copy link
Contributor

It looks like ValueError: can only convert an array of size 1 to a Python scalar could be from .item() on a pandas object: https://stackoverflow.com/questions/61705173/pandas-can-only-convert-an-array-of-size-1-to-a-python-scalar

I think the error is from

strand = transcriptDF[transcriptDF[8].str.contains(transcript)][6].item()

The -o argument to the script was li.et.al.2023_human_vascular_smooth_muscle_cells//04-alternative_splicing/ENSG00000174748.22_isoform_differences_ENST00000307839.10_to_ENST00000307839.10-0.tsv which includes the two transcripts to compare: ENST00000307839.10 and ENST00000307839.10-0.

The script looks up info in the .gtf file by finding the line that contains the transcript ID. In this case ENST00000307839.10 is a substring of ENST00000307839.10-0 and it finds two lines that match the shorter ID

What was the original command you ran and did the original input files contain ENST00000307839.10-0?

@gnilihzeux
Copy link
Author

Thank you for your reply.

Actually, the problem has already arisen at visualize_isoforms.py. ENST00000307839.10-0 is a isoform of ENST00000307839.10 from flair.

rMATS-long is installed from conda. My command

python ${RMATS}/rmats_long.py --abundance abundace.esp --updated-gtf updated_gtf --gencode-gtf gencode.gtf --group-1 group_1.txt --group-2 group_2.txt --group-1-name $GRP1 --group-2-name $GRP2 --out-dir $AS_DIR --num-threads 16 --use-unadjusted-pvalue

The files about ENSG00000174748.22 are uploaded for your review.
(.gtf and .esp has been added a .txt extention for upload)

ENSG00000174748.22.abundance.esp.txt
gencode.gtf.txt
group_1.txt
group_2.txt
updated.gtf.txt

@EricKutschera
Copy link
Contributor

I think this code should handle one transcript ID being a substring of another: #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants