Mercurial > repos > jay > pdaug_peptide_sequence_analysis
comparison PDAUG_TSVtoFASTA/PDAUG_TSVtoFASTA.py @ 1:017c42b567ac draft
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 3c91f421d26c8f42cf2671e47db735d2cf69dde8"
author | jay |
---|---|
date | Tue, 29 Dec 2020 03:51:51 +0000 |
parents | e59674e3a391 |
children | 79b1b090990b |
comparison
equal
deleted
inserted
replaced
0:e59674e3a391 | 1:017c42b567ac |
---|---|
12 of1 = open(Positive,'w') | 12 of1 = open(Positive,'w') |
13 of2 = open(Negative,'w') | 13 of2 = open(Negative,'w') |
14 | 14 |
15 n = 0 | 15 n = 0 |
16 m = 0 | 16 m = 0 |
17 | |
18 l = [] | |
19 | |
20 for line in lines[1:]: | |
21 l.append(line.split('\t')[1].strip('\n').strip('\r')) | |
22 l = list(set(l)) | |
17 | 23 |
18 for line in lines: | 24 for line in lines: |
19 | 25 |
20 if '1' in line.split('\t')[1].strip('\n'): | 26 if l[0] in line.split('\t')[1].strip('\n').strip('\r'): |
21 n= n+1 | 27 n= n+1 |
22 of1.write('>peptide_'+str(n)+'\n') | 28 of1.write('>peptide_'+str(n)+'_'+str(l[0])+'\n') |
23 of1.write(line.split('\t')[0]+'\n') | 29 of1.write(line.split('\t')[0]+'\n') |
24 | 30 |
25 if '0' in line.split('\t')[1].strip('\n'): | 31 if l[1] in line.split('\t')[1].strip('\n').strip('\r'): |
26 m= m+1 | 32 m= m+1 |
27 of2.write('>peptide_'+str(m)+'\n') | 33 of2.write('>peptide_'+str(m)+'_'+str(l[1])+'\n') |
28 of2.write(line.split('\t')[0]+'\n') | 34 of2.write(line.split('\t')[0]+'\n') |
29 | 35 |
30 elif Method == 'NoClassLabel': | 36 elif Method == 'NoClassLabel': |
31 | 37 |
32 f = open(InFile) | 38 f = open(InFile) |
45 import argparse | 51 import argparse |
46 | 52 |
47 parser = argparse.ArgumentParser() | 53 parser = argparse.ArgumentParser() |
48 | 54 |
49 parser.add_argument("-I", "--InFile", required=True, default=None, help=".fasta or .tsv") | 55 parser.add_argument("-I", "--InFile", required=True, default=None, help=".fasta or .tsv") |
50 parser.add_argument("-P", "--Postvs", required=False, default='Positive.fasta', help="Path to target tsv file") | 56 parser.add_argument("-P", "--Postvs", required=False, default='FirstDataFile.fasta', help="Path to target tsv file") |
51 parser.add_argument("-N", "--Negtvs", required=False, default='Negative.fasta', help="Path to target tsv file") | 57 parser.add_argument("-N", "--Negtvs", required=False, default='SecondDataFile.fasta', help="Path to target tsv file") |
52 parser.add_argument("-O", "--OutFile", required=False, default='OutFile.fasta', help="Path to target tsv file") | 58 parser.add_argument("-O", "--OutFile", required=False, default='OutFile.fasta', help="Path to target tsv file") |
53 parser.add_argument("-M", "--Method", required=True, default=None, help="Path to target tsv file") | 59 parser.add_argument("-M", "--Method", required=True, default=None, help="Path to target tsv file") |
54 args = parser.parse_args() | 60 args = parser.parse_args() |
55 | 61 |
56 TSVtoFASTA(args.InFile, args.Method, args.Postvs, args.Negtvs, args.OutFile) | 62 TSVtoFASTA(args.InFile, args.Method, args.Postvs, args.Negtvs, args.OutFile) |
57 |