python print particular lines from file - python

The background:
Table$Gene=Gene1
time n.risk n.event survival std.err lower 95% CI upper 95% CI
0 2872 208 0.928 0.00484 0.918 0.937
1 2664 304 0.822 0.00714 0.808 0.836
2 2360 104 0.786 0.00766 0.771 0.801
3 2256 48 0.769 0.00787 0.754 0.784
4 2208 40 0.755 0.00803 0.739 0.771
5 2256 48 0.769 0.00787 0.754 0.784
6 2208 40 0.755 0.00803 0.739 0.771
Table$Gene=Gene2
time n.risk n.event survival std.err lower 95% CI upper 95% CI
0 2872 208 0.938 0.00484 0.918 0.937
1 2664 304 0.822 0.00714 0.808 0.836
2 2360 104 0.786 0.00766 0.771 0.801
3 2256 48 0.769 0.00787 0.754 0.784
4 1000 40 0.744 0.00803 0.739 0.774
#There is a new line ("\n") here too, it just doesn't come out in the code.
What I want seems simple. I want to turn the above file into an output that looks like this:
Gene1 0.755
Gene2 0.744
i.e. each gene, and the last number in the survival column from each section.
I have tried multiple ways, using regular expression, reading the file in as a list and saying ".next()". One example of code that I have tried:
fileopen = open(sys.argv[1]).readlines() # Read in the file as a list.
for index,line in enumerate(fileopen): # Enumerate items in list
if "Table" in line: # Find the items with "Table" (This will have my gene name)
line2 = line.split("=")[1] # Parse line to get my gene name
if "\n" in fileopen[index+1]: # This is the problem section.
print fileopen[index]
else:
fileopen[index+1]
So as you can see in the problem section, I was trying to say in this attempt:
if the next item in the list is a new line, print the item, else, the next line is the current line (and then I can split the line to pull out the particular number I want).
If anyone could correct the code so I can see what I did wrong I'd appreciate it.

Bit of overkill, but instead of manually writing parser for each data item use existing package like pandas to read in the csv file. Just need to write a bit of code to specify the relevant lines in the file. Un-optimized code (reading file twice):
import pandas as pd
def genetable(gene):
l = open('gene.txt').readlines()
l += "\n" # add newline to end of file in case last line is not newline
lines = len(l)
skiprows = -1
for (i, line) in enumerate(l):
if "Table$Gene=Gene"+str(gene) in line:
skiprows = i+1
if skiprows>=0 and line=="\n":
skipfooter = lines - i - 1
df = pd.read_csv('gene.txt', sep='\t', engine='python', skiprows=skiprows, skipfooter=skipfooter)
# assuming tab separated data given your inputs. change as needed
# assert df.columns.....
return df
return "Not Found"
this will read in a DataFrame with all the relevant data in that file
can then do:
genetable(2).survival # series with all survival rates
genetable(2).survival.iloc[-1] last item in survival
The advantages of this is that you have access to all the items, any mal-formatting of the file will probably be better picked up and prevent incorrect values from being used. If my own code i would add assertions on column names before returning the pandas DataFrame. Want to pick up any errors in parsing early so that it does not propagate.

This worked when I tried it:
gene = 1
for i in range(len(filelines)):
if filelines[i].strip() == "":
print("Gene" + str(gene) + " " + filelines[i-1].split()[3])
gene += 1

You could try something like this (I copied your data into foo.dat);
In [1]: with open('foo.dat') as input:
...: lines = input.readlines()
...:
Using with makes sure the file is closed after reading.
In [3]: lines = [ln.strip() for ln in lines]
This gets rid of extra whitespace.
In [5]: startgenes = [n for n, ln in enumerate(lines) if ln.startswith("Table")]
In [6]: startgenes
Out[6]: [0, 10]
In [7]: emptylines = [n for n, ln in enumerate(lines) if len(ln) == 0]
In [8]: emptylines
Out[8]: [9, 17]
Using emptylines relies on the fact that the records are separated by lines containing only whitespace.
In [9]: lastlines = [n-1 for n, ln in enumerate(lines) if len(ln) == 0]
In [10]: for first, last in zip(startgenes, lastlines):
....: gene = lines[first].split("=")[1]
....: num = lines[last].split()[-1]
....: print gene, num
....:
Gene1 0.771
Gene2 0.774

here is my solution:
>>> with open('t.txt','r') as f:
... for l in f:
... if "Table" in l:
... gene = l.split("=")[1][:-1]
... elif l not in ['\n', '\r\n']:
... surv = l.split()[3]
... else:
... print gene, surv
...
Gene1 0.755
Gene2 0.744

Instead of checking for new line, simply print when you are done reading the file
lines = open("testgenes.txt").readlines()
table = ""
finalsurvival = 0.0
for line in lines:
if "Table" in line:
if table != "": # print previous survival
print table, finalsurvival
table = line.strip().split('=')[1]
else:
try:
finalsurvival = line.split('\t')[4]
except IndexError:
continue
print table, finalsurvival

Related

Converting a File with Strings into Floats then Adding Them

I have to create a program for my class that reads a file, coverts the lists of numbers within to floats, then adds them all together and prints only the answer onto the screen.
The farthest I've gotten is:
fname = sys.argv[1]
handle = open(fname, "r")
total = 0
for line in handle:
linearr = line.split()
for item in linearr:
item = float(item)
One of the files look like:
0.13 10.2 15.8193
0.09 99.6
100.1
100.2 17.8 56.33 12
19e-2 7.5
Trying to add the converted list to the total (total += item) has not worked. I'm really lost and would greatly appreciate any assistance.
You are almost there. total += item is the correct approach, add that line to your for loop after the conversion to float.
Make sure to print your result at the end with print(total), you probably forgot that too.
For your test file this is giving me the result 419.9593
You can use a generator expression with sum,splitting the lines into lists and casting each subelement to float:
In [9]: cat test.txt
0.13 10.2 15.8193
0.09 99.6
100.1
100.2 17.8 56.33 12
19e-2 7.5
In [10]: with open("test.txt") as f:
sm = sum(float(s) for row in map(str.split, f) for s in row)
....:
In [11]: sm
Out[11]: 419.9593
You can also combine with itertools.chain to flatten the rows:
In [1]: from itertools import chain
In [2]: with open("test.txt") as f:
sm = sum(map(float, chain(*(map(str.split,f)))))
...:
In [3]: sm
Out[3]: 419.9593
On a sidenote, you should always use with to open your files, it will automatically close your files for you.

Find and print same elements in a loop

I have a huge input file that looks like this,
c651 OS05T0-00 492 749 29.07
c651 OS01T0-00 1141 1311 55.00
c1638 MLOC_8.3 27 101 72.00
c1638 MLOC_8.3 25 117 70.97
c2135 TRIUR3_3-P1 124 210 89.66
c2135 EMT17965 25 117 70.97
c1914 OS02T0-00 2 109 80.56
c1914 OS02T0-00 111 155 93.33
c1914 OS08T0-00 528 617 50.00
I would like to iterate inside each c, see if it has same elements in line[1] and print in 2 separate files
c that contain same elements and
that do not have same elements.
In case of c1914, since it has 2 same elements and 1 is not, it goes to file 2. So desired 2 output files will look like this, file1.txt
c1638 MLOC_8.3 27 101 72.00
c1638 MLOC_8.3 25 117 70.97
file2.txt
c651 OS05T0-00 492 749 29.07
c651 OS01T0-00 1141 1311 55.00
c2135 TRIUR3_3-P1 124 210 89.66
c1914 OS02T0-00 2 109 80.56
c1914 OS02T0-00 111 155 93.33
c1914 OS08T0-00 528 617 50.00
This is what I tried,
oh1=open('result.txt','w')
oh2=open('result2.txt','w')
f=open('file.txt','r')
lines=f.readlines()
for line in lines:
new_list=line.split()
protein=new_list[1]
for i in range(1,len(protein)):
(p, c) = protein[i-1], protein[i]
if c == p:
new_list.append(protein)
oh1.write(line)
else:
oh2.write(line)
If I understand you correctly, you want to send all lines for your input file that have a first element txt1 to your first output file if the second element txt2 of all those lines is the same; otherwise all those lines go to the second output file. Here is a program that does that.
from collections import defaultdict
# Read in file line-by-line for the first time
# Build up dictionary of txt1 to set of txt2 s
txt1totxt2 = defaultdict(set)
f=open('file.txt','r')
for line in f:
lst = line.split()
txt1=lst[0]
txt2=lst[1]
txt1totxt2[txt1].add(txt2);
# The dictionary tells us whether the second text
# is unique or not. If it's unique the set has
# just one element; otherwise the set has > 1 elts.
# Read in file for second time, sending each line
# to the appropriate output file
f.seek(0)
oh1=open('result1.txt','w')
oh2=open('result2.txt','w')
for line in f:
lst = line.split()
txt1=lst[0]
if len(txt1totxt2[txt1]) == 1:
oh1.write(line)
else:
oh2.write(line)
The program logic is very simple. For each txt it builds up a set of txt2s that it sees. When you're done reading the file, if the set has just one element, then you know that the txt2s are unique; if the set has more than one element, then there are at least two txt2s. Note that this means that if you only have one line in the input file with a particular txt1, it will always be sent to the first output file. There are ways round this if this is not the behaviour you want.
Note also that because the file is large, I've read it in line-by-line: lines=f.readlines() in your original program reads the whole file into memory at a time. I've stepped through it twice: the second time does the output. If this increases the run time then you can restore the lines=f.readlines() instead of reading it a second time. However the program as is should be much more robust to very large files. Conversely if your files are very large indeed, it would be worth looking at the program to reduce the memory usage further (the dictionary txt1totxt2 could be replaced with something more optimal, albeit more complicated, if necessary).
Edit: there was a good point in comments (now deleted) about the memory cost of this algorithm. To elaborate, the memory usage could be high, but on the other hand it isn't as severe as storing the whole file: rather txt1totxt2 is a dictionary from the first text in each line to a set of the second text, which is of the order of (size of unique first text) * (average size of unique second text for each unique first text). This is likely to be a lot smaller than the file size, but the approach may require further optimization. The approach here is to get something simple going first -- this can then be iterated to optimize further if necessary.
Try this...
import collections
parsed_data = collections.OrderedDict()
with open("input.txt", "r") as fd:
for line in fd.readlines():
line_data = line.split()
key = line_data[0]
key2 = line_data[1]
if not parsed_data.has_key(key):
parsed_data[key] = collections.OrderedDict()
if not parsed_data[key].has_key(key2):
parsed_data[key][key2] = [line]
else:
parsed_data[key][key2].append(line)
# now process the parsed data and write result files
fsimilar = open("similar.txt", "w")
fdifferent = open("different.txt", "w")
for key in parsed_data:
if len(parsed_data[key]) == 1:
f = fsimilar
else:
f = fdifferent
for key2 in parsed_data[key]:
for line in parsed_data[key][key2]:
f.write(line)
fsimilar.close()
fdifferent.close()
Hope this helps

python - Scan through a large file and write lines when conditions met

I was trying to scan with positions from one file through positions in second file to find, if the features are overlaping between them.
I have a file Pt looking like this:
chr10 0 60985
chr10 60988 60990
chr1 165014865 165014867
chr1 1161693 1161695
chr1 158851689 158851689
chr10 64766 64767
chr10 63600 64703
chr11 647696 647697
And file a (it has of course many many lines like the one below):
chr1 1161693 chr1uGROUPERuDELu0u832 TGCTCTTTCCAGAAACCCTCAACCCTGTACGGTCAGGAGGAAACATGGCACCTCCCCTCTGGGG T 63 NormalSupport;MinSampleCount;LowSomaticScore CLUSTER_NUM=5454;CONTIG=GGTGCAGGGAAGCAGGAAGGAAGTGAAGCTCAAAAGCCCCTAGGACAGGGCACCTCCCCTCTGGATGCTCTTTCCAGAAACCCTCAACCTTGTACGGTCAGGAGAAAACACATCCCACAAG;CONTIG_NUM=5840;DOWNSTREAM=GCTCTTTCCAGAAACCCTCAACCCTGTACGGTCAGGAGAAAACACATCCCACAAG;END=1161756;NS=1;READSOURCES=(0:3:0,1:2:13);SOMATICSCORE=19;SVLEN=-63;SVTYPE=DEL;UPSTREAM=GGTGCAGGGAAGCGGGAAGGAAGTGAAGCTCAAAAGCCCCTAGGACAGGGCACCTCCCCTCTGGAT;ensembl_gene_id=ENSG00000078808 GT:GQ 1/.:.
chr1 158851689 chr1uGROUPERuDELu3u4452 GGGGAGTAATTCTTATTCATGATATGAAAACTCTAATGTGTTTCTTATTCCAGAAAA G 100 NormalSupport CLUSTER_NUM=25182;CONTIG=CATATTTTGCTATATCTCACATCATTGTTCATCTGATAATATATGAAAACTACAATGTGTTTCTTATTCCAGAAAGGGGAGTAATTCTTATTCATGAATAAACACTGAAGGAGAAAGATTATGGATCATAGTGGGAAAAGCCACAATACCATCTACATTC;CONTIG_NUM=24300;DOWNSTREAM=GGGAGTAATTCTTATTCATGAATAAACACTGACGGAGAAAGATTATGGATCATAGTGGGAAAAGCCACAATACCATCTACATTC;END=158851745;NS=1;READSOURCES=(0:11:0,1:3:18);SOMATICSCORE=55;SVLEN=-56;SVTYPE=DEL;UPSTREAM=CATATTTTGCTATATCTCACATCATTGTTCATCTGATAATATATGAAAACTCCAATGTGTTTCTTATTCCAGAAAG;ensembl_gene_id=ENSG00000229849 GT:GQ 1/.:.
chr1 165014865 chr1uGROUPERuDELu3u7344 ACTGGCATTAGCTATGCTTCCTTAGGCAGACAGCATGTTGAGAAATTCACATTCATCAG A 100 NormalSupport CLUSTER_NUM=40249;CONTIG=CTCCAGTAAAGAGCATCTTTTAATGAAGTGTATCTGCCTGGGCTAGAAAGGCAGCTGCCTCCACTAAAGCAGGGCTGGTCCAGAAATATTACCACTTGCCTAATCCTTATAGTAATCCTAACTGGCAGGTATTATTATATCCCAATTCACACACTTAGAGG;CONTIG_NUM=38845;DOWNSTREAM=CTTGCCTAATCCTTATAGTAATCCTAACTGGCAGGTATTATTATATCCCAATTCACACACTTAGAGG;END=165014923;NS=1;READSOURCES=(0:32:0,1:9:18);SOMATICSCORE=60;SVLEN=-58;SVTYPE=DEL;UPSTREAM=CTCCAGTAAAGAGCATCTTTTAATGAAGTGTATCTGCCTGGGCTAGAAAGGCAGCTGCCTCCACTAAAGCAGGGCTGGTCCAGAAATATTACCA GT:GQ 1/.:.
chr1 176569763 chr1uGROUPERuDELu3u12313 GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAAAAAAAAAAAAAAAAAA G 100 NormalSupport;LowSomaticScore CLUSTER_NUM=65333;CONTIG=GCGTGGTAGCGGGCGCCTGTAGTCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATGGCGTGAACCCGGGAGGCGGAGCTTGCAGTGAGCCGAGATCACAGAGCTCAAGCTCACAATTCCATTATACTGTTACTC;CONTIG_NUM=62936;DOWNSTREAM=ATCACAGAGCTCAAGCTCACAATTCCATTATACTGTTACTC;END=176569833;NS=1;READSOURCES=(0:14:0,1:8:7);SOMATICSCORE=22;SVLEN=-70;SVTYPE=DEL;UPSTREAM=GCGTGGTAGCGGGCGCCTGTAGTCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATGGCGTGAACCCGGGAGGCGGAGCTTGCAGTGAGCCGAG;ensembl_gene_id=ENSG00000116183 GT:GQ 1/.:.
chr1 184683773 chr1uGROUPERuDELu3u15990 TAACAGTTTGGATGAAAAAAATGTAAGGTATGCTCATCTAAACTATAGATCATTGAAAACTGGTAGTTTAGCTAATGAGATTCAACCTCTAGACCAAAATCTAGAAACAAAACAAAAAAAGAAATTTTGCTGAGTTAAATATAAAAGTTCTAAGTTTACACTAAAAAAAAGAA T 93 PASS CLUSTER_NUM=82731;CONTIG=TAAACCACCACATGCAAAGAGCCTGTAACTGAAAGCTCTTGAGTGCAGTGCCACAAGGCACTGGTTGGGGTCCAACCAAAACTTCTTCCTAACTTGGCTGCTCAAAGGCAGGGTGGAGAACACTCATTTGTCAGCAGACCATAC;CONTIG_NUM=79822;DOWNSTREAM=AACTTGGCTGCTCAAAGGCAGGGTGGAGAACACTCATTTGTCAGCAGACCATAC;END=184683945;NS=1;READSOURCES=(0:12:46,1:0:44);SOMATICSCORE=30;SVLEN=-172;SVTYPE=DEL;UPSTREAM=TAAACCACCACATGCAAAGAGCCTGTAACTGAAAGCTCTTGAGTGCAGTGCCACAAGGCACTGGTTGGGGTCCAACCAAAACTTCTTCCT;ensembl_gene_id=ENSG00000116406 GT:GQ 1/.:.
chr1 193557238 chr1uGROUPERuDELu3u20250 TGTGTGTATACACACACACACATATATGTGTGTATACACACACACACATATATATATGTGTGTATACACACACACACATATATATGTGTGTATACACACAC T 100 NormalSupport CLUSTER_NUM=103112;CONTIG=TTTAAAATAAGGGGGGAAATTTATATATATATATATATATATATGTGTGTGTGTATACACACACACATATATATATATACACACACACATATATATATATATACACATACACACACACACACACACACACACACACACACACTGTTTGAAATA;CONTIG_NUM=99338;DOWNSTREAM=ACATATATATATATGTGTGTATACACACACACATATATATATATACACACACACATATATATATATACACATACACACACACACACACACACACACACACACACACACTGTTTGAAATA;END=193557338;NS=1;READSOURCES=(0:23:0,1:3:26);SOMATICSCORE=60;SVLEN=-100;SVTYPE=DEL;UPSTREAM=TTTAAAATAAGGGGGGAAATTTATATATATATAT GT:GQ 1/.:.
chr1 211021468 chr1uGROUPERuDELu4u5565 ACAAGCTGTTGGGTTATCTCTTTATGATCTTCAACTACACTAAGAAGTGTGTCAATTGTATTCAGAATTCCCATAGCAGTAACTGCTTTGTCATCACTACCTTCTTCATCTGGCCCTGTCTGGATTACTTGGCTAAATGTCATTGCCAACTGTTGTGTCATTTCTACTGCAATAGGAGTAACTTCTTCACTATTTTCACAGATCATTTTCTGAATTACATTGGTAAGGTCATCATTTTCTGTTTCTGTTATAATATGAAGAAGAGCCTGCATTACAGGTCTGATAAATGCTGTGATACATTCTTTAGATTTTTCTTGATTGCTGATAAATACTTGAAGGACAATGGCAGCTTCCACTTTCACAGGCATGTCTCTGTCATCAATCAGACATCTTCTTGTTAGCTCTAAAGCTGTTTGAATGTTCTGATCACTTTTGAACTTTACTTCACAAAAATAGTGAAGTACTCAGCAAGCCCTTGCTCTCATGTAGCCTAGTTCACTGCTGAAGAGAGAGAACACATGATTCTGCAACATGTATTCCATCTGATCATTACAGATCTTTTTCTTCAGAAGTGTTTCAGCTAAAGAGCCAATCATGCAGGGCTCCATCTTTTTTTCAAAGGTCAGCATTGGGTTCTGTAAGAATCTGGTAACAAAATCCCATAGTCTTTTGAAGTACCTCCTTCCTCTTACTATGGGCTGTAAACAAAAGCTTCTGGGCAGCAGTGGCAAAGGAAATGAAATCTTCAGACACATCAAACTTCATGCGTATATACTCGTAAGGGTCTTCTTCCCAAAGTTCCTCATCAGCATCTGTATAACACATCAATGGAAAAATAACATCTTGGATAATGCCTTGTATATGGGGCTTCAGATTCTTCCAGGTGAGAGCATGAGAAACTCCTTGATTAATAGAATTTAATGTCTGTTGTAAAACTTGAGGAGCCATATATTGCTTCTCGTTGTACTGTTATAACACTTTCAATAAAACTTGCTGGACACCAACAACAAATTCCTTCAGAAATACTTGAGCAAATTCATTATACTCCTAGGAAACACTGCCAGAGCTTCCATATCTTTCAAAAAGTCTTGCTAAAATATGTAAGGCCCACTTCTTGCATTTCCATTATGATAACTCAGGTCGGTCATCTTCTTCAATTCGAAGTGTTTCAGTCTTTAAAATTTCTACCCATTCTGTCAGGTTCTGTTGGTTTATCAGTTCCAGTGGTATAGAGTATAGAGTATATACTGAACAAGAGCATAGAGTATATACTGAACAAGATCATAGAAGATCTTGAATATTTGTTTCTGGATGACGACAGACTGATCAGACTGGTCAGAAAGAAGCTGGATAAAATGATCCTTTAGAACTGACAGAAAATGCTGCATTGCTGCTACCAATGGACTCCACTCCTCTAGTTTTTTATACTCATAAGTTTTCACAAGCTGATAAAGGCAAATAATTCCTATCCAACAAGCACTGTTATCACACTGAAGATAAAAGCCAGTTTTGTCCACAATGGCAGTCCAGCAGCTTGGATAATCACGTTTGGTGATGTGATGAATGCATGTAGTAAGCTGTACCCTGATGAGCTCAGGAGGATGGATAATGGCTTCTACAATATTTTCTCAAATACAATGGCAATCTTCTTCTGGAATAGTATAAGGGGATATATACTTTTGTGCTGTTTCTTGACCAGGCCAATACTGTGTTATATTTTTCAAATAGATAACACCTGCCTGTCTCACAGGTAAATCCAGCTGTTCCGACATAGTAATCTGGAGCAGCGTTGAGACAAAATTCAGAGATTTGTGTGCTTCATTGAGCTGGCGCTCCATGGCCTCTTGCAGGGCTGGGTCCATGGTGCCCCGCAGGGCCTCGATAATGGTGTTGGGGTCCATTGCAGCATGAACTAGGTCAAACCCAGGGCTTGAGTGCTACTGGGCCAGGAATAGCACTACTCACTGCACACATGGACCTGCCGCAGCGGCAACTGGCGCAAAAGGGCAATGGTGCAATCTTAACTCACTGTAACCTTGAACTCCTGGGCTCAAGTGATCCTCCCACCTCAGCCTCCCAAGTAGCTGGGACTGCAGGCTCACGCTACCATGCCAAGCTGATTTTGTGTTGTTGTAGAGATAGGGTCTCACTATGTTGCCCAGGCTGGTCTTGAACTCCTGGTCTTAAGCAATCATCCTGCATCAGCCTCCCAAAGTGCTGGATTTACAAGCCTGAGTCACCATGCCTGGCCAATATTTTCAATAGTTAGAGGCAGGATTGAAAAACAATTCCTTTTTGCTTTGCTCAAAATAAGTATTTATGAGCATCCACTTACGAGTTACTGTGCTAGATGCTGGACATACAAATAGAAATAAGACCCAGTTACTGCTGTTGTGGAAAGGGCAACATTAGAGAAATGTTCAGGAAATGGAGGAAAGGCCCTTATCTCAGCTTAAGGAAGCCTTAACTCACTATTGTTTGGCTGAATCTCAAAAATGTACAAACCAATAGGAGTGTCCCCTTCTTCCCTACAGATTCCCTGAAGCCAGTGGGCTGTCTGGCAGGAAAACCAAATACTAACTGTGATTTGCCCATTCTAGAAGGTAAGAGAAGGGATTCAGGGCATGCGTGTAAAGTTAGGCTTTGATGACTTGTGTTAGAAGGTTCAGGAAGAAAGCCGCATCACTTATCCCCTATGGAAAAAAAGGAATGGCCAAGAGAACTTCCTTGAATCCATGAAGAGCTTCCAAAAAGAGAAATTTTAAGTTTAGGGATGATAAGGAGCAGAAAGGCTTGGTCTGCTTTACCTGGTGAGCCTATCAATGCACCCACCAAGCACATGCTTGTTACCCAGCAGAGTGTTGGGCACTAGGGGGTGGAGGAGGATAGAATCTAAGATTACTTTTAGCTCTGAAAATCTCAAGACCATCTAAGTTAGGCTCTTCATTTTACAAAAGACAAAGTGCAGACCCAGAAAAGGCCTTATCCAAAATCACATTACTAGCTCTTGAGTACAAGATTACTAGCAGGCTGCAATCTGGGAAGATGGCTGAAGTGGACTTGACATCATATTAAACTCCAGCATCAGTACTTTGGGCAACATGTAGTCACCAGAGGTCTCTGAGCTGGTGACCAGCTTAGTTAAAACCACTTTCCCCCTTGATAATAGTAAATGCCATTTCCAGTTAAGTTACAGATGACAGATTTTATGGAATGTTTCCACCTTAATGTGCGAGATCTGAATGGTACCTCCATCACTGACATTACATTTTGTTTCTCAACCCTCCTCTTCACAGCTCTTATTAGGAAATCGGGGAAAGTCAGGTGCTGAGGCCCAAAGGAGCTGTGCCTTGCTGGTGTTCCCTCATGAAAGGCTGCAGCCAGAACTGTGTCCTTCCTTCTCAATGCAGGTCTCTATGCTAAACTTGTTCACCCTCTGTTCCAGAGCTTTAGGTGCTCCACACGAAGTACTCTTGAACTCTGTCAACCCTGACCTCTCCCCTGTCATGTAGAAAGGCCTCAAGTGGTAGTTTTTGGAGCTCCCGATCATACAAGCACATGCACCCTTCTCAGGAGAGGGCAATTAGGAAACCTGCTGCTAACTAGAGGTGCCATGGCAGGTGCCAACTGGATCAGTGCAGGATGGAACAGCACATTCCAGACAGCCTCATGAGTTCATTGCTAAGGGTAGAGCTAATTTACAGGAAACATGCAGAGGGTTTGACTGGATCCCCTCTGATACCAGCTGAGCCCAGCTCTCACATGCCTATGGCATGGAGTGGATGGTGCTGGGGCAGGCTTCTCTCAGCCTGACAGCAGAGTAGCTGTCTCCACTATTGAGCCAGGTGTGACCCCAGAATGCCATCTCTACCCCCTCAGCATGGTAGCAATGCCACGGCAGTGAGGATGTGGGGAATGAGGAGCAGCTTAGGAGAGACTAAGGCATTGCAGGACTGAGGTCCACTATGCAGCTCCAGGTCCCCCTACTATGCTCCTTCAAGAACAGTGTTGGTAGTAAGAGATTATCACCAAGTTCCTCTCAACTCAGCAAAACAAGTGGGGAAGCGAGAAAACAAAGGAGGAGGAAGATAGCTTCCTGTGCTGTGAGGACTAATTGCAAGCAAAATATGTGTCAGCTGCCACTGCTCACAGTAAACACTCAACGGATGGTAACCCTAAGGGTTTGGGCTGCAGCTTTAGTGCCCAAATCCTACCTCTATGGAGGGAGTGAGACACTTGGACAACAACAATCAAGGCAGGTGGAGAAAATTCTGGTTTTGCTTGTCCCAAAACAAATCACCTCACCCATAGCAGTGTAAGACAACTAGCATTTTACTATGTTCACAGATTCTGAGCACGAGAAATTTAGAAAAGGCCCAGCAGGATGGCTTGTCTCTCTTTCTTATACCTGGAGCCTCAGCCGGAAAGATTCAAAGACTGGGATGACTTAGTTGGAATCATCTATGAGCCAGTTCATTCACATAACTGGTGGTTGACCCATGCTGTCAGCTAGAACCTGAAGCTGTAAGCTGGAACACCTATACATGGCCCTTCCATGTGGCTCTTTGAATTTCTTTACAGAATGGTAGCTGGGTTCTAAGAGCAGGTGTCCCAAACAAATCACACAGAATCTGTATGACCTTTGATGACTTAGCCTATCACTATAATGTGACTTCTGCCATAGCCACAAGGCTTTCCAGGTTCAAGGGTAGAGAACAAGTATCAAAGGCAAATTTTTAGAAGAACATGTGGAATGGAAGGTAATGTTAAAGCTATCTCTGGAATATACAATCTGCTTCATTTGTCAAGCTAAACATATGCCCCCATAGTCTCCCAATGCAGAGATATTATGTACAATGTCTGGAACAAATATTTTCATATGACAGCTCATTAATTCAGTCCTTACAATAATACTGCAAGGTAATTTATTATTACTCCACGTTTTACCTGAAACTGAGCTCAAAAAGTTTAGATAACTTGACCAAGGTCATATAGTTTTTAAGCACCAAAGCAGTATCAAATCCAGATCTAAATCTGTTAACTACTTGTTAAAACTCAAAGCTCATAGTCTTTAGAGAACATTTTGGGTCAAACTAAATGATCTTGGTTCTAGGGCAGTAGGAATAAGGTAGCAAAGAAAAAAAAAAGGCAGCTGTTCATTTGATGCCTAAATGTTCACAGTGTACACACAATGCTGAAGCTACGCTTTGTAACTCTTAAGTGTTATTTCTTTTGCTAATAAATGCATTTTATGTAAGGAAAGACTTTGAAAAACAGTATCTCCAGATAGAATGGAAGCTGGGCCACCTTGCTAGGCTCTCCTACACCCCAATCGCATTTTCCAAAGTAGGGAGAAAGGTACAGTTCAGAACCTCTGTTTTTCAAACTGGAATAAGGCCTCTCTCTTACTTTTCCCCCAACTCTTTAAGACAGACAGTTTTTATTTTGAAACTTGGCCTAGATTGTGGGGCAAAGCACAACCAAATGAAATGGGTGAATTCCCATTTTGATCCTTATTGTCATTCTCCATCTCAGGTAGCTGATGGATCCAGGCTAAATGTGGGTCAAAAAGTATGTTATAGATCAGCTTTAGTTGAAAAAAAATGTGTATACACCAATACAACTCAATGGGGGAATAAAAACTTTTTCAACAAATAGTGTTAAGACAACTGGATATCTGCATGCAAGTGAATGAAGTTGGACCCCTACCTCACACCATACACAAAATTTAACTCAAAATGGATGATAGTCTTAATTGTAAGAACTAATGCTCTAAAACTCTTAGATGAAAATATAGGGGCAAATCTTTATGACCCTGAGTTAGGCAAAGCCTTTTTAATTGTGACACCAAAAGTACAGTCTACAGAAGAAAACTAGAAAAAATGGACTATATGAAAACCTAAACTTTTGTACTGCAAAAGATACCATCAAGCTAGTAAAAAATGCAACCCACAGACTCGCAGAAAATATTTGCAAATAAAATACCTTATAAGAGATTTGTATCCAGAATATATTACAAAAAACTCATAACTCAATAGTGAAAAAATAACCCAATTAAAAATAGGCAAAGAATCTAAATAGACATTTCTCCAAAGAAGATATAGAAATGGCCAATAAGCACATGAAAAGATGTTCAACATCCCTAGTCATACGGGAAATGCAAATCAAAATCACAATGAGACATCACTTTACACCCATTAAAATGGCCATAATCAAAACGACAAGTGTTGGTGATGATGTAGAGACATTAGAACACTGAAATTGTTGGAAGAATGTAAAGTGGTGCAGATGCTTTGGAAAACAGTTTAGCAGTTCCTCAAGATGTTAAATGTGGAGTTACCAGATGACTCAGCAATTCCACTCCTAAGTCTATACCCAAAAAAGGCAGAAACAAATGTCCATATGAAAACTTGTACATGAATGCTCATAATGTTCATAGGAACATTGTTCATAATGGCCAAAAATGTGAAAACAGCCCATATACCCATCAACTGATGAACAGATGAATTAGATGTGGTATAGCCATACAATAAATTATTATTCAGTAATAAAAAGGAATGAAATACTGATAAATGCTACAAAATATTAGAACCTTGAAAATGTTATTCCAAGTGAAATAAGCCAGTCACAAAAGACCACATATTGTACAATTCAATTTATATGAAGTGTCCAGAACAGGTAAATCTACATTTAGAGAAAGTAGATTAGTGGCTGCCTAGGGCTAGGAAATGTGAGGAGAAATGGAAAGTGACTGAAAATGGGTATGGGGTTTCTTTTGGGAGTTATGAAAATGTTCTGAAATTGATAGTGGTGATGGTTGCACAACTCAATAATATACTTAAAACTATTGAATTGTACATTTTAATTATGCAAATTGTATGGTAGGTGAGTTTTATTTCAATATTTATATCCACACACACCTACACATAGAATTATATGTATATGTTTACACACACACACACACACACACACACACACACATATATATATATATATGTGTCCAAAGCAAATTCATATTAAAGTGGGGGCAATGTCAAGTATAGAAAACCACCCACAGATACTCCTCTGCTTTAGCCTAACATGTGGCTGTGTGACCAAAGGTACTGTGAAAAGCAATTAGATGGTGTTTTCTGAAAAAAAATTTTATTGAGGTATAATTTACATGTGACAAAGTACTCCCATTTCAGTTCATAGTTTGATGTGTTTTCACAAATGTGACCACCATATAACCAACACATTCAAGATACAGAATATTTTTATTACCCCAAAAAGTCCCTTGTGCCCCTCTGTCTCAAAATGCCCAACCCTAGGCAACAATTGATCTACTTTATGTCATTTTAAGTAAGTTTTGCCCTTTTCTATAATTCCAGATAAATTAAATCCTACAGCATGTACTATTTGGGACCTGGACTTTTTTATAACTCAGGATAATATATTTGAGATTCAACCATGTGTCATGCATATCTCTAATACATTGCTTTTTTATTGCTGAGAGTATTCCCTTATATAAATAGACTAAAGTTTGTTTTGCACTCATCTGCTTAAGGACATTTGATATTTTTCCCTCATTTTAGTTATTATGAACACTGATATACAAGTTTTTGTGTGAACATATGTTTTCACTGCTCTTTGGTAAATGAACAGAAGTGGAAACACTAGGTCTTATAAGTGTATGCCTAACTTTATAAGAAACTGCCAACCTGATTTCCAAAATGTTAATACTATTCTACATACCCACAAGCAATATATGTAAGTCTTTTTAATTGTATTCATATAGTGGGTATCTCATGTAGTTTTCAATTGCCTTTCCTTGATGACTAATTAAATGGAACATCTTTTCATGTGCCTTTGGCCATTCATGTGTGCGTGTAAAGTGTCTGTCCAAATCTTTTGCCTATTTAAAAAATTTATTTTTAATTGAGTTGTATAAGTTTTTTTTAATACATTCTGGATTCAAACCTTTATCAGCTTAGTCTGTGGCTAAAAATTTCATTTTCTTAATGGTGTCTTTCTTAATAGTGCCTTTGATAAAGTCTAATGTATAATTTTTTCTTTTATGTTTCAAATGTTTTGTGTCGTAAGAAATCTTCGCATATGCCAATGTTGAAAAACTTCTAGTTTTACAGTTTTAATTTTTATGTTTCAGTATACTACCTATTTCAAGTTAATTTTTGAGTCTACAGTAAAGGGTTGAAGTTCATTTTTTGTATATGAATATCCAATTTTGTAGAACCATTTGTTGAAAGCCTATTTCCCCACTAAAATATCTTCTTAACAACATTTAATCACAAGATTCTTCATTTCCCTTTTATAGTCACACCCACTTCCTTCCAACTTTCCTTTAATCCTCTTCTCATTAACTCCTACCAACCACTAATCTGTTTTCCCTTTCTATAATTTGGTCATTTCAAGAATATTGACTATATGGAATCATAAAGTATATAACCTTTTGGGATTTGCTGTTTATTCTTTGCATTTATCCATGTATGATGTTTTTCCTTCATTTGTATAGATCTAAATTTCATTGATAGTATTTGCCTTGCATCTGAAGAACTTGCATTTTAAGTCAGCTGGTGAATAATTCTGTCAGCTTTTGTTTGCCTGAAAAAGTTTTTATTTCATATTTATTTTTGAATGGTATTTTTATTGGATATAGAATTCTAGGTTGACAGTTTGCTGTTTTTGTTACAGCTCTTTAAAGACGTCATGTCATTTTCTTCTGATTTAAAAGTTTCTGACAAGACATATGTGAGTATTGTTATCTTTGTTCCTCTGTATGTAATTTTTTTGTCAGCTCTTAAAATTTTCTCTTTATCAATTTTGTTCAGTAATTTGATCATGAACTCCTTTGGTGTGATTTTATTTTGTGTTTATCCTTCTTGGAGTTGTTGACCTGCTTGGATCTATGAGTTTATAATTTTCATAAAATATGAAAAGTTTTTAGCCACTACTTGTGATATTTTTTCTGCCCTTCATCCTTTCTGGGACTCCAGTGATATGCATATTTACAATAGCTGCTTAAAAGACCTTGTTTGTTAATTCTATTTTCTCTGTCATTTTAGGTCTATTTCTGTTAACTGATTTTTCTCCTAGTTATAAGTCGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGCTTTTAGGCATGCCTGGTAATTTTGGATTGGATGCTGGACATTGCGCCTTCATATTGTTGAATGCTGGATATTGTCCTCTTTAATGGATGTTGAACTGTGCTCTTACTGGCAGTTAACTTAATTACATATCAGCTTGATCCTTTTTTAGGCTTTATTAAAACTTTATTAAGTAGACTTTACTCTAGGGCTTATTTAGTCCTATAACTAAGCTGTGACTTATTTTGGAATGCCCTCAATATTAAGCAAGGACCCTAAATTTACCCTGGCTGGTCATAACTCAAACTTCTACCAGCCCTGTATTGCCTCTGGAAATATTCAACTTACAGATACCTGGTAGTTCTTTGCCTGGCTTGTGCAATTTCAGCCTACATATAGCAGTCAGCTGTAGTTACAAGAGGAATGCTATAAAGATCCTCAGCATTTTCTCTACTGAGCACATTCCAGCCACTCAGCCTCTTCAAATTCAAATTTTTGTCTTCTCAACTCTGTGATATCATGCTCTTCTTGAGTGTGTATTGTGGTCCAGAAAGTATCTCCAGGCAGAAAGTTGGTATTATCATAGGTCTTATCTCATTTGTTTCCTTTCTCTGAGGAGTCACAGAACTGTACTAATTACCAAAAGGAGTTTTTTTCATAGATTTTTGTCTGGTTTTCTAGTTGTTTACAGTAAGAGAATAAGTCCAACTCCATTCACTCTCTTGTGTCTGGAAGTAGAAATCACTGATATTATCTATGTTAATACAGTGAAAAAACATCCAGTGTTGTCCCTCTTTCCATCCTCACCCCCACACCTCCACCACTAATACTGTCTCAGTGATGTGCAATATCCAAGGCTTGATTTAGGTCTAATGAATATCTCTCAACACAGAACACTTTGGGTTTCCCAGCACAAGAATTGAAAAAAGCACATGGTACTCTCCCAGCTGAGATTCTTAGCCTCTTTTTTCCCCTACTGTGAGCAGTGTCACCCAGGTGCCCTCACTCATCTATTTTAAATACACTCACCATCTCTGCTAACAGCTTCAGCCTCTGTTAATCAGGTAGCTTTTCATTAATGTTCTTATCCTTGTCCCAGCATCTTATTTGTCATGCTTTATTAGTAGACATGATAAGTCATAAATCTTAGTTCCTCTTAGCTTCTTAGTATCTGTTGTCAAGTTGAAGATCCCAGACAGAGGGAGATGAGAACTGGTTCATTACAGAGTGACTCTTTCTAATATCTCCTTGGTTCTTTATGATACTAATACATTCTTCCCACTGCAGTTGCCTTTTTCTCTATTTAGCTCCAATACAATTCATAGAAATGAGATCATTCGGCTTAAGGGTACATTATCTTCACTTCAACCCATCCTTCTTTAAGATGAACAATGCTGCCTTTAGATTCTGATACTGGCTCTGCCACTTATTAGCTGGATAGCCCCAGACAATTTACTGACTCTGAGTTTGTTTCCATACTTATGGAATAGGGAAAATATATTCTGCATATCTCATGGAGTGGCAACAAAAGCCAAAATTGACAAATGGGATCTAATTAAACTAAAGAGCTTCTGCACAGCAAAAGAAACTACCATCAGAGTGAACAGGCAACCTACAGAATGGGAGAAAATCTTCACAACCTATTCATCTGACAAAGGGCTAATATCCAGAATCTACAATGAATGCAAACAAATTTACAAGACAAAAACAAACAACCCCATCAAAAAGTGGGCAAAGGACATGAACAGACACTTCTCTAAAGAAGACATTTATGCAGACAAAAAACACATGAAAAAATGCTCACCATCACTGGCCAACAGAGAAATGCAAATCAAAACCACAATGAGATACCATCTCACACCAGTTAGAATGGCAATCATTAAAAAGTCAGGAAACAACAACTGCTGGAGAGGATGTGGAGAAATAGGAACACTTTTACACTGTTGGTGGGACTGTAAACCAGTTCAACCATTGTGGAAGTCAGTGTGGCAATTCCTCAGGGATCTAGAACTAGAAATACCATTTGACCCAGCCACCCCATTACTGGGTATATACACAAAGGACTATAAATCATGCTGCTATAAAGACACATGCACACGTATGTTTATTGCGGCATTATTCACAATAGCAAAGACTTGGAACCAATCCAAATGTCCAACAAAGATAGACTGGATTAAGAAAATGTGGCACATATACACCATGGAATACTATGCAGCCATAAAAAAGGATGAGTTCATGTCCTTTGTAGGGACATGGATGAAACTGGAAATCATCATTCTCAGTAAACTATCGCAAGAACAAAAAACCAAACACCGCATATTCTCACTCATAGGTGGGAATTGAACAATGAGAACACATGGACACAGGAAGGGGAACATCACACTCTGGGGACTGTTGTGGGGTGGGGGGAGGGGGGAGGGATAGCATTGGGAGATATACCTAATGCTAGAGGACGAGTTAGTGGGTGCAGCGCACCAGCATGTCACATGTATACATATGTAACTAACCTGCACATTGTGCAGATGTACCCCAAAACTTAAAGTATAATAATAATAAATTAAAAAAAACAAAATATATACATAATATGATCTCGGCTATGGAAAAGAAAAACATTCAGTGGAAAAAAGCTTAAAGGGAAGAGCACCAAAAAAAAAAAAAAAAAAAGATCAAGCAAGATAATCGATGTTAAGTACTTTATATAGTGCCTGTACCATGGTAAATGCTTAATAATTGTTAGCTATGATGACAATAATGATGATTAAAATGGTCTTTCCATACACTCTGCATACCATCCCTCTGACTGACCTGATGATTATAATTATTCCCTAACTACTAGCAAAGAAGCTTCAATCTCCCTTCACTTCTGCTTTTAAACAGTTTTCTCCTATTTTACAAAAAAGAGTGTGTCCTTTTCTTCCCTTTTCCAGCTCTTCATAAACACAGTGTATTAGTCCATTCCTTCATTGCTATAAATAAATACCTGAGACTGGGTAATTTATAAAGAAAAGAGGTTTAATTGTCTCATGGTTCTGCAGGCTGTACAGAAAGCACGATGCTGACATCTGCTCAGCTTCTGGGGAGTCCTCAGGAAACTTACAATCATGGCAAAAGGTAAAGGGGGAGCAAGGTGTCTTAC A 100 PASS CLUSTER_NUM=25425;CONTIG=TGGAAGGCAACTGTCGTTTAAGATGAAAAACAGTGATAACTGCTGAGAAATCTCAGCCTTAAGTGTGTTGAAAGTTGATAATGTCCATCTATGTGGTGAACAATTTGTGAAACAAGACTGTCAAAGAGAGTTATAGGTTCTTGGAAGTAAGAGGCAACATCTTATGATCAAGCTGTTGGGTTATCTCTTTATGATCTTCAACTACACTAAGAAGTGTGTCAATTGTATTCAGAATTCCCATAGCAGTAACTGCTTTGTCATCACTACCTTCTTCATCTGGCCCTGTCTGGATTACTTGGCTAAATGTCATTGCCAACTGTTGTGTCATTTCTACTGCAATAGGAGTAACTTCTTCACTATTTTCACAGATCATTTTCTGAATTACATTGGTAAGGTCATCATTTTCTGTTTCTGTTATAATATGAAGAAGAGCCTGCATTACAGGTCTGATAAATGCTGTGATACATTCTTTAGATTTTTCTTGATTGCTGATAAATACTTGAAGGACAATGGCAGCTTCCACTTTCACAGGCATGTCTCTGTCATCAATCAGACA;CONTIG_NUM=24722;DOWNSTREAM=TCAAGCTGTTGGGTTATCTCTTTATGATCTTCAACTACACTAAGAAGTGTGTCAATTGTATTCAGAATTCCCATAGCAGTAACTGCTTTGTCATCACTACCTTCTTCATCTGGCCCTGTCTGGATTACTTGGCTAAATGTCATTGCCAACTGTTGTGTCATTTCTACTGCAATAGGAGTAACTTCTTCACTATTTTCACAGATCATTTTCTGAATTACATTGGTAAGGTCATCATTTTCTGTTTCTGTTATAATATGAAGAAGAGCCTGCATTACAGGTCTGATAAATGCTGTGATACATTCTTTAGATTTTTCTTGATTGCTGATAAATACTTGAAGGACAATGGCAGCTTCCACTTTCACAGGCATGTCTCTGTCATCAATCAGACA;END=211033725;NS=1;READSOURCES=(0:33:68,1:0:69);SOMATICSCORE=60;SVLEN=-12257;SVTYPE=DEL;UPSTREAM=TGGAAGGCAACTGTCGTTTAAGATGAAAAACAGTGATAACTGCTGAGAAATCTCAGCCTTAAGTGTGTTGAAAGTTGATAATGTCCATCTATGTGGTGAACAATTTGTGAAACAAGACTGTCAAAGAGAGTTATAGGTTCTTGGAAGTAAGAGGCAACATCTTATGA;ensembl_gene_id=ENSG00000143473 GT:GQ 1/.:.
chr1 249175897 chr1uGROUPERuDELu4u25993 CCATACTGAACTATTAAAGTTATTTGAAATGACAATTGTAATAATATCTTCCTTGAGGAGTTCTACAATCTTTGCTGTTATTTCTTTAAGTCCTTCCTTTAATGAGTACTGTTTGGTGCATGTAACCTGCTGTGGTGTAGACAGTGTTATGGACTTCATTTTAATTTGAACTAGGTTAGAAAATTTTAGTTCCTCTAGTTTCCTTTAATATAAGTTAAAAAGATTTGGAATAAAATTCATTCCTGTAATGTCTTATAATTTGGGTGAGCAGTAAAAAGTGCATAGAGCAGTATAGAAGCAGAGG C 100 PASS CLUSTER_NUM=140439;CONTIG=TACTGAACTATTTAGATATCCCTGTGGTAATGTTTTGAATTGGTATTGTTTACCTTCCCATGTAAAGTTGGTATATTCCTGGCTTGCTTTATTTATTGGTTTGGCAAAGAACACATCTGACATGTCTATGATTGTATAGTATTTGTCATTATGATTAATGATCTTATTAACTAGCTCTTCTACATCTGGTAATGCTCTTGGCATTTTAGTTGAGACTTTATTTAAATTTCTATAGTCAATAGTTAATCTATAGCTCCTGTTTGTTTTTAAGACAGGCCAAGAAAGCTTCAAGTTTATTTACCTCTGAGTCCTTCTGTATGAATGTTTATTGTGGGATCTGGCCAGCAGCCCGCAATGCAATGGGGCTCTCTCTTTGTTCCCAGGCAGATCGGCAGGTTGAGAAATAATAGACACACACAAGATAGTGAAAGCTGGGTCCAGGGGGGTCACCGCCTTCTGGTCCCACGGAGCCAAAAATGCACGGGATATACCAGCATTTATTATTAAGTTTAGTGAGGGCAGGGGTAGGTTAGTGAGGGATTTAGGGTCATTTGATTATGAGGTTAGATGGTCACATGGGGATGAAGTAATTCTTTAACATAACATCTGTATGCAGAAGTACAGTAT;CONTIG_NUM=136911;DOWNSTREAM=CAAGAAAGCTTCAAGTTTATTTACCTCTGAGTCCTTCTGTATGAATGTTTATTGTGGGATCTGGCCAGCAGCCCGCAATGCAATGGGGCTCTCTCTTTGTTCCCAGGCAGATCGGCAGGTTGAGAAATAATAGACACACACAAGATAGTGAAAGCTGGGTCCAGGGGGGTCACCGCCTTCTGGTCCCACGGAGCCAAAAATGCACGGGATATACCAGCATTTATTATTAAGTTTAGTGAGGGCAGGGGTAGGTTAGTGAGGGATTTAGGGTCATTTGATTATGAGGTTAGATGGTCACATGGGGATGAAGTAATTCTTTAACATAACATCTGTATGCAGAAGTACAGTAT;END=249176200;NS=1;READSOURCES=(0:44:63,1:0:64);SOMATICSCORE=60;SVLEN=-303;SVTYPE=DEL;UPSTREAM=TACTGAACTATTTAGATATCCCTGTGGTAATGTTTTGAATTGGTATTGTTTACCTTCCCATGTAAAGTTGGTATATTCCTGGCTTGCTTTATTTATTGGTTTGGCAAAGAACACATCTGACATGTCTATGATTGTATAGTATTTGTCATTATGATTAATGATCTTATTAACTAGCTCTTCTACATCTGGTAATGCTCTTGGCATTTTAGTTGAGACTTTATTTAAATTTCTATAGTCAATAGTTAATCTATAGCTCCTGTTTGTTTTTAAGACAGGC GT:GQ 1/.:.
chr10 20219603 chr10uGROUPERuDELu0u11231 AAAAAAAGGCTGGCACGGTGGCTCACACCTGTAAATCCCAGCACTTTGGGAGGCCGAGGTGGGTGGGTCACCTGAGGTTGG A 47 PASS CLUSTER_NUM=60987;CONTIG=GTATACTGATTTTGGAAAATATGTCAGCTCAATTTGGAAGATTGCTAAACCACCTAAAACAGAGCCTGTTTAAAAAATAAATAAATAAAAAATAATAGTTCAAGGCCAGCCTGACCAACAAGGTGAAATCCCATCTCTACTAAAACTACAAAAATTAGC;CONTIG_NUM=59978;DOWNSTREAM=GAGTTCAAGGCCAGCCTGACCAACAAGGTGAAATCCCATCTCTACTAAAACTACAAAAATTAGC;END=20219683;NS=1;READSOURCES=(0:7:18,1:0:60);SOMATICSCORE=40;SVLEN=-80;SVTYPE=DEL;UPSTREAM=GTATACTGATTTTGGAAAATATGTCAGCTCAATTTGGAAGATTGCTAAACCACCTAAAACAGAGCCTGTTTAAAAAATAAATAAATAAAAAATAA;ensembl_gene_id=ENSG00000120594 GT:GQ 1/.:.
chr11 56932527 chr11uGROUPERuDELu1u8703 CCAGAGCACATCATGAGATCCTGGAGCCAGACCTAGAAACCTATTAAACAAGGGAACCCCAGCATGTCTCATTTATTACCCAAAGGAAGGAAATTAGCATCACATGTATAAAGCACTCAGTAGTCTATAAAATGCTCTTAGCAATTCACTTCGTGAGGAAGTGCCTTTTCCCACTTCCACAGAGGGATACCGAGCCTCAAGGGATTAGGAGACTAATCCAGGCTCACACAGCTGATAAGGAACAGCCCAGACATTTTGGCCCAGTGCTGCTAGCCCTCAATCTGGTGCTTTGCCCTCTGCACCGCCTGCCATGCAGGGAATACATGTTAATATCTCTCTGTATTAGTCTGTTCTCATGCTGCTAATAAAGACATACCCAAGACTGGTTAATTTATAAAGGAAAGAGGTTTAACTGAATCACAGTTGCACATGGCTGGCATCATGGTGGAATGCAAAGGAGGAGCAAGGCCACATCTCACATGGTGGCAGGCAAGAGGGCATGTGCAGGGGAACTCCCCTTTATAAAACCATCAGCTCTCTGCTGGGTGTGGTGGCTCACACCTGTAATCCCAGCACTTTGGGAGGCCGAGACGGGTGGATCACCTGAAGTCAGGAGTTCGAGAACAGTCTGGCCAACATGGCGAAACCCCATCTCTATTAAAAATACAAAAAAAAATTAGTTGGGCGTGGCAGTGAGTGCCTGTAATCCCAGCTACTCGAGAGGCTGAGGCAGGAGAATCACCTGAGCCCAGGAGGCAGAGGTTGCAGTGAGCCAAGATCACGCCACTGCACTCCAGCCTGGGTGATAAGAGTGAAACTCGGTCTCAAAAAAAAAAAAAAAAAAAAAATCACATCTCACGAGACTTATTCACTATCATGAGAACAGCATGGGAAAACCCTGCCCCCATGATTCAATTACCTCCCACTGGGTCCCTCCTATGACATGTGGGGATTATTACAATTCATGGTGAGATTTGGGTGGGGACACAAAGCCAAACCATATCACTCTCTTTCTTGGCCACAGGTGGACTTGAAAAACCCTTTCCCTTAACCAAGCAGGAGCCCCAGTAGCTGCTTTGTTCAACGTCTGTTTCTCTAAGGTCTCCTACTCTGGAATATTTAGGAAAACCCAAGGTGGCTCAAAAAGATCATCCCTGTACCAAGCCTCAGGGATTCTAGTGTGACCCAACCTCTCCCAGTCCCTATAGGCATCTCTTTCAAACATCAGAACTGGTGCAGACTCAATAGAAGAAAGGTGTGACTCCAAGATGTCCTCCCTCACAGCCCTTTATCACAATGGGGCTCTCTTCACCGTAGAAGGGAAGGCTGAGGCTCAGAAATATGGTGTAGGCTTGGACTTTGGAAGGAGAATGACTAAGCTGAAGTTCTTCCTCTGCCATTTACAAGCTGTGTGACTTTGGAAAACTTTCTTAATGTTTTTGCTTTTAATTTCCTCATGTATAAAAGATGGGGTTGTCATACTTAGGTTTAAGACTATTGCACGTGCCTGTAATTCTAGCACTTTGGGAGGCCGAGGTGGGCAGATCACTTGAGGTCAGGAGTTTGAGACCAGCTGGCCAACATGGTGAAACACCATCGCTACTAAAAATATAAAAATTAGCCAGGCATGGTGATGCATGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGATTCGCTTGAACCTGGGACGTGGAGGTTGCGTTGAGGCAAGATCACGCCACTGCACTCCAGCCTGGGCAACAGAATGAGACTCCACCTCAAAAAAATAGAAGACTATTGCAAAGATTTTAAAAGATGGCACAGGTACAACACTGAACACAGTGTTTCATGAGTGACAGTCATAAGCTTTTCTACCACCTAACTGTGTTACTTTTAGCAAACTACCTAATTTATCTCGGCCTCGGTTGTTTTGTGATTCTTTTCAAGGGAAAAAAAAAGCACCTCCCTTCATAAGCCTGCTATAAGAACAATATAAAATAGTTGACATAAAGCACTTAATCTCTTGCCTGTCACAGGAAAGGTGCTCAACACCTGTTAGCTCTGTGTTGATGTCCCCAGATCAGAGAGCCAGAAAAGGAGGGCTAAAGTTCCAACCAGGATCTTCTGGTTCCAACCCAGCAGCACCTGAGCAAGGTTGATAATGGTAAAGAAAAGAAGAAATAAGCAATAGGGGCCTCACAAACACAGGCAGGAATAAATCACTCCCATGTGGCAGTTTTCTGTGCCTGACCCAAGAGATAGGTGTTGCACCTTTATCCATGTGGACAGATAAGAAAGAGCAAAGGGCATAGGTCACAGAGGTGAGTATGACCTCATTGCAGTGCCAGGATATTTCCAGGCAATTGGCAAGACTTATTGACAATCATCCAATAAATAGGATAAATAGTTCTTACTTCCCAAGTGCCTGGGAAGAGAGCTTGCAGCTCTTTCCAATTCCTGCCTCTCATCTCTTCCTCCTCGGACACTGCAGCTCTCCGTTTCTGGAAAATCTCAGGGCAGAATCTGGGCTCCTTCCCACTTTCCTCTGTCCAGAATTCTAAGGATGCCTGGGAGAAGGCATCTGCCCTGAATGAATGGGTCAGAGGCATGATTCCAAGTGACTGGCTGGTAATTGGAAGAGCTCAGTGGTCTGGCTGGGGAGATGAGAGCCTGCTAAGCACATCTGGCCAGCATCAGAATCACAAATTGAAGAGAGCTTGGAAGGACTCAGCCCCCACTGACATTCACAAAGGAAGGAAAATGTAGGGAGCCAGACAGAAAGGAGTGATGCTCTTCAAAGTCAACAGGCTTATAACAAACACCATCTCATAGGTGAAAGTGGGAGCACAGAACAGGCACACTCAGCTAACACACAGCTTTCTGAGGGAGGTCATCCTCCACCAAATGAAAATAGCCCTGCTTTTTCATTTTTTAATTTTTATTAATTTTTAAATCAACAAATAAAAATTATATATATTGGCCAGGTACAGTGGTTCATGCCTATAATCCCAGCACTTTGGGACGCCAAGGCAGGAGAACCACTTGAGACCAGGAGTTCAAGACCAGCCTGGACAACATAGTGAGATCCCATCACTACAAAAGAAAAAATATTTAAGGAAAAAAATTGTATATATTTATGGCATACGATGTGAAGTTTTGACATATCTACACATTGTGAAATGATTAAATCAAGCTAATTAACATATCCATCATGCCACATCCTTAAATTTTTATGGTGAGAACATTTAAGATCTATCTCAGCAATTTTGAAGTGCATGCTATTGTCACCATGCTACACAATAGACATCCAGAATTTATTCATCTTGTCTAGCTGAAACATTGTATCCTTTGACCAACATCTCCATACCTCTCCTGCATACCTCCCAGCCCCTGGTAACCATTATTCTCCTCTGCTGCTATGAGTTCGATTTGTTCGGATTCCACATATAAATAAGATCGTGCAATATATTTCTGTTTATGCCTGGCTTATTTCACTTAGCAAAATGTCCTCCAGTTTCATCCATGTTGTCACAAATGACAAGATCTCCTTCTTTTTTAAGACTGAATAGTATTCTATTGTGTACATGTACCACATTTTCTTTATCTGCTGTATTAGTCTGTTTTCACACTGCTGATAAAGACATATCCAAAACTGGGAACAAAAAGAGGTTTAATTGGACTTACAGTTCCACATGGCTGGAGACGCCTCAGAATCATCACAGGAGGTGAAAGGCAGTTCTTACATAGCAGCAGCAAGAAAAAATGAGGAGGAAGCAAAAGCAGAAACCCCTGATAAACCCATCAGATCTCATGAGACTTATTCACTATCACGAGAATAGCACGGGAAAGACCGGCCCCCATGATTCAATTACACACTCCCCGCCCCTGCTGGGTCCCTTCCACAACACGTGGGAATTCTGGACAATATAATTCAAGTTGAGATTTTGGTGGGGACACAGCCAAACCGTATCAT C 100 PASS CLUSTER_NUM=52260;CONTIG=CTTCTACCCCTGGCAGTGCAAAGTCCAGGACCAGGCAGGTGGGGGGTGCTGGAAAAGTTAGCAATTGAGTGATTGTACAGCCAATTTGTCACTTTCATGGGATCGGAGTGAGGCTATCTCAGAATCTTCTGTATCTACTTCATCTCTTGCTCTTTCCATTCTTTGATACTTTGACACATCCACATCCACTGCTCCTGGCCCCTCCGAATCTCATGTCCTCACATTTCAAAATCAATCATGCCTTCCCAACAGTCCCCCAAAGTCTTAACTTATTTCAGCATTAATCCAAAAGTCCACAGTCCAAAGTCTTATCTGAGACAAGGCAAGTCCCTTTCACCTATGAGCCTGCAAAATCAAAAGCAAGCTAGTTACTTCCTAGATACAATGGGGATACAGGTACTAAGTAAATACTGCTGATCCAAATGGGAGAAATTGGCCAAAACAAAGGGGCTACAGGGCCCATGCAAGTCT;CONTIG_NUM=52670;DOWNSTREAM=TCTGCTCCTGGCCCCTCCGAATCTCATGTCCTCACATTTCAAAATCAATCATGCCTTCCCAACAGTCCCCCAAAGTCTTAACTTATTTCAGCATTAATCCAAAAGTCCACAGTCCAAAGTCTTATCTGAGACAAGGCAAGTCCCTTTCACCTATGAGCCTGCAAAATCAAAAGCAAGCTAGTTACTTCCTAGATACAATGGGGATACAGGTACTAAGTAAATACTGCTGATCCAAATGGGAGAAATTGGCCAAAACAAAGGGGCTACAGGGCCCATGCAAGTCT;END=56936485;NS=1;READSOURCES=(0:21:23,1:0:65);SOMATICSCORE=60;SVLEN=-3958;SVTYPE=DEL;UPSTREAM=CTTCTACCCCTGGCAGTGCAAAGTCCAGGACCAGGCAGGTGGGGGGTGCTGGAAAAGTTAGCAATTGAGTGATTGTACAGCCAATTTGTCACTTTCATGGGATCGGAGTGAGGCTATCTCAGAATCTTCTGTATCTACTTCATCTCTTGCTCTTTCCATTCTTTGATACTTTGACACATCCACATCC GT:GQ 1/.:.
I used a code:
out = open('/home/istolarek/OUTintersectPT','w')
masterlist = [row for row in Pt]
for line in a:
g=[]
if line.startswith('chr'):
line = line.strip().split()
g.append(line[0])
## print line[0]
##print len(w)
for row in masterlist:
row = row.strip().split()
f = range(int(row[1]),int(row[2]))
w=[]
for i in g:
if i == row[0]:
w.append(int(line[1]))
for i in w:
## print line[0],row[0],line[1]
## out.write(str(line[0])+'\t'+str(row[0])+'\t'+str(line[1])+'\t'+str(f)+'\n')
if int(i) in f:
out.write(str(line)+'\n')
else:
break
else:
break
out.close()
This code seems to work, but takes far too much time.
So if column 1 in both files matches, go to comparing second column. Second column from file a is just a number (line[1]), in file Pt it is a range of values f = range(int(row[1]),int(row[2])). So if the first condition about matching columns 1 (these with chr values) and if values from second column from file a are in the range of f, I want to write these lines to the output.
I wrote another one:
I wrote:
masterlist = [row for row in Pt]
for line in a:
line = line.strip().split()
for row in masterlist:
row = row.strip().split()
b = int(line[1])
f = range(int(row[1]),int(row[2]))
if (line[0] == row[0]):
if a in f:
print b,f
These both should be a match. But the script only reports the first ontry from Pt file. If the first entry is not matched, the output is none. I want the script to output all matches
I'm fighting with this for quite some time.
Well, first of all, you are looping on a, but you assigned a value to a inside the loop, so it's not likely to get very far.
Second of all, I believe that strip().split() is redundant. You don't need strip() because it's implied in split().
Third of all, you should only split each line in the master file once. You are doing that for each line of input, which is bound to increase processing time a bit.
I am not entirely certain I understand your requirements from your code, but it seems to me something along these lines should help you:
import sys
from collections import defaultdict
master = defaultdict(list)
with open('Pt') as Pt:
for entry in Pt:
n, low, high = entry.split()
master[n].append(map(int, (low, high)))
with open('a') as a:
for line in a:
n, i = line.split()[:2]
for low, high in master[n]:
if low <= int(i) <= high:
sys.stdout.write(line)
break
To explain: First read and process all the data in the master file just once. Storing the master data in a defaultdict is handy here because it allows you to scan only the rows that matched the first column. map(int, ...) converts to ints.
When processing the input file, we can retrieve the ranges against which to compare the second value using the first value. Since master is a defaultdict(list), if there are no matches for the first column, we'll end up iterating an empty list.
Note that your original code using range() would have been equivalent to a condition
low <= i < high
You'll have to adjust the comparison operators as needed.
UPDATE oops. I put the break outside the condition. After fixing it I get the following three items:
chr1 1161693 chr1uGROUPERuDELu0u832 TGCTCTTTCCAGAAACCCTCAACCCTGTACGGTCAGGAGGAAACATGGCACCTCCCCTCTGGGG T 63 NormalSupport;MinSampleCount;LowSomaticScore CLUSTER_NUM=5454;CONTIG=GGTGCAGGGAAGCAGGAAGGAAGTGAAGCTCAAAAGCCCCTAGGACAGGGCACCTCCCCTCTGGATGCTCTTTCCAGAAACCCTCAACCTTGTACGGTCAGGAGAAAACACATCCCACAAG;CONTIG_NUM=5840;DOWNSTREAM=GCTCTTTCCAGAAACCCTCAACCCTGTACGGTCAGGAGAAAACACATCCCACAAG;END=1161756;NS=1;READSOURCES=(0:3:0,1:2:13);SOMATICSCORE=19;SVLEN=-63;SVTYPE=DEL;UPSTREAM=GGTGCAGGGAAGCGGGAAGGAAGTGAAGCTCAAAAGCCCCTAGGACAGGGCACCTCCCCTCTGGAT;ensembl_gene_id=ENSG00000078808 GT:GQ 1/.:.
chr1 158851689 chr1uGROUPERuDELu3u4452 GGGGAGTAATTCTTATTCATGATATGAAAACTCTAATGTGTTTCTTATTCCAGAAAA G 100 NormalSupport CLUSTER_NUM=25182;CONTIG=CATATTTTGCTATATCTCACATCATTGTTCATCTGATAATATATGAAAACTACAATGTGTTTCTTATTCCAGAAAGGGGAGTAATTCTTATTCATGAATAAACACTGAAGGAGAAAGATTATGGATCATAGTGGGAAAAGCCACAATACCATCTACATTC;CONTIG_NUM=24300;DOWNSTREAM=GGGAGTAATTCTTATTCATGAATAAACACTGACGGAGAAAGATTATGGATCATAGTGGGAAAAGCCACAATACCATCTACATTC;END=158851745;NS=1;READSOURCES=(0:11:0,1:3:18);SOMATICSCORE=55;SVLEN=-56;SVTYPE=DEL;UPSTREAM=CATATTTTGCTATATCTCACATCATTGTTCATCTGATAATATATGAAAACTCCAATGTGTTTCTTATTCCAGAAAG;ensembl_gene_id=ENSG00000229849 GT:GQ 1/.:.
chr1 165014865 chr1uGROUPERuDELu3u7344 ACTGGCATTAGCTATGCTTCCTTAGGCAGACAGCATGTTGAGAAATTCACATTCATCAG A 100 NormalSupport CLUSTER_NUM=40249;CONTIG=CTCCAGTAAAGAGCATCTTTTAATGAAGTGTATCTGCCTGGGCTAGAAAGGCAGCTGCCTCCACTAAAGCAGGGCTGGTCCAGAAATATTACCACTTGCCTAATCCTTATAGTAATCCTAACTGGCAGGTATTATTATATCCCAATTCACACACTTAGAGG;CONTIG_NUM=38845;DOWNSTREAM=CTTGCCTAATCCTTATAGTAATCCTAACTGGCAGGTATTATTATATCCCAATTCACACACTTAGAGG;END=165014923;NS=1;READSOURCES=(0:32:0,1:9:18);SOMATICSCORE=60;SVLEN=-58;SVTYPE=DEL;UPSTREAM=CTCCAGTAAAGAGCATCTTTTAATGAAGTGTATCTGCCTGGGCTAGAAAGGCAGCTGCCTCCACTAAAGCAGGGCTGGTCCAGAAATATTACCA GT:GQ 1/.:.
At least, don't do this:
row = row.strip().split()
f = range(int(row[1]),int(row[2]))
w=[]
print row[0]
if (line[0] == row[0]):
w.append(int(line[1]))
for i in w:
if (int(i) in f):
Instead:
f = int(row[1]), int(row[2])
...
if f[0] <= int(i) <= f[1]:
or similar.

log file parsing python

I have a log file with arbitrary number of lines. All I need is to extract is one line of data from the log file which starts with a string “Total”. I do not want any other lines from the file.
How do I write a simple python program for this?
This is how my input file looks
TestName id eno TPS GRE FNP
Test 1205 1 0 78.00 0.00 0.02
Test 1206 1 0 45.00 0.00 0.02
Test 1207 1 0 73400 0.00 0.02
Test 1208 1 0 34.00 0.00 0.02
Totals 64 0 129.61 145.64 1.12
I am trying to get an output file which looks like
TestName id TPS GRE
Totals 64 129.61 145.64
Ok.. So I wanted only the 1st, 2nd, 4th and 5th column from the input file but not others. I am trying the list[index] to achieve this but getting a IndexError: (list index out of range ). Also the space between 2 columns are not the same so i am not sure how to split the columns and select the ones that i want. Can somebody please help me with this. below is the program I used
newFile = open('sana.log','r')
for line in newFile.readlines():
if ('TestName' in line) or ('Totals' in line):
data = line.split('\t')
print data[0]+data[1]
theFile = open('thefile.txt','r')
FILE = theFile.readlines()
theFile.close()
printList = []
for line in FILE:
if ('TestName' in line) or ('Totals' in line):
# here you may want to do some splitting/concatenation/formatting to your string
printList.append(line)
for item in printList:
print item # or write it to another file... or whatever
for line in open('filename.txt', 'r'):
if line.startswith('TestName') or line.startswith('Totals'):
fields = line.rsplit(None, 5)
print '\t'.join(fields[:2] + fields[3:4])

ValueError: need more than 0 values to unpack

I am new to python and I am trying make a program that reads a file, and puts the information in its own vectors. the file is an xyz file that looks like this:
45
Fe -0.055 0.033 -0.047
N -0.012 -1.496 1.451
N 0.015 -1.462 -1.372
N 0.000 1.386 1.481
N 0.070 1.417 -1.339
C -0.096 -1.304 2.825
C 0.028 -1.241 -2.739
C -0.066 -2.872 1.251
C -0.0159 -2.838 -1.205
Starting from the 3rd line I need to place each in its own vectors, so far I have this:
file=open("Question4.xyz","r+")
A = []
B = []
C = []
D = []
counter=0
for line in file:
if counter>2: #information on particles start on the 2nd line
a,b,c,d=line.split()
A.append(a)
B.append(float(b))
C.append(float(c))
D.append(float(d))
counter=counter+1
I am getting this error:
File "<pyshell#72>", line 3, in <module>
a,b,c,d=line.split()
ValueError: need more than 0 values to unpack
Any ideas on where I am going wrong?
Thanks in advance!
It looks like you have lines in your that doesn't actually result in 4 items on splitting. Add a condition for that.
for line in file:
spl = line.strip().split()
if len(spl) == 4: # this will take care of both empty lines and
# lines containing greater than or less than four items
a, b, c, d = spl
A.append(a)
B.append(float(b))
C.append(float(c))
D.append(float(d))
Would you happen to have an empty line somewhere, by any chance (or with only a '\n') ?
You could force
if counter >= 2:
if line.strip():
(a,b,c,d) = line.strip().split()
An advantage of not checking whether your split line has a len of 4 is that it won't silently skip the line if it doesn't have the right number of fields (like you experienced yourself with the empty lines at the end of your files): you'll get an exception instead, which forces you to double-check your input (or your logic).

Categories

Resources