scNanoGPS icon indicating copy to clipboard operation
scNanoGPS copied to clipboard

SyntaxWarning in reporter_SNV.py

Open Kyung-TaeLee opened this issue 8 months ago • 5 comments

Hi, thank you for the great tool and recent update. I ran reporter_SNV.py -h to check if it is correctly installed and gave out syntax warning message as follows.

"reporter_SNV.py:223: SyntaxWarning: invalid escape sequence '\.'
  dp_df['REF_no'] = dp_df['MATCH'].str.count("[\.\,]").astype('Int64')"

It seemed like line to find dot or comma so I changed the line to the following.

dp_df['REF_no'] = dp_df['MATCH'].str.count(r"[.,]").astype("Int64")

Would this be plausible and not affect the workflow in reporter_SNV.py? Thank you for your help in advance.

Kyung-TaeLee avatar Apr 24 '25 20:04 Kyung-TaeLee

Hi Kyung-Tae,

Thanks for raising the issue. The pattern is deprecated for python 3.12. I've updated the pattern. Please try it again for the new version.

Regards, Cheng-Kai

shiauck avatar Apr 24 '25 22:04 shiauck

Hi, Cheng-Kai,

Thank you for the reply. I ran the scNanoGPS reporter_SNV.py and gave out following error. I masked the PATH just in case.

Traceback (most recent call last):
  File "reporter_SNV.py", line 555, in <module>
    pileup_df, options = merge_mpileup(CB_list, options)
                         ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "reporter_SNV.py", line 207, in merge_mpileup
    pileup_df['POS'] = pileup_df['POS'].apply(str)
                       ~~~~~~~~~^^^^^^^
  File "[PATH]/scNanoGPS/lib/python3.13/site-packages/pandas/core/frame.py", line 4102, in __getitem__
    indexer = self.columns.get_loc(key)
  File "PATH]/scNanoGPS/lib/python3.13/site-packages/pandas/core/indexes/range.py", line 417, in get_loc
    raise KeyError(key)
KeyError: 'POS'

Could you help me what is the problem here. I have "filtered_SNV_position_list.tsv.gz" and "SNV_matrix.filtered.vcf.gz" generated but got the error. Thank you for your help in advance.

Kyung-TaeLee avatar Apr 27 '25 20:04 Kyung-TaeLee

Hi Kyung-Tae,

This error could be due to some error during running longshot. By default, scNanoGPS delete the meta files to save storage. Could you please try running reporter_SNV.py with additional parameter " --keep_meta 1 " ? With this parameter, the meta files would be kept. So that you can trace them down.

After that, you'll find some meta files, like <cell_barcode>.mpileup <cell_barcode>.vcf. Please check these meta files. If it is convenient, please provide some further information.

Furthermore, could you please try dry-running samtools, bcftools, tabix ?

I tried running a small test dataset under python3.13, and there's no error produced. I'll try running a complete sample.

Hope this helps.

Regards, Cheng-Kai

shiauck avatar Apr 29 '25 18:04 shiauck

Hi, Cheng-Kai,

I ran reported_SNV.py again with " --keep_meta 1" and found that file with "mpileup" suffix are all empty. samtools, bcftools, tabix are all set up and I will leave their version information below fyi.

samtools 1.19.2 Using htslib 1.19.1 bcftools 1.17 Using htslib 1.17 tabix (htslib) 1.4.1

Thank you for your help in advance.

Kyung-TaeLee avatar May 06 '25 00:05 Kyung-TaeLee

Hi Kyung-Tae,

Your environment sounds good. The empty mpileup result is not normal. Please check files "longshot.output.<cell_barcode>.log" and "longshot.output.<cell_barcode>.vcf.gz" If you find any error in "longshot.output.<cell_barcode>.log", then I guess your tmp files might be truncated. Please re-clone scNanoGPS tools (make sure you delete the scNanoGPS tools you had), and then re-run scNanoGPS again. Thanks.

Regards, Cheng-Kai

shiauck avatar May 06 '25 16:05 shiauck