Making a manifest file using Python dataframe

I did qiime analysis on 6 samples and now I need to run it on my whole data. I prepared the manifest file first-time using python panda dataframe but I do not know how to change the command after the changes I need to do:

  1. I need to make the forward and reverse sequences in different files
  2. I need to include the absolute paths of all the files
  3. I need to change the header into header-absolute-path
    Does anyone have experience in Python? last time, I had a colleague who helped me writing the code. below are the previous commands of 6 samples. Thanks

Assign to pandas dataframe

result = DataFrame(columns = [“sample-id”, “filename”, “direction”])
for idx, filename in enumerate(filenames):
try:
print(“Processing”, filename)
splitname = filename.split("_")
result.loc[idx, “sample-id”] = splitname[0]
result.loc[idx, “filename”] = filename
result.loc[idx, “direction”] =
“forward” if splitname[3] == “R1” else “Reverse”
except Exception as e:
print(e)

Instead of using dataframe, you can use a more direct option. Since you need to create a .tsv file, just open and write a text file. If you could send some sample ids I can help you even more.

1 Like