Question: How to merge mgf files?
gravatar for I0110
2.1 years ago by
United States
I0110120 wrote:

I was wondering if there is an easy way to merge mgf (mass-spec) files with Python and Bioconductor. Thanks!!!

proteomics • 860 views
ADD COMMENTlink modified 2.1 years ago by mobiusklein160 • written 2.1 years ago by I0110120
gravatar for mobiusklein
2.1 years ago by
United States
mobiusklein160 wrote:

If none of the MGF files have parameters set at the top of the file, merging MGF files is as simple as concatenating two text files.

with open("output.mgf", 'w') as fh:
   fh.write(open("a.mgf", 'r').read())
   fh.write(open("b.mgf", 'r').read())
   # or a for-loop if you have more than two files

If there are parameters at the top of both files, and they are not the same from file to file, and you don't care about preserving them, you can skip all the lines in each file before the first occurrence of BEGIN IONS. If you do care about preserving the top-level parameters, there isn't a standard way to merge files, in part because the meaning and interpretation of those parameters aren't standardized.

ADD COMMENTlink written 2.1 years ago by mobiusklein160
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1202 users visited in the last hour