Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69976

CommandLine Option in Python for filtering values from Column

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 <rohan_1925@yahoo.co.in>
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 <rohan_1925@yahoo.co.in>
Subject CommandLine Option in Python for filtering values from Column
To "python-list@python.org" <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 <rohan_1925@yahoo.co.in>
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9093.1397072371.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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 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]

    
  The Python script:

    import sys
    arg = []
        for a in sys.argv:
    arg.append(a) 
            quality = arg[2]


To be 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 reading the 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?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

CommandLine Option in Python for filtering values from Column rohan bareja <rohan_1925@yahoo.co.in> - 2014-04-10 03:23 +0800

csiph-web