Python Forum
help! function that checks if a file is a bed file, tips so i can code it myself
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help! function that checks if a file is a bed file, tips so i can code it myself
#1
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
Reply
#2
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.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Function combining file manipulation and loop Leyo 5 1,703 Mar-23-2022, 09:47 AM
Last Post: Leyo
  Can we store value in file if we open file in read mode? prasanthbab1234 3 2,509 Sep-26-2020, 12:10 PM
Last Post: ibreeden
  A function that checks if the list is sorted pooyan89 13 15,959 Jun-18-2019, 04:02 PM
Last Post: ThomasL
  Python with Finance - i have no code but don't do it for me give me tips please Akainu 1 2,358 May-30-2019, 07:57 PM
Last Post: nilamo
  reading text file and writing to an output file precedded by line numbers kannan 7 10,247 Dec-11-2018, 02:19 PM
Last Post: ichabod801
  Tips on surface plot HW question Cwcox 1 2,310 Nov-14-2018, 11:45 PM
Last Post: Larz60+
  Python code to convert executable file to doc or pdf Micmilli2 3 2,928 Oct-11-2018, 10:15 AM
Last Post: Larz60+
  Multiple XML file covert to CSV output file krish143 1 3,310 Jul-27-2018, 06:55 PM
Last Post: ichabod801
  function to write the contents of a webpage into a new file roadrage 4 5,961 Dec-01-2016, 09:28 PM
Last Post: snippsat
  Extract data csv file and write in another file alexgrand 3 5,061 Nov-14-2016, 06:54 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020