R
rohan bareja
I want to write a function in Python for a tab delimited file I am dealing with,to filter out values from a column, and put that parameter as a command line option while running the script.
So,if the limit is 10,the filter out all the rows with values less than 10.
Also,I want to check if thenumber entered is numeric or not else display the message "its not numeric".
So,the command line would be:
python script.py file--quality [limit]
The Python script:
import sys
arg = []
for a in sys.argv:
arg.append(a)
quality = arg[2]
Tobe more specific,the file I am dealing with is a Samfile,and using package
Pysam,which has mapping quality limits in the 5th column.
https://media.readthedocs.org/pdf/pysam/latest/pysam.pdf
Commandline:
python script.py samfile --quality [limit]
I am readingthe samfile using this:
samfile = pysam.Samfile(arg[1], "rb" )
mapqlim = arg[2]
I am a Python beginner,but saw one of the modules,argparse. How can I accomplish this using argparse in Python?
So,if the limit is 10,the filter out all the rows with values less than 10.
Also,I want to check if thenumber entered is numeric or not else display the message "its not numeric".
So,the command line would be:
python script.py file--quality [limit]
The Python script:
import sys
arg = []
for a in sys.argv:
arg.append(a)
quality = arg[2]
Tobe more specific,the file I am dealing with is a Samfile,and using package
Pysam,which has mapping quality limits in the 5th column.
https://media.readthedocs.org/pdf/pysam/latest/pysam.pdf
Commandline:
python script.py samfile --quality [limit]
I am readingthe samfile using this:
samfile = pysam.Samfile(arg[1], "rb" )
mapqlim = arg[2]
I am a Python beginner,but saw one of the modules,argparse. How can I accomplish this using argparse in Python?