Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.091 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; 'subject:Python': 0.06; 'sys': 0.07; 'delimited': 0.09; 'parameter': 0.09; 'rows': 0.09; 'python': 0.11; 'arg': 0.16; 'be:': 0.16; 'received:156': 0.16; 'subject:values': 0.16; 'tab': 0.16; 'entered': 0.20; 'command': 0.22; 'import': 0.22; 'python?': 0.22; 'to:name:python- list@python.org': 0.22; 'script.': 0.24; 'this:': 0.26; 'values': 0.27; 'function': 0.29; 'file': 0.32; 'option': 0.32; 'running': 0.33; 'subject:from': 0.34; 'display': 0.35; 'url:org': 0.36; 'filter': 0.38; 'mapping': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; '5th': 0.60; 'more': 0.64; 'header:Reply-To:1': 0.67; 'url:pdf': 0.68; 'from:addr:yahoo.co.in': 0.68; 'received:106': 0.68; 'received:106.10': 0.68; 'received:106.10.166': 0.68; 'received:bullet.mail.sg3.yahoo.com': 0.68; 'received:mail.sg3.yahoo.com': 0.68; 'received:sg3.yahoo.com': 0.68; 'limit': 0.70; 'quality': 0.72; 'saw': 0.77; 'column.': 0.84; 'received:106.10.151': 0.84; 'url:latest': 0.91 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 807525.79609.bm@omp1022.mail.sg3.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.in; s=s1024; t=1397071383; bh=eOBENi0D8+Vl3M7OPkktGiCEg/sLAYyJaWpUYnCTunw=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=mGUn2GThDcmScpEezw4z1EUmnnln5rsX//H4PrdhBK125sKTWezFykUwFnZdR073QyOc4hCKgUZlY0HgT/jP48gyMDWvhTyiK0ERtCtlOWk7oTsmrDyWtVwkrAmTkjSZkZKJ3eKKg6/YcF/CWKXUz4S+5Q01UGHdY0JcB1zzr4s= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=Yr56U+QCVvw5hvPwejzaNnZOQbxfKzP7q3PQZC+ththfTcb2DFis4KjMTmRIAKqjY6e+gs3GaxJ1WA7GZb6a7ejWqbL/YPMb4hUiMo7iudBvA3kRxx+XdvapjX08GNrNVHJ9QxoCzYVGz6i1QI52wMzfbLR4HaMNXfwhg9OjtWk=; X-YMail-OSG: 6BTVMyoVM1k5Wi32Rqp_DOWF2Sbneg2MwTY3SsweUitqz14 9yCrLMbExLqvrv72x426jUBdY22AzDk0KkPqrzJ9kvCO8NirdAP.PWAJxzJu dJE3Uepzd85lUya6weJlXIlc9mpFXqrC5N8a3ql0x7tLFkjAfhiej8LqmyAb gP6vXRez2dISk24dirx7A_4HIAV1lRsS4YKqto9QhCQxzGR1a2Z13dpBTJ8E .E_SsNf75b.NZFZpWkjRIc4ABOhPyI7qBql_HF5sAwo_uGxhWqDQptu65ICE m8ywcV5GoRoeqMf_cYl8_6kajbRlajNqipE4xbqUb2jb8tqWfvnBDUv065XD dccgl11SeGFdncCMsefa9GhBEW7fRL6SvJrUhkK_fEz0hiXpndmf7h5P9P9x C1xM8Qm4lQ9QAApmWHEKvGjxFdJ6a1OTfhbQfMhhOgoc4qa827TvVaTLCjLH _kwv2haNxXrO2uc11WYf_QFcbXmuaJcLJZK_c4YnfUQMbFj4TuEG1wDRyhF6 YF9KnHAzSmiGwASb7rAPi4PaxCc9jVVpvDVdrvIGUn.HpNYCFT90rWn8u8bK VpmCy2NnBV3Zq5B2RqJsbvts067zKF0AvuJJSjlKSsjWdxFTM_BkRmbzbDIG Z8..TUnfpVhZ6JkCgJIFEnl6ScK7yu3oFrHRVXdob6YY0LpDF.1ie.Tpzi3y j9bZoILPcefsa_WfL2b8- X-Rocket-MIMEInfo: 002.001, SSB3YW50IHRvIHdyaXRlIGEgZnVuY3Rpb24gaW4gUHl0aG9uIGZvciBhIHRhYiBkZWxpbWl0ZWQgZmlsZSBJIGFtIGRlYWxpbmcgd2l0aCx0byBmaWx0ZXIgb3V0IHZhbHVlcyBmcm9tIGEgY29sdW1uLCBhbmQgcHV0IHRoYXQgcGFyYW1ldGVyIGFzIGEgY29tbWFuZCBsaW5lIG9wdGlvbiB3aGlsZSBydW5uaW5nIHRoZSBzY3JpcHQuCgpTbyxpZiB0aGUgbGltaXQgaXMgMTAsdGhlIGZpbHRlciBvdXQgYWxsIHRoZSByb3dzIHdpdGggdmFsdWVzIGxlc3MgdGhhbiAxMC4KQWxzbyxJIHdhbnQgdG8gY2hlY2sgaWYBMAEBAQE- X-Mailer: YahooMailWebService/0.8.182.648 Date: Thu, 10 Apr 2014 03:23:03 +0800 (SGT) From: rohan bareja Subject: CommandLine Option in Python for filtering values from Column To: "python-list@python.org" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-1785158075-184816965-1397071383=:35192" X-Mailman-Approved-At: Wed, 09 Apr 2014 21:39:30 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: rohan bareja List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397072371 news.xs4all.nl 2858 [2001:888:2000:d::a6]:34155 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69976 ---1785158075-184816965-1397071383=:35192 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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 comman= d line option while running the script.=0A=0ASo,if the limit is 10,the filt= er out all the rows with values less than 10.=0AAlso,I want to check if the= number entered is numeric or not else display the message "its not numeric= ".=0A=0A=0ASo,the command line would be:=0A=0A=A0 =A0 python script.py file= --quality [limit]=0A=0A=A0 =A0=A0=0A=A0 The Python script:=0A=0A=A0 =A0 im= port sys=0A=A0 =A0 arg =3D []=0A=A0 =A0 =A0 =A0 for a in sys.argv:=0A =A0 = =A0arg.append(a)=A0=0A=A0 =A0 =A0 =A0 =A0 =A0 quality =3D arg[2]=0A=0A=0ATo= be more specific,the file I am dealing with is a Samfile,and using package= =A0=0APysam,which has mapping quality limits in the 5th column.=0A=0Ahttps:= //media.readthedocs.org/pdf/pysam/latest/pysam.pdf=0A=0ACommandline:=0A=0A= =A0 =A0 =A0 python script.py samfile --quality [limit]=0A=0A=A0I am reading= the samfile using this:=0A=0A=A0 =A0 =A0samfile =3D pysam.Samfile(arg[1], = "rb" )=0A=A0 =A0 =A0mapqlim =3D arg[2]=0A=0AI am a Python beginner,but saw = one of the modules,argparse. How can I accomplish this using argparse in Py= thon? ---1785158075-184816965-1397071383=:35192 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
I want to w= rite a function in Python for a tab delimited file I am dealing with,to fil= ter out values from a column, and put that parameter as a command line opti= on while running the script.

So,if the limit is 10= ,the filter out all the rows with values less than 10.
Also,I wan= t to check if the number entered is numeric or not else display the message= "its not numeric".


So,the command = line would be:

    python script.py file= --quality [limit]

    
&= nbsp; The Python script:

    import sys<= /div>
    arg =3D []
        fo= r a in sys.argv:
=09    arg.append(a) 
            quality =3D arg[2]


To be more specific,the file I am dealing w= ith is a Samfile,and using package 
Pysam,which has mapping = quality limits in the 5th column.

https://media.re= adthedocs.org/pdf/pysam/latest/pysam.pdf

Commandli= ne:

      python script.py samfile = --quality [limit]

 I am reading the samfile u= sing this:

     samfile =3D pysam.S= amfile(arg[1], "rb" )
     mapqlim =3D arg[2]

I am a Python beginner,but saw one of the modules,argp= arse. How can I accomplish this using argparse in Python?


---1785158075-184816965-1397071383=:35192--