PazhenkovaEA / ngs_pipelines.py

2 stars 0 forks source link

Error====> TypeError: expected string or bytes-like object #1

Open Siavash-cloud opened 5 days ago

Siavash-cloud commented 5 days ago

Hello,

When I am executing: python callAllele.py --project wolf --primers primer_wolfA.csv I will be faced with this error: WARNING: reference allele table is not found. Alleles will be named within this library. Reference table will be created. Processing Cl366 locus, DAB176 /lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py:190: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method. The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.

For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.

gen["Sample_Name"].replace(to_replace="MERGED_sample:", value="",regex=True, inplace=True) /lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py:250: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy alleles[alleles["flag"] == "N"]["called"] = True /lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py:250: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy alleles[alleles["flag"] == "N"]["called"] = True /lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py:250: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy alleles[alleles["flag"] == "N"]["called"] = True /lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py:250: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy alleles[alleles["flag"] == "N"]["called"] = True Processing Cl380 locus, DAB176 /lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py:190: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method. The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.

For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.

gen["Sample_Name"].replace(to_replace="MERGED_sample:", value="",regex=True, inplace=True) Traceback (most recent call last): File "/lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py", line 420, in main() File "/lisc/user/ardestani/obi3-env/lib64/python3.9/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/lisc/user/ardestani/obi3-env/lib64/python3.9/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/lisc/user/ardestani/obi3-env/lib64/python3.9/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/lisc/user/ardestani/obi3-env/lib64/python3.9/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) File "/lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py", line 230, in main call_allele(row, index) File "/lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py", line 114, in call_allele stutter = find_stutter(row) File "/lisc/scratch/anthropology/Mohandesan-lab/DAB176/callAllele.py", line 100, in find_stutter coordinates += [m.start() for m in re.finditer(mo, row["Sequence"])] File "/usr/lib64/python3.9/re.py", line 248, in finditer return _compile(pattern, flags).finditer(string) TypeError: expected string or bytes-like object

Please let me know how I can solve this problem.

Regards, Siavash

PazhenkovaEA commented 3 days ago

Dear Siavash,

Could you share with me one of the .tab files you got after running the obitools3.py script? It is hard to say what caused the problem without taking a look on the input file.

Best, Elena