Python Forum
help! function that checks if a file is a bed file, tips so i can code it myself - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: help! function that checks if a file is a bed file, tips so i can code it myself (/thread-18777.html)



help! function that checks if a file is a bed file, tips so i can code it myself - lilyS - May-31-2019

hey (:
(sorry for my spelling mistakes)
i got an assignment to write a function, the input will be a file of some sort and if its a bed type file it will return True.
we have to use regular expression for this!
i wanted to creat a sample dict from a bed file and compar the lines of any file that will be put to the function to the sample dict. But this way dosent use regular expression Confused

the criterias for the function to return Treu are:
the bed file has 3 coloums
the first line is the discreption and stars with- #
firs colume starts with- chr and foloowed by an int or a one letter string.
secound colume is an int >0
third colume is an int>0
each colume seperated by tab

like so:

#Chromosome start_coordinate end_coordinate
chr1 19045 26433
chr2 374745 375876
chr 91234 2001

please help me,
thank u in advance


RE: help! function that checks if a file is a bed file - ichabod801 - May-31-2019

What have you tried? We're not big on writing code for people here, but we would be happy to help you fix your code when you run into problems. When you do run into problems, please post your code in Python tags, and clearly explain the problem you are having, including the full text of any errors.