I have a pandas dataframe that reads in a PAF file from minimap2. What I would like to do is take the first 5 columns of the data from to create a BED file.
I used this to extract the first 5 columns:
import pandas as pd import numpy as np df=pd.read_csv(tag1_paf, delimiter = "\t") #print(df) specific_columns=df.iloc[:,[0,1,2,3,4]] print(specific_columns)
Which outputs this:
read1 47215 20591 21087 + read2 14111 3478 3973 + read3 30861 21367 21855 + read4 4647 767 1257 - read5 11706 9569 9990 +
But now I want to do math on the third and fourth columns depending on the strand its on. For example, if column 5 = "+" add 1000 to the third column.
I can't figure it out on my own - I've tried looking it up and using the series add/sub methods from pandas (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.add.html) but I'm still confused.
If anyone can help that would be very appreciated!